Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Intermittent NoSuchElementException
Intermittent NoSuchElementException [message #1114278] Sun, 22 September 2013 13:31 Go to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
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.
Re: Intermittent NoSuchElementException [message #1114740 is a reply to message #1114278] Mon, 23 September 2013 06:16 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33136
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 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
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.
>
Previous Topic:[CDO] DBStore support for join and async query
Next Topic:Prevent generation of DocumentRoot Java class
Goto Forum:
  


Current Time: Fri Apr 19 01:16:48 GMT 2024

Powered by FUDForum. Page generated in 0.02055 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top