Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] CDOSession unsynchronized with server
[CDO] CDOSession unsynchronized with server [message #1780155] Thu, 18 January 2018 09:15 Go to next message
Arthur Qicapous is currently offline Arthur QicapousFriend
Messages: 6
Registered: October 2017
Junior Member
Hi,

I'm having hard time using my CDOSession. Sometimes, my session seems to be "unsynchronized": I don't receive any commit from the server and my EContentAdapter arn't called. In this state, I need call refresh() on my session to "re-synchronize" it with the server.
I don't understand when it happens.

edit: it seems to happen when I commit 2 times in a short amount of time (ex: model editing with save and security update using securityManager.modify).

Do you have any clue what is going on ?

Thank you.

Regards,
Arthur.

[Updated on: Thu, 18 January 2018 10:26]

Report message to a moderator

Re: [CDO] CDOSession unsynchronized with server [message #1780171 is a reply to message #1780155] Thu, 18 January 2018 11:07 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6394
Registered: July 2009
Senior Member
What version of CDO are you using?
Re: [CDO] CDOSession unsynchronized with server [message #1780196 is a reply to message #1780171] Thu, 18 January 2018 14:21 Go to previous messageGo to next message
Arthur Qicapous is currently offline Arthur QicapousFriend
Messages: 6
Registered: October 2017
Junior Member
Thank you for your help !
I'm using CDO 4.4.1

Edit: my client receive some CDOViewLocksChangedEvent but no CDOViewInvalidationEvent. When I refresh my session, all those events are kind of unstack. It's like these events are waiting something in some kind of list.

[Updated on: Thu, 18 January 2018 16:04]

Report message to a moderator

Re: [CDO] CDOSession unsynchronized with server [message #1780244 is a reply to message #1780196] Fri, 19 January 2018 06:09 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6394
Registered: July 2009
Senior Member
I know that we've fixed a subtle bug with session synchronization after that old version. Please update to the latest release: http://download.eclipse.org/modeling/emf/cdo/drops/R20170614-0227
Re: [CDO] CDOSession unsynchronized with server [message #1780301 is a reply to message #1780244] Fri, 19 January 2018 17:10 Go to previous messageGo to next message
Arthur Qicapous is currently offline Arthur QicapousFriend
Messages: 6
Registered: October 2017
Junior Member
Eike,

Thanks for your recommandation. However, after updating to CDO 4.6, my problem isn't solved.
When the client receive 2 commits in a short amount of time, the second one breaks the session. I have to refresh the session to fix the situation.

Example:

mySecurityManager.modify(new ISecurityManager.RealmOperation() {


            @Override
            public void execute(Realm realm) {
                        //some realm modifications
            }
}, true);

MyCDOObject obj = MyPackage.eINSTANCE.createMyCDOObject();
myCDOTransaction.getResource("/myResource.xmi").getContents().add(obj);
myCDOTransaction.commit();


This code causes 2 commits. My client don't get any CDOViewInvalidationEvent neither CDOTransactionFinishedEvent: we don't have security modification events and the second commit is stuck somewhere. That leads to a freeze on the clients that should receive the notifications.

edit: it seems to be the security update using the security manager which break our app. We tested to perform multiple commits on our model in a small amount of time and we received events but when we update our security realm, we have this kind of unsync behavior.

Do you have any idea on what's going on ?

Thanks a lot.

Regards,
Arthur

[Updated on: Mon, 22 January 2018 10:57]

Report message to a moderator

Re: [CDO] CDOSession unsynchronized with server [message #1780947 is a reply to message #1780301] Tue, 30 January 2018 10:03 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6394
Registered: July 2009
Senior Member
I can not reproduce your problem with the following test case:

  public void testModifyRealm() throws Exception
  {
    final IPasswordCredentials credentials = new PasswordCredentials("user", "password");
    final String protectedResource = getResourcePath("/protected");
    final CDOID[] realmID = { null };

    getSecurityManager().modify(new ISecurityManager.RealmOperation()
    {
      public void execute(Realm realm)
      {
        realmID[0] = realm.cdoID();

        User user = realm.addUser(credentials);
        user.getGroups().add(realm.getGroup("Administrators"));

        Role role = realm.addRole(protectedResource + " Writer");
        role.getPermissions().add(SF.createFilterPermission(Access.WRITE, //
            SF.createResourceFilter(protectedResource, PatternStyle.EXACT, true).setModelObjects(true)));

        user.getRoles().add(role);
      }
    });

    CDOSession session = openSession(credentials);
    CDOTransaction transaction = session.openTransaction();
    CDOResource resource = transaction.createResource(protectedResource);
    transaction.commit();

    // Load entire realm into transaction, so that the next realm operation creates a CDOViewInvalidationEvent.
    Realm realm = (Realm)transaction.getObject(realmID[0]);
    List<EObject> realmObjects = new ArrayList<EObject>();
    for (Iterator<EObject> it = EcoreUtil.getAllContents(realm, false); it.hasNext();)
    {
      realmObjects.add(it.next());
    }

    transaction.addListener(new IListener()
    {
      public void notifyEvent(IEvent event)
      {
        System.out.println(event);
      }
    });

    getSecurityManager().modify(new ISecurityManager.RealmOperation()
    {
      public void execute(Realm realm)
      {
        Role role = realm.addRole("Second Role");

        User user = realm.getUser(credentials.getUserID());
        user.getRoles().add(role);
      }
    }, true);

    resource.getContents().add(getModel1Factory().createCompany());
    transaction.commit();

    resource.getContents().add(getModel1Factory().createCompany());
    transaction.commit();

    resource.getContents().add(getModel1Factory().createCompany());
    transaction.commit();

    resource.getContents().add(getModel1Factory().createCompany());
    transaction.commit();

    resource.getContents().add(getModel1Factory().createCompany());
    transaction.commit();
  }


The console output is as follows:

*******************************************************
Bugzilla_417483_Test.testModifyRealm [MEM-branching, JVM, Native]
*******************************************************
[INFO] Security realm created in /security
CDOViewInvalidationEvent[source=Transaction 1 [MAIN], timeStamp=1517305600219, revisionDeltas={User@OID32=null, Directory@OID4[PROXY]=null}, detachedObjects=[]]]
CDOViewAdaptersNotifiedEvent[source=Transaction 1 [MAIN], timeStamp=1517305600219]
CDOTransactionStartedEvent[source=Transaction 1 [MAIN]]
CDOTransactionFinishedEvent[source=Transaction 1 [MAIN], cause=COMMITTED, idMappings=1]
CDOTransactionStartedEvent[source=Transaction 1 [MAIN]]
CDOTransactionFinishedEvent[source=Transaction 1 [MAIN], cause=COMMITTED, idMappings=1]
CDOTransactionStartedEvent[source=Transaction 1 [MAIN]]
CDOTransactionFinishedEvent[source=Transaction 1 [MAIN], cause=COMMITTED, idMappings=1]
CDOTransactionStartedEvent[source=Transaction 1 [MAIN]]
CDOTransactionFinishedEvent[source=Transaction 1 [MAIN], cause=COMMITTED, idMappings=1]
CDOTransactionStartedEvent[source=Transaction 1 [MAIN]]
CDOTransactionFinishedEvent[source=Transaction 1 [MAIN], cause=COMMITTED, idMappings=1]
LifecycleEvent[source=Transaction 1 [MAIN], kind=ABOUT_TO_DEACTIVATE]
LifecycleEvent[source=CDOTransactionImpl, kind=DEACTIVATED]


Please note that a CDOViewInvalidationEvent is only sent to views that have at least one of the changed or deleted objects loaded. Your session should receive a CDOSessionInvalidationEvent, though.

It's possible that you're doing something special that causes a problem. If you want me to reproduce your problem you'd need to submit a bugzilla and attach an executable test case. Please have a look at our test suites and, for example, try to add a test case to org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_417483_Test .
Re: [CDO] CDOSession unsynchronized with server [message #1781707 is a reply to message #1780155] Mon, 12 February 2018 13:02 Go to previous messageGo to next message
Arthur Qicapous is currently offline Arthur QicapousFriend
Messages: 6
Registered: October 2017
Junior Member
Hi Eike,

Thank you very much for your help, problem solved !

It seems we didn't received CDOViewInvalidationEvent on the security realm because we didn't load those objects into our Store (if I understand well).
Your comment ("Load entire realm into transaction,...") helped us so much.

Best regards,
Arthur
Re: [CDO] CDOSession unsynchronized with server [message #1781727 is a reply to message #1781707] Mon, 12 February 2018 15:48 Go to previous message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6394
Registered: July 2009
Senior Member
I'm glad to hear that it works now ;-)
Previous Topic:XCore and Editor for Several Packages
Next Topic:[Teneo] Resolved Hibernate Proxys
Goto Forum:
  


Current Time: Thu Oct 18 13:14:30 GMT 2018

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

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

Back to the top