Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] Transactions, Resource sets and sessions
[CDO] Transactions, Resource sets and sessions [message #881557] Mon, 04 June 2012 16:33 Go to next message
Alain Picard is currently offline Alain Picard
Messages: 176
Registered: July 2009
Senior Member
Hi,

As I'm ramping up our app and CDO to stop single threading, I am facing
some issues right now. I know it's not the first set of questions in
this regard, but hopefully I get better at it.

Right we operate our client with a single session. Different part of the
code will request to open a view or transaction.

As I'm now launching some processes that need to update a status in the
repository, as independent Eclipse jobs, my multi-core laptop has a big
tendency to force all of them to request a transaction around the same time.

I had a simple session.openTransaction() and that would deadlock very
badly. Reading the docs I noticed that this is supposed to be for new
Resources, so I changed it to session.openTransaction(rs).

Now I am getting "Only one view per repository can be open for the same
resource set" on the client and a bunch of:
org.eclipse.emf.cdo.server.ContainmentCycleDetectedException: Parent
(OID185837) is already locked for containment changes on the server
side. I'm not sure if it is for the same transactions right now or if my
code then tries to do something else.

So, to point 1, what is the right way to obtain a transaction here. Do I
need to have multiple sessions? Do I need to use getView(String
repositoryUUID) on the viewset to see if a transaction already exist and
to synchronize somewhere? Or apply a very different pattern (queue
requests and process from the queue)?

On point2, what is the solution? Is it to fix point 1 or is it something
else altogether?

Thanks for your help
Alain
Re: [CDO] Transactions, Resource sets and sessions [message #882886 is a reply to message #881557] Thu, 07 June 2012 08:03 Go to previous messageGo to next message
Alain Picard is currently offline Alain Picard
Messages: 176
Registered: July 2009
Senior Member
Ideas anyone?

On 6/4/2012 4:33 PM, Alain Picard wrote:
> Hi,
>
> As I'm ramping up our app and CDO to stop single threading, I am facing
> some issues right now. I know it's not the first set of questions in
> this regard, but hopefully I get better at it.
>
> Right we operate our client with a single session. Different part of the
> code will request to open a view or transaction.
>
> As I'm now launching some processes that need to update a status in the
> repository, as independent Eclipse jobs, my multi-core laptop has a big
> tendency to force all of them to request a transaction around the same
> time.
>
> I had a simple session.openTransaction() and that would deadlock very
> badly. Reading the docs I noticed that this is supposed to be for new
> Resources, so I changed it to session.openTransaction(rs).
>
> Now I am getting "Only one view per repository can be open for the same
> resource set" on the client and a bunch of:
> org.eclipse.emf.cdo.server.ContainmentCycleDetectedException: Parent
> (OID185837) is already locked for containment changes on the server
> side. I'm not sure if it is for the same transactions right now or if my
> code then tries to do something else.
>
> So, to point 1, what is the right way to obtain a transaction here. Do I
> need to have multiple sessions? Do I need to use getView(String
> repositoryUUID) on the viewset to see if a transaction already exist and
> to synchronize somewhere? Or apply a very different pattern (queue
> requests and process from the queue)?
>
> On point2, what is the solution? Is it to fix point 1 or is it something
> else altogether?
>
> Thanks for your help
> Alain
Re: [CDO] Transactions, Resource sets and sessions [message #882957 is a reply to message #881557] Thu, 07 June 2012 10:20 Go to previous message
Eike Stepper is currently offline Eike Stepper
Messages: 5499
Registered: July 2009
Senior Member
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Strange, my Thunderbird shows that I did send this reply two days
ago. Here it's again:<br>
<br>
Hi Alain,<br>
<br>
You may find this article interesting: <a
class="moz-txt-link-freetext"
href="http://thegordian.blogspot.de/2011/07/concurrent-access-to-models.html">http://thegordian.blogspot.de/2011/07/concurrent-access-to-models.html</a><br>
<br>
More comments below...<br>
<br>
<br>
Am 04.06.2012 22:33, schrieb Alain Picard:
<blockquote cite="mid:jqj61r$m53$1@xxxxxxxxe.org" type="cite">Hi,
<br>
<br>
As I'm ramping up our app and CDO to stop single threading, I am
facing some issues right now. I know it's not the first set of
questions in this regard, but hopefully I get better at it. <br>
<br>
Right we operate our client with a single session. Different part
of the code will request to open a view or transaction. <br>
<br>
As I'm now launching some processes that need to update a status
in the repository, as independent Eclipse jobs, my multi-core
laptop has a big tendency to force all of them to request a
transaction around the same time. <br>
<br>
I had a simple session.openTransaction() and that would deadlock
very badly. </blockquote>
That's bad. If you think that's not caused by misusage (I have no
clue how you could misuse that :P ) you should submit a bugzilla. I
fear this type of problem is very hard to reproduce. Maybe you can
try to write a test case? Please have a look at our other test cases
to see how easy it is.<br>
<br>
<blockquote cite="mid:jqj61r$m53$1@xxxxxxxxe.org" type="cite">Reading

the docs I noticed that this is supposed to be for new Resources,
so I changed it to session.openTransaction(rs). <br>
<br>
Now I am getting "Only one view per repository can be open for the
same resource set" on the client </blockquote>
After reading the article I refered to above it should be clear that
you need two distinct resource sets for two separate transactions to
the same repository.<br>
<br>
You can open multiple transactions on the same resource set but then
they must belong to different repositories (if objects from
different transactions/repositories are to be modified in such a
resource set the transactions should be wrapped in a
CDOXATransaction).<br>
<br>
<blockquote cite="mid:jqj61r$m53$1@xxxxxxxxe.org" type="cite">and
a bunch of:
org.eclipse.emf.cdo.server.ContainmentCycleDetectedException:
Parent (OID185837) is already locked for containment changes on
the server side. I'm not sure if it is for the same transactions
right now or if my code then tries to do something else. <br>
</blockquote>
This is something that *can* happen on the server in situations with
massive parallel commits if the commits invlove tree moves:<br>
<img src="cid:part2.00050601.03090804@xxxxxxxx" alt=""><br>
So this situation is basically a conflict situation, although there
is no object that is directly modified by both transactions. It has
to be handled in the client code just like other conflicts.<br>
<br>
<blockquote cite="mid:jqj61r$m53$1@xxxxxxxxe.org" type="cite"> <br>
So, to point 1, what is the right way to obtain a transaction
here. </blockquote>
I guess just the simple session.openTransaction() that yu tried
first.<br>
<br>
<blockquote cite="mid:jqj61r$m53$1@xxxxxxxxe.org" type="cite">Do
I need to have multiple sessions? </blockquote>
No.<br>
<br>
<blockquote cite="mid:jqj61r$m53$1@xxxxxxxxe.org" type="cite">Do
I need to use getView(String repositoryUUID) on the viewset to see
if a transaction already exist and to synchronize somewhere? </blockquote>
No.<br>
<br>
<blockquote cite="mid:jqj61r$m53$1@xxxxxxxxe.org" type="cite">Or
apply a very different pattern (queue requests and process from
the queue)? <br>
</blockquote>
Removing concurrency is obviously an option to deal with concurrency
problems :P<br>
<br>
<br>
<blockquote cite="mid:jqj61r$m53$1@xxxxxxxxe.org" type="cite">On
point2, what is the solution? Is it to fix point 1 or is it
something else altogether? <br>
</blockquote>
The latter. See above ;-)<br>
<br>
Cheers<br>
/Eike<br>
<br>
----<br>
<a class="moz-txt-link-freetext" href="http://www.esc-net.de">http://www.esc-net.de</a><br>
<a class="moz-txt-link-freetext"
href="http://thegordian.blogspot.com">http://thegordian.blogspot.com</a><br>
<a class="moz-txt-link-freetext"
href="http://twitter.com/eikestepper">http://twitter.com/eikestepper</a><br>
<br>
<br>
</body>
</html>
Previous Topic:[CDO] Latest 4.0 maintenance branch materializes wrong plugin dependency versions?
Next Topic:[CDO] Procedure for building the CDO server deployment packages
Goto Forum:
  


Current Time: Wed Aug 20 10:41:20 EDT 2014

Powered by FUDForum. Page generated in 0.02408 seconds