Home » Modeling » EMF » Intermittent NoSuchElementException
|
Re: Intermittent NoSuchElementException [message #1114740 is a reply to message #1114278] |
Mon, 23 September 2013 06:16 |
Ed Merks Messages: 33216 Registered: July 2009 |
Senior Member |
|
|
Ed,
Intermittency suggests a threading issue, otherwise you'd expect
deterministic behavior. Of course EMF doesn't introduce threading in
order to do a tree iteration, so that can't be the source of the
non-deterministic behavior. Neither AbstractEList (except for the
recent performance optimization in
https://bugs.eclipse.org/bugs/show_bug.cgi?id=416725) and EContentsEList
have changed in Kepler, so I can't imagine a change in EMF that would
lead to new exceptions. The state of the call stack suggests you're
iterating over some multi-valued feature's value, the "cursor" index
cached in the iterator is outside the bounds of the list's size, and
that iterator is somehow in that state without producing a concurrent
modification exception, so somehow the test for hasNext has returned
true, so cursor != list-size, yet calling list.get(cursor) is throwing
an index out of bounds exception. It's also apparent that you're
iterating over a multi-valued feature whose value is not a RandomAccess,
though EMF's multi-valued features are typically RandomAccess, so
perhaps some type of derived feature is involved. As you suggest,
iterating over the tree of a resource's contents is a very heavily use
utility, so if there were a general problem in the core runtime in this
regard, it would be a problem you'd expect to come up frequently across
many clients.
On 22/09/2013 3:31 PM, Ed Willink wrote:
> Hi
>
> Since Kepler, I've started seeing intermittent JUnit test failures
> with a NoSuchElementException during a Resource.getAllContents()
> traversal. Since the failing traversal is invoked in code that is new
> since Kepler, obviously my new code is faulty... But I've now
> instrumented it to see if any domain corruption occurs and it now
> fails during the preliminary read-only pass to build a debug list of
> objects. So I can be fairly confident that it is not my code.
> (https://bugs.eclipse.org/bugs/show_bug.cgi?id=417663).
>
> The failure is intermittent, perhaps at the rate of about 1 in a 100.
>
> It seems very unlikely that this intermittency can have been in EMF
> for long, so has anything in EMF changed that might make tree
> iteration fail intermittently?
>
> Anyone else seeing similar problems?
>
> Regards
>
> Ed Willink.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: Intermittent NoSuchElementException [message #1228197 is a reply to message #1114740] |
Mon, 06 January 2014 16:26 |
Ed Willink Messages: 7670 Registered: July 2009 |
Senior Member |
|
|
Hi
I think I found it. You were right; a threading issue, but the garbage
collector rather than an EMF thread. Garbage collection kept a weak List
cache consistent with a WeakHashMap. Occasionally garbage collection
didn't chip in. .... No domain corruption; No new objects; just
competing size() values.
Regards
Ed
On 23/09/2013 07:16, Ed Merks wrote:
> Ed,
>
> Intermittency suggests a threading issue, otherwise you'd expect
> deterministic behavior. Of course EMF doesn't introduce threading in
> order to do a tree iteration, so that can't be the source of the
> non-deterministic behavior. Neither AbstractEList (except for the
> recent performance optimization in
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=416725) and
> EContentsEList have changed in Kepler, so I can't imagine a change in
> EMF that would lead to new exceptions. The state of the call stack
> suggests you're iterating over some multi-valued feature's value, the
> "cursor" index cached in the iterator is outside the bounds of the
> list's size, and that iterator is somehow in that state without
> producing a concurrent modification exception, so somehow the test for
> hasNext has returned true, so cursor != list-size, yet calling
> list.get(cursor) is throwing an index out of bounds exception. It's
> also apparent that you're iterating over a multi-valued feature whose
> value is not a RandomAccess, though EMF's multi-valued features are
> typically RandomAccess, so perhaps some type of derived feature is
> involved. As you suggest, iterating over the tree of a resource's
> contents is a very heavily use utility, so if there were a general
> problem in the core runtime in this regard, it would be a problem
> you'd expect to come up frequently across many clients.
>
>
> On 22/09/2013 3:31 PM, Ed Willink wrote:
>> Hi
>>
>> Since Kepler, I've started seeing intermittent JUnit test failures
>> with a NoSuchElementException during a Resource.getAllContents()
>> traversal. Since the failing traversal is invoked in code that is new
>> since Kepler, obviously my new code is faulty... But I've now
>> instrumented it to see if any domain corruption occurs and it now
>> fails during the preliminary read-only pass to build a debug list of
>> objects. So I can be fairly confident that it is not my code.
>> (https://bugs.eclipse.org/bugs/show_bug.cgi?id=417663).
>>
>> The failure is intermittent, perhaps at the rate of about 1 in a 100.
>>
>> It seems very unlikely that this intermittency can have been in EMF
>> for long, so has anything in EMF changed that might make tree
>> iteration fail intermittently?
>>
>> Anyone else seeing similar problems?
>>
>> Regards
>>
>> Ed Willink.
>
|
|
|
Goto Forum:
Current Time: Wed Sep 18 18:02:35 GMT 2024
Powered by FUDForum. Page generated in 0.03579 seconds
|