Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [Transaction] IllegalArgumentException when collecting notifications
[Transaction] IllegalArgumentException when collecting notifications [message #413058] Wed, 19 September 2007 06:49 Go to next message
Eclipse UserFriend
Originally posted by: krzysztofHMMMMdaniel.gmail.com

Hi All

When AbstractEMFOperation will end with exception,
IllegalArgumentException happens, similar to the one described here:
http://dev.eclipse.org/newslists/news.eclipse.modeling.gmf/m sg02365.html.

This can be easily solved by adding following line

if(next.parentNotificationCount == 0) continue;

inside the loop
org.eclipse.emf.transaction.impl.ReadWriteValidatorImpl$Noti ficationTree.collectNotifications.

The problem is that notifications are sublisted from some list from
(basically) previousEnd tp next.parentNotificationCount. But when
parentNotificationCount is 0, we try to sublist from N>0 to 0 which
causes error.

I have a few questions about this:
1. May this be caused by invalid usage of EMF/Transaction?
2. Is this a bug and should I fill the bugzilla entry?

TIA

--
Christopher Daniel
http://eclipser-blog.blogspot.com/
Re: [Transaction] IllegalArgumentException when collecting notifications [message #413072 is a reply to message #413058] Wed, 19 September 2007 14:37 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Chris,

See some comments in-line, below.

Thanks,

Christian

Krzysztof Daniel wrote:

> Hi All
>
> When AbstractEMFOperation will end with exception,
> IllegalArgumentException happens, similar to the one described here:
> http://dev.eclipse.org/newslists/news.eclipse.modeling.gmf/m sg02365.html.
>
> This can be easily solved by adding following line
>
> if(next.parentNotificationCount == 0) continue;
>
> inside the loop
>
org.eclipse.emf.transaction.impl.ReadWriteValidatorImpl$Noti ficationTree.collectNotifications.

That might make the problem go away, but I think it would only hide the
symptom rather than restore correct function. It shouldn't be possible
that (lastIndex > next.parentNotificationCount) because if the parent
transaction didn't have any notifications when some child was started, then
neither could any of the preceding children. Definitely, some child
transaction has an incorrect parentNotificationCount (was zero when it
should have been greater) and that is the problem that needs to be fixed.


> The problem is that notifications are sublisted from some list from
> (basically) previousEnd tp next.parentNotificationCount. But when
> parentNotificationCount is 0, we try to sublist from N>0 to 0 which
> causes error.
>
> I have a few questions about this:
> 1. May this be caused by invalid usage of EMF/Transaction?

Off the top of my head, the only way that I could see this happening is if
there is a gap in the concurrency controls relating to transaction options
such as was fixed the 1.1.1 M200708231550 build for
https://bugs.eclipse.org/bugs/show_bug.cgi?id=200965. Certainly, a
client's usage must not be able to cause this condition, whether correct or
not.

> 2. Is this a bug and should I fill the bugzilla entry?

I'd say it is a bug. If you can provide a reproducible test case, please
attach enough information and/or code on the bug to reproduce it. I will
need to debug something to see why the parentNotificationCount is
incorrect. I'll be interested to know whether you can reproduce it with
the M200708231550 build.

>
> TIA
>
Re: [Transaction] IllegalArgumentException when collecting notifications [message #468143 is a reply to message #413072] Tue, 04 August 2009 11:00 Go to previous messageGo to next message
Mariot Chauvin is currently offline Mariot ChauvinFriend
Messages: 174
Registered: July 2009
Senior Member
Hi,

I have a case where I reproduce systematically with emf.transaction 1.1.2 (so bug #200965 is fixed). Unfortunately I can't share the code nor isolate easily a basic test case to reproduce.
In my case, debugging shows that there are 7 children, and only the first one has a parentNotificationCount set to 1 (the following have all 0).
I guess I should look to parentNotificationCount assignation, which seems related to nested transactions :

"if (parent == null) {
parentNotificationCount = 0;
} else {
parentNotificationCount = parent.getNotifications().size();
}"

Any hints that may help me ?

Thanks,

Best regards,

Mariot

Re: [Transaction] IllegalArgumentException when collecting notifications [message #468188 is a reply to message #468143] Tue, 04 August 2009 13:30 Go to previous messageGo to next message
Boris Gruschko is currently offline Boris GruschkoFriend
Messages: 14
Registered: July 2009
Junior Member
Hi Mariot,

is this message a description of a current problem ? I have the feeling that
this is a reply to an ancient message.

Thanks for the clarification,
Boris

"Mariot Chauvin" <mariot.chauvin@obeo.fr> wrote in message
news:h594cg$1sl$1@build.eclipse.org...
> Hi,
>
> I have a case where I reproduce systematically with emf.transaction 1.1.2
> (so bug #200965 is fixed). Unfortunately I can't share the code nor
> isolate easily a basic test case to reproduce.
> In my case, debugging shows that there are 7 children, and only the first
> one has a parentNotificationCount set to 1 (the following have all 0).
> I guess I should look to parentNotificationCount assignation, which seems
> related to nested transactions :
>
> "if (parent == null) {
> parentNotificationCount = 0;
> } else {
> parentNotificationCount = parent.getNotifications().size();
> }"
>
> Any hints that may help me ?
>
> Thanks,
>
> Best regards,
>
> Mariot
>
>
Re: [Transaction] IllegalArgumentException when collecting notifications [message #468215 is a reply to message #468188] Tue, 04 August 2009 14:45 Go to previous messageGo to next message
Mariot Chauvin is currently offline Mariot ChauvinFriend
Messages: 174
Registered: July 2009
Senior Member
Hi Boris,

I recently encountered an "IllegalArgumentException" using EMF Transaction.
This morning I did a quick search and found a thread quite old, but with
the same problem :

http://dev.eclipse.org/newslists/news.eclipse.tools.emf/msg2 6773.html

So this message was a description of a problem I am currently facing and
and a reply of the original message, sorry for the confusion.

Since I debugged my program, and here I will try to explain what happens.

1 - A first transaction(T1), not read only, is created and then started.

2 - A new NotificationTree(N1) is instanciated with
parentNotificationCount value it set to 2 (parentNotificationCount =
parent.getNotifications().size();)

3 - A RollbackException is launched (intentionally), so
Transaction#rollback() on T1 is called.

4 - NotificationTree#setRolledBack() is called on N1,
parentNotificationCount value is set to 1

5 - ChangeDescription#apply() is called due to rollback. An EMF model
modification is done, which notify the adapters.

6 - One of our adapter launches a read only operation
(TransactionalEditingDomain#runExclusive(Runnable runnable), that means
creation of a second Transaction (T2), read only, with T1 as parent.

7 - T2 is activated, The transaction validator adds T2. During this
addition, a new NotificationTree(N2) is instanciated and added as
children of the parent of the (N1)(N1 and N2 are children of the same
parent) :

"NotificationTree parent = findTree(transaction.getParent());
NotificationTree newTree = null;

if (transaction.getParent() == null) {
// got the root transaction
tree = new NotificationTree(transaction, notificationMask);
newTree = tree;
} else if (parent != null) {
// if the transaction has a parent but there is no matching
// tree node, then this parent is silent, so there is no
// need to create any descendent nodes
newTree = parent.addChild(transaction, notificationMask);
}"


During N2 instantion, N2 parentNotificationCount value is set to 0, as
T1 has no longer notifications :

"InternalTransaction parent = (InternalTransaction) transaction.getParent();

if (parent == null) {
parentNotificationCount = 0;
} else {
parentNotificationCount = parent.getNotifications().size();
}"
So here we have a first child with parentNotificationCount value set to
0, and a second with a parentNotificationCount value set to 1.

8 - IllegalArgumentException is launched during close of T1. This is due
to NotificationTree instances having different
parentNotificationCount. (see previous messages of the thread).


Did I miss something, or misuse EMF transaction ?

Thanks,

Regards,

Mariot

Boris Gruschko a écrit :
> Hi Mariot,
>
> is this message a description of a current problem ? I have the feeling
> that this is a reply to an ancient message.
>
> Thanks for the clarification,
> Boris
>
> "Mariot Chauvin" <mariot.chauvin@obeo.fr> wrote in message
> news:h594cg$1sl$1@build.eclipse.org...
>> Hi,
>>
>> I have a case where I reproduce systematically with emf.transaction
>> 1.1.2 (so bug #200965 is fixed). Unfortunately I can't share the code
>> nor isolate easily a basic test case to reproduce.
>> In my case, debugging shows that there are 7 children, and only the
>> first one has a parentNotificationCount set to 1 (the following have
>> all 0).
>> I guess I should look to parentNotificationCount assignation, which
>> seems related to nested transactions :
>>
>> "if (parent == null) {
>> parentNotificationCount = 0;
>> } else {
>> parentNotificationCount = parent.getNotifications().size();
>> }"
>>
>> Any hints that may help me ?
>>
>> Thanks,
>>
>> Best regards,
>>
>> Mariot
>>
>>
>
Re: [Transaction] IllegalArgumentException when collecting notifications [message #468248 is a reply to message #468215] Tue, 04 August 2009 17:16 Go to previous messageGo to next message
Boris Gruschko is currently offline Boris GruschkoFriend
Messages: 14
Registered: July 2009
Junior Member
Mariot,

I'll have to dig a bit further and try to reconstruct your situation.

One things which seems to be a little odd is the starting of a transaction
in an adapter. However this seems to be a legitimate behaviour.

I'll try to come up with something until tomorrow.

Sorry for the delay and cheers,
Boris

"Mariot Chauvin" <mariot.chauvin@obeo.fr> wrote in message
news:h59hiv$r1j$1@build.eclipse.org...
> Hi Boris,
>
> I recently encountered an "IllegalArgumentException" using EMF
> Transaction.
> This morning I did a quick search and found a thread quite old, but with
> the same problem :
>
> http://dev.eclipse.org/newslists/news.eclipse.tools.emf/msg2 6773.html
>
> So this message was a description of a problem I am currently facing and
> and a reply of the original message, sorry for the confusion.
>
> Since I debugged my program, and here I will try to explain what happens.
>
> 1 - A first transaction(T1), not read only, is created and then started.
>
> 2 - A new NotificationTree(N1) is instanciated with
> parentNotificationCount value it set to 2 (parentNotificationCount =
> parent.getNotifications().size();)
>
> 3 - A RollbackException is launched (intentionally), so
> Transaction#rollback() on T1 is called.
>
> 4 - NotificationTree#setRolledBack() is called on N1,
> parentNotificationCount value is set to 1
>
> 5 - ChangeDescription#apply() is called due to rollback. An EMF model
> modification is done, which notify the adapters.
>
> 6 - One of our adapter launches a read only operation
> (TransactionalEditingDomain#runExclusive(Runnable runnable), that means
> creation of a second Transaction (T2), read only, with T1 as parent.
>
> 7 - T2 is activated, The transaction validator adds T2. During this
> addition, a new NotificationTree(N2) is instanciated and added as children
> of the parent of the (N1)(N1 and N2 are children of the same parent) :
>
> "NotificationTree parent = findTree(transaction.getParent());
> NotificationTree newTree = null;
>
> if (transaction.getParent() == null) {
> // got the root transaction
> tree = new NotificationTree(transaction, notificationMask);
> newTree = tree;
> } else if (parent != null) {
> // if the transaction has a parent but there is no matching
> // tree node, then this parent is silent, so there is no
> // need to create any descendent nodes
> newTree = parent.addChild(transaction, notificationMask);
> }"
>
>
> During N2 instantion, N2 parentNotificationCount value is set to 0, as T1
> has no longer notifications :
>
> "InternalTransaction parent = (InternalTransaction)
> transaction.getParent();
>
> if (parent == null) {
> parentNotificationCount = 0;
> } else {
> parentNotificationCount = parent.getNotifications().size();
> }"
> So here we have a first child with parentNotificationCount value set to 0,
> and a second with a parentNotificationCount value set to 1.
>
> 8 - IllegalArgumentException is launched during close of T1. This is due
> to NotificationTree instances having different parentNotificationCount.
> (see previous messages of the thread).
>
>
> Did I miss something, or misuse EMF transaction ?
>
> Thanks,
>
> Regards,
>
> Mariot
>
> Boris Gruschko a écrit :
>> Hi Mariot,
>>
>> is this message a description of a current problem ? I have the feeling
>> that this is a reply to an ancient message.
>>
>> Thanks for the clarification,
>> Boris
>>
>> "Mariot Chauvin" <mariot.chauvin@obeo.fr> wrote in message
>> news:h594cg$1sl$1@build.eclipse.org...
>>> Hi,
>>>
>>> I have a case where I reproduce systematically with emf.transaction
>>> 1.1.2 (so bug #200965 is fixed). Unfortunately I can't share the code
>>> nor isolate easily a basic test case to reproduce.
>>> In my case, debugging shows that there are 7 children, and only the
>>> first one has a parentNotificationCount set to 1 (the following have
>>> all 0).
>>> I guess I should look to parentNotificationCount assignation, which
>>> seems related to nested transactions :
>>>
>>> "if (parent == null) {
>>> parentNotificationCount = 0;
>>> } else {
>>> parentNotificationCount = parent.getNotifications().size();
>>> }"
>>>
>>> Any hints that may help me ?
>>>
>>> Thanks,
>>>
>>> Best regards,
>>>
>>> Mariot
>>>
>>>
>>
Re: [Transaction] IllegalArgumentException when collecting notifications [message #468339 is a reply to message #468215] Wed, 05 August 2009 07:43 Go to previous messageGo to next message
Boris Gruschko is currently offline Boris GruschkoFriend
Messages: 14
Registered: July 2009
Junior Member
Hi Mariot,

I tried to reconstruct your situation without success.

Is there any concurrency involved in your use case ? E.g. does T1 run in
another thread than T2 ?

It would help if you could share some of your code.

/Boris


"Mariot Chauvin" <mariot.chauvin@obeo.fr> wrote in message
news:h59hiv$r1j$1@build.eclipse.org...
> Hi Boris,
>
> I recently encountered an "IllegalArgumentException" using EMF
> Transaction.
> This morning I did a quick search and found a thread quite old, but with
> the same problem :
>
> http://dev.eclipse.org/newslists/news.eclipse.tools.emf/msg2 6773.html
>
> So this message was a description of a problem I am currently facing and
> and a reply of the original message, sorry for the confusion.
>
> Since I debugged my program, and here I will try to explain what happens.
>
> 1 - A first transaction(T1), not read only, is created and then started.
>
> 2 - A new NotificationTree(N1) is instanciated with
> parentNotificationCount value it set to 2 (parentNotificationCount =
> parent.getNotifications().size();)
>
> 3 - A RollbackException is launched (intentionally), so
> Transaction#rollback() on T1 is called.
>
> 4 - NotificationTree#setRolledBack() is called on N1,
> parentNotificationCount value is set to 1
>
> 5 - ChangeDescription#apply() is called due to rollback. An EMF model
> modification is done, which notify the adapters.
>
> 6 - One of our adapter launches a read only operation
> (TransactionalEditingDomain#runExclusive(Runnable runnable), that means
> creation of a second Transaction (T2), read only, with T1 as parent.
>
> 7 - T2 is activated, The transaction validator adds T2. During this
> addition, a new NotificationTree(N2) is instanciated and added as children
> of the parent of the (N1)(N1 and N2 are children of the same parent) :
>
> "NotificationTree parent = findTree(transaction.getParent());
> NotificationTree newTree = null;
>
> if (transaction.getParent() == null) {
> // got the root transaction
> tree = new NotificationTree(transaction, notificationMask);
> newTree = tree;
> } else if (parent != null) {
> // if the transaction has a parent but there is no matching
> // tree node, then this parent is silent, so there is no
> // need to create any descendent nodes
> newTree = parent.addChild(transaction, notificationMask);
> }"
>
>
> During N2 instantion, N2 parentNotificationCount value is set to 0, as T1
> has no longer notifications :
>
> "InternalTransaction parent = (InternalTransaction)
> transaction.getParent();
>
> if (parent == null) {
> parentNotificationCount = 0;
> } else {
> parentNotificationCount = parent.getNotifications().size();
> }"
> So here we have a first child with parentNotificationCount value set to 0,
> and a second with a parentNotificationCount value set to 1.
>
> 8 - IllegalArgumentException is launched during close of T1. This is due
> to NotificationTree instances having different parentNotificationCount.
> (see previous messages of the thread).
>
>
> Did I miss something, or misuse EMF transaction ?
>
> Thanks,
>
> Regards,
>
> Mariot
>
> Boris Gruschko a écrit :
>> Hi Mariot,
>>
>> is this message a description of a current problem ? I have the feeling
>> that this is a reply to an ancient message.
>>
>> Thanks for the clarification,
>> Boris
>>
>> "Mariot Chauvin" <mariot.chauvin@obeo.fr> wrote in message
>> news:h594cg$1sl$1@build.eclipse.org...
>>> Hi,
>>>
>>> I have a case where I reproduce systematically with emf.transaction
>>> 1.1.2 (so bug #200965 is fixed). Unfortunately I can't share the code
>>> nor isolate easily a basic test case to reproduce.
>>> In my case, debugging shows that there are 7 children, and only the
>>> first one has a parentNotificationCount set to 1 (the following have
>>> all 0).
>>> I guess I should look to parentNotificationCount assignation, which
>>> seems related to nested transactions :
>>>
>>> "if (parent == null) {
>>> parentNotificationCount = 0;
>>> } else {
>>> parentNotificationCount = parent.getNotifications().size();
>>> }"
>>>
>>> Any hints that may help me ?
>>>
>>> Thanks,
>>>
>>> Best regards,
>>>
>>> Mariot
>>>
>>>
>>
Re: [Transaction] IllegalArgumentException when collecting notifications [message #468400 is a reply to message #468339] Wed, 05 August 2009 12:28 Go to previous messageGo to next message
Mariot Chauvin is currently offline Mariot ChauvinFriend
Messages: 174
Registered: July 2009
Senior Member
Hi Boris,

Thanks for taking time to try to reproduce.
Now I think the best is that I take time to write a repoduction unit
test case.

Thanks,

Mariot


Boris Gruschko a écrit :
> Hi Mariot,
>
> I tried to reconstruct your situation without success.
>
> Is there any concurrency involved in your use case ? E.g. does T1 run in
> another thread than T2 ?
>
> It would help if you could share some of your code.
>
> /Boris
>
>
> "Mariot Chauvin" <mariot.chauvin@obeo.fr> wrote in message
> news:h59hiv$r1j$1@build.eclipse.org...
>> Hi Boris,
>>
>> I recently encountered an "IllegalArgumentException" using EMF
>> Transaction.
>> This morning I did a quick search and found a thread quite old, but
>> with the same problem :
>>
>> http://dev.eclipse.org/newslists/news.eclipse.tools.emf/msg2 6773.html
>>
>> So this message was a description of a problem I am currently facing
>> and and a reply of the original message, sorry for the confusion.
>>
>> Since I debugged my program, and here I will try to explain what happens.
>>
>> 1 - A first transaction(T1), not read only, is created and then started.
>>
>> 2 - A new NotificationTree(N1) is instanciated with
>> parentNotificationCount value it set to 2 (parentNotificationCount =
>> parent.getNotifications().size();)
>>
>> 3 - A RollbackException is launched (intentionally), so
>> Transaction#rollback() on T1 is called.
>>
>> 4 - NotificationTree#setRolledBack() is called on N1,
>> parentNotificationCount value is set to 1
>>
>> 5 - ChangeDescription#apply() is called due to rollback. An EMF model
>> modification is done, which notify the adapters.
>>
>> 6 - One of our adapter launches a read only operation
>> (TransactionalEditingDomain#runExclusive(Runnable runnable), that
>> means creation of a second Transaction (T2), read only, with T1 as
>> parent.
>>
>> 7 - T2 is activated, The transaction validator adds T2. During this
>> addition, a new NotificationTree(N2) is instanciated and added as
>> children of the parent of the (N1)(N1 and N2 are children of the same
>> parent) :
>>
>> "NotificationTree parent = findTree(transaction.getParent());
>> NotificationTree newTree = null;
>>
>> if (transaction.getParent() == null) {
>> // got the root transaction
>> tree = new NotificationTree(transaction, notificationMask);
>> newTree = tree;
>> } else if (parent != null) {
>> // if the transaction has a parent but there is no matching
>> // tree node, then this parent is silent, so there is no
>> // need to create any descendent nodes
>> newTree = parent.addChild(transaction, notificationMask);
>> }"
>>
>>
>> During N2 instantion, N2 parentNotificationCount value is set to 0, as
>> T1 has no longer notifications :
>>
>> "InternalTransaction parent = (InternalTransaction)
>> transaction.getParent();
>>
>> if (parent == null) {
>> parentNotificationCount = 0;
>> } else {
>> parentNotificationCount = parent.getNotifications().size();
>> }"
>> So here we have a first child with parentNotificationCount value set
>> to 0, and a second with a parentNotificationCount value set to 1.
>>
>> 8 - IllegalArgumentException is launched during close of T1. This is
>> due to NotificationTree instances having different
>> parentNotificationCount. (see previous messages of the thread).
>>
>>
>> Did I miss something, or misuse EMF transaction ?
>>
>> Thanks,
>>
>> Regards,
>>
>> Mariot
>>
>> Boris Gruschko a écrit :
>>> Hi Mariot,
>>>
>>> is this message a description of a current problem ? I have the
>>> feeling that this is a reply to an ancient message.
>>>
>>> Thanks for the clarification,
>>> Boris
>>>
>>> "Mariot Chauvin" <mariot.chauvin@obeo.fr> wrote in message
>>> news:h594cg$1sl$1@build.eclipse.org...
>>>> Hi,
>>>>
>>>> I have a case where I reproduce systematically with emf.transaction
>>>> 1.1.2 (so bug #200965 is fixed). Unfortunately I can't share the
>>>> code nor isolate easily a basic test case to reproduce.
>>>> In my case, debugging shows that there are 7 children, and only the
>>>> first one has a parentNotificationCount set to 1 (the following
>>>> have all 0).
>>>> I guess I should look to parentNotificationCount assignation, which
>>>> seems related to nested transactions :
>>>>
>>>> "if (parent == null) {
>>>> parentNotificationCount = 0;
>>>> } else {
>>>> parentNotificationCount = parent.getNotifications().size();
>>>> }"
>>>>
>>>> Any hints that may help me ?
>>>>
>>>> Thanks,
>>>>
>>>> Best regards,
>>>>
>>>> Mariot
>>>>
>>>>
>>>
>
Re: [Transaction] IllegalArgumentException when collecting notifications [message #468501 is a reply to message #468400] Wed, 05 August 2009 16:57 Go to previous messageGo to next message
Mariot Chauvin is currently offline Mariot ChauvinFriend
Messages: 174
Registered: July 2009
Senior Member
Finnaly got it !

I opened bug 285734 with a testcase to reproduce.
See https://bugs.eclipse.org/bugs/show_bug.cgi?id=285734

Mariot Chauvin a écrit :
> Hi Boris,
>
> Thanks for taking time to try to reproduce.
> Now I think the best is that I take time to write a repoduction unit
> test case.
>
> Thanks,
>
> Mariot
>
>
> Boris Gruschko a écrit :
>> Hi Mariot,
>>
>> I tried to reconstruct your situation without success.
>>
>> Is there any concurrency involved in your use case ? E.g. does T1 run
>> in another thread than T2 ?
>>
>> It would help if you could share some of your code.
>>
>> /Boris
>>
>>
>> "Mariot Chauvin" <mariot.chauvin@obeo.fr> wrote in message
>> news:h59hiv$r1j$1@build.eclipse.org...
>>> Hi Boris,
>>>
>>> I recently encountered an "IllegalArgumentException" using EMF
>>> Transaction.
>>> This morning I did a quick search and found a thread quite old, but
>>> with the same problem :
>>>
>>> http://dev.eclipse.org/newslists/news.eclipse.tools.emf/msg2 6773.html
>>>
>>> So this message was a description of a problem I am currently facing
>>> and and a reply of the original message, sorry for the confusion.
>>>
>>> Since I debugged my program, and here I will try to explain what
>>> happens.
>>>
>>> 1 - A first transaction(T1), not read only, is created and then started.
>>>
>>> 2 - A new NotificationTree(N1) is instanciated with
>>> parentNotificationCount value it set to 2 (parentNotificationCount =
>>> parent.getNotifications().size();)
>>>
>>> 3 - A RollbackException is launched (intentionally), so
>>> Transaction#rollback() on T1 is called.
>>>
>>> 4 - NotificationTree#setRolledBack() is called on N1,
>>> parentNotificationCount value is set to 1
>>>
>>> 5 - ChangeDescription#apply() is called due to rollback. An EMF model
>>> modification is done, which notify the adapters.
>>>
>>> 6 - One of our adapter launches a read only operation
>>> (TransactionalEditingDomain#runExclusive(Runnable runnable), that
>>> means creation of a second Transaction (T2), read only, with T1 as
>>> parent.
>>>
>>> 7 - T2 is activated, The transaction validator adds T2. During this
>>> addition, a new NotificationTree(N2) is instanciated and added as
>>> children of the parent of the (N1)(N1 and N2 are children of the same
>>> parent) :
>>>
>>> "NotificationTree parent = findTree(transaction.getParent());
>>> NotificationTree newTree = null;
>>>
>>> if (transaction.getParent() == null) {
>>> // got the root transaction
>>> tree = new NotificationTree(transaction, notificationMask);
>>> newTree = tree;
>>> } else if (parent != null) {
>>> // if the transaction has a parent but there is no matching
>>> // tree node, then this parent is silent, so there is no
>>> // need to create any descendent nodes
>>> newTree = parent.addChild(transaction, notificationMask);
>>> }"
>>>
>>>
>>> During N2 instantion, N2 parentNotificationCount value is set to 0,
>>> as T1 has no longer notifications :
>>>
>>> "InternalTransaction parent = (InternalTransaction)
>>> transaction.getParent();
>>>
>>> if (parent == null) {
>>> parentNotificationCount = 0;
>>> } else {
>>> parentNotificationCount = parent.getNotifications().size();
>>> }"
>>> So here we have a first child with parentNotificationCount value set
>>> to 0, and a second with a parentNotificationCount value set to 1.
>>>
>>> 8 - IllegalArgumentException is launched during close of T1. This is
>>> due to NotificationTree instances having different
>>> parentNotificationCount. (see previous messages of the thread).
>>>
>>>
>>> Did I miss something, or misuse EMF transaction ?
>>>
>>> Thanks,
>>>
>>> Regards,
>>>
>>> Mariot
>>>
>>> Boris Gruschko a écrit :
>>>> Hi Mariot,
>>>>
>>>> is this message a description of a current problem ? I have the
>>>> feeling that this is a reply to an ancient message.
>>>>
>>>> Thanks for the clarification,
>>>> Boris
>>>>
>>>> "Mariot Chauvin" <mariot.chauvin@obeo.fr> wrote in message
>>>> news:h594cg$1sl$1@build.eclipse.org...
>>>>> Hi,
>>>>>
>>>>> I have a case where I reproduce systematically with emf.transaction
>>>>> 1.1.2 (so bug #200965 is fixed). Unfortunately I can't share the
>>>>> code nor isolate easily a basic test case to reproduce.
>>>>> In my case, debugging shows that there are 7 children, and only the
>>>>> first one has a parentNotificationCount set to 1 (the following
>>>>> have all 0).
>>>>> I guess I should look to parentNotificationCount assignation, which
>>>>> seems related to nested transactions :
>>>>>
>>>>> "if (parent == null) {
>>>>> parentNotificationCount = 0;
>>>>> } else {
>>>>> parentNotificationCount = parent.getNotifications().size();
>>>>> }"
>>>>>
>>>>> Any hints that may help me ?
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Best regards,
>>>>>
>>>>> Mariot
>>>>>
>>>>>
>>>>
>>
Re: [Transaction] IllegalArgumentException when collecting notifications [message #478677 is a reply to message #468501] Thu, 06 August 2009 11:23 Go to previous message
Boris Gruschko is currently offline Boris GruschkoFriend
Messages: 14
Registered: July 2009
Junior Member
Hi Mariot,

thanks for the test.

However, I can|t reproduce the bug. I tried to reproduce it against 1.1
mainentance branch.

How do we proceed ?

P.S. I suggest that we continue the discussion in bugzilla.

Cheers,
Boris

"Mariot Chauvin" <mariot.chauvin@obeo.fr> wrote in message
news:h5cdm7$4l2$1@build.eclipse.org...
> Finnaly got it !
>
> I opened bug 285734 with a testcase to reproduce.
> See https://bugs.eclipse.org/bugs/show_bug.cgi?id=285734
>
> Mariot Chauvin a écrit :
>> Hi Boris,
>>
>> Thanks for taking time to try to reproduce.
>> Now I think the best is that I take time to write a repoduction unit test
>> case.
>>
>> Thanks,
>>
>> Mariot
>>
>>
>> Boris Gruschko a écrit :
>>> Hi Mariot,
>>>
>>> I tried to reconstruct your situation without success.
>>>
>>> Is there any concurrency involved in your use case ? E.g. does T1 run in
>>> another thread than T2 ?
>>>
>>> It would help if you could share some of your code.
>>>
>>> /Boris
>>>
>>>
>>> "Mariot Chauvin" <mariot.chauvin@obeo.fr> wrote in message
>>> news:h59hiv$r1j$1@build.eclipse.org...
>>>> Hi Boris,
>>>>
>>>> I recently encountered an "IllegalArgumentException" using EMF
>>>> Transaction.
>>>> This morning I did a quick search and found a thread quite old, but
>>>> with the same problem :
>>>>
>>>> http://dev.eclipse.org/newslists/news.eclipse.tools.emf/msg2 6773.html
>>>>
>>>> So this message was a description of a problem I am currently facing
>>>> and and a reply of the original message, sorry for the confusion.
>>>>
>>>> Since I debugged my program, and here I will try to explain what
>>>> happens.
>>>>
>>>> 1 - A first transaction(T1), not read only, is created and then
>>>> started.
>>>>
>>>> 2 - A new NotificationTree(N1) is instanciated with
>>>> parentNotificationCount value it set to 2 (parentNotificationCount =
>>>> parent.getNotifications().size();)
>>>>
>>>> 3 - A RollbackException is launched (intentionally), so
>>>> Transaction#rollback() on T1 is called.
>>>>
>>>> 4 - NotificationTree#setRolledBack() is called on N1,
>>>> parentNotificationCount value is set to 1
>>>>
>>>> 5 - ChangeDescription#apply() is called due to rollback. An EMF model
>>>> modification is done, which notify the adapters.
>>>>
>>>> 6 - One of our adapter launches a read only operation
>>>> (TransactionalEditingDomain#runExclusive(Runnable runnable), that means
>>>> creation of a second Transaction (T2), read only, with T1 as parent.
>>>>
>>>> 7 - T2 is activated, The transaction validator adds T2. During this
>>>> addition, a new NotificationTree(N2) is instanciated and added as
>>>> children of the parent of the (N1)(N1 and N2 are children of the same
>>>> parent) :
>>>>
>>>> "NotificationTree parent = findTree(transaction.getParent());
>>>> NotificationTree newTree = null;
>>>>
>>>> if (transaction.getParent() == null) {
>>>> // got the root transaction
>>>> tree = new NotificationTree(transaction, notificationMask);
>>>> newTree = tree;
>>>> } else if (parent != null) {
>>>> // if the transaction has a parent but there is no matching
>>>> // tree node, then this parent is silent, so there is no
>>>> // need to create any descendent nodes
>>>> newTree = parent.addChild(transaction, notificationMask);
>>>> }"
>>>>
>>>>
>>>> During N2 instantion, N2 parentNotificationCount value is set to 0, as
>>>> T1 has no longer notifications :
>>>>
>>>> "InternalTransaction parent = (InternalTransaction)
>>>> transaction.getParent();
>>>>
>>>> if (parent == null) {
>>>> parentNotificationCount = 0;
>>>> } else {
>>>> parentNotificationCount = parent.getNotifications().size();
>>>> }"
>>>> So here we have a first child with parentNotificationCount value set to
>>>> 0, and a second with a parentNotificationCount value set to 1.
>>>>
>>>> 8 - IllegalArgumentException is launched during close of T1. This is
>>>> due to NotificationTree instances having different
>>>> parentNotificationCount. (see previous messages of the thread).
>>>>
>>>>
>>>> Did I miss something, or misuse EMF transaction ?
>>>>
>>>> Thanks,
>>>>
>>>> Regards,
>>>>
>>>> Mariot
>>>>
>>>> Boris Gruschko a écrit :
>>>>> Hi Mariot,
>>>>>
>>>>> is this message a description of a current problem ? I have the
>>>>> feeling that this is a reply to an ancient message.
>>>>>
>>>>> Thanks for the clarification,
>>>>> Boris
>>>>>
>>>>> "Mariot Chauvin" <mariot.chauvin@obeo.fr> wrote in message
>>>>> news:h594cg$1sl$1@build.eclipse.org...
>>>>>> Hi,
>>>>>>
>>>>>> I have a case where I reproduce systematically with emf.transaction
>>>>>> 1.1.2 (so bug #200965 is fixed). Unfortunately I can't share the code
>>>>>> nor isolate easily a basic test case to reproduce.
>>>>>> In my case, debugging shows that there are 7 children, and only the
>>>>>> first one has a parentNotificationCount set to 1 (the following have
>>>>>> all 0).
>>>>>> I guess I should look to parentNotificationCount assignation, which
>>>>>> seems related to nested transactions :
>>>>>>
>>>>>> "if (parent == null) {
>>>>>> parentNotificationCount = 0;
>>>>>> } else {
>>>>>> parentNotificationCount = parent.getNotifications().size();
>>>>>> }"
>>>>>>
>>>>>> Any hints that may help me ?
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> Best regards,
>>>>>>
>>>>>> Mariot
>>>>>>
>>>>>>
>>>>>
>>>
Previous Topic:handle references
Next Topic:EMF References using Generics, Proxy are created
Goto Forum:
  


Current Time: Fri Mar 29 06:06:05 GMT 2024

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

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

Back to the top