[CDO] CDOSession unsynchronized with server [message #1780155] |
Thu, 18 January 2018 09:15 |
Arthur Qicapous 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 #1780301 is a reply to message #1780244] |
Fri, 19 January 2018 17:10 |
Arthur Qicapous 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 |
|
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 .
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03410 seconds