[CDO] Problem with reconnecting CDO Session [message #1785300] |
Thu, 12 April 2018 08:48 |
thomas huster Messages: 21 Registered: June 2012 |
Junior Member |
|
|
I am using CDO 4.6 from the oxygen.3 repository to create a server with 2 repositories which are accessable via 1 acceptor.
generalAcceptor = (IAcceptor) IPluginContainer.INSTANCE.getElement("org.eclipse.net4j.acceptors", "tcp",
"0.0.0.0:" + corePort);
On the client side I open a session for each repository using the following code.
private boolean connect() {
logger.info("Connecting to " + getRepositoryName());
// Repository
ReconnectingCDOSessionConfiguration config = CDONet4jUtil.createReconnectingSessionConfiguration(serverAddress,
configuration.repositoryName, IPluginContainer.INSTANCE);
// Create credentials
PasswordCredentialsProvider credentialsProvider = new PasswordCredentialsProvider(username, password);
config.setCredentialsProvider(credentialsProvider);
config.setActivateOnOpen(true);
config.setPassiveUpdateEnabled(true);
config.setPassiveUpdateMode(PassiveUpdateMode.ADDITIONS);
config.setHeartBeatEnabled(true);
try {
setSession(config.openNet4jSession());
getSession().addListener(new IListener() {
@Override
public void notifyEvent(final IEvent event) {
if (event instanceof CDOSessionRecoveryEvent) {
final CDOSessionRecoveryEvent recoveryEvent = (CDOSessionRecoveryEvent) event;
switch (recoveryEvent.getType()) {
case STARTED:
sendEvent(EVENT_DISCONNECT);
break;
case FINISHED:
sendEvent(EVENT_CONNECT);
break;
}
}
}
});
} catch (Exception e) {
LoggerFactory.getLogger(getClass()).error("Error opening session to " + configuration.repositoryName, e);
return false;
}
sendEvent(EVENT_CONNECT);
return true;
}
When I terminate the server, on the client side I get the following exceptions.
!MESSAGE org.eclipse.net4j.util.concurrent.TimeoutRuntimeException: Channel registration timeout after 10000 milliseconds
!STACK 0
org.eclipse.net4j.channel.ChannelException: org.eclipse.net4j.util.concurrent.TimeoutRuntimeException: Channel registration timeout after 10000 milliseconds
at org.eclipse.spi.net4j.ChannelMultiplexer.openChannel(ChannelMultiplexer.java:176)
at org.eclipse.spi.net4j.ChannelMultiplexer.openChannel(ChannelMultiplexer.java:1)
at org.eclipse.net4j.signal.SignalProtocol.open(SignalProtocol.java:177)
at org.eclipse.net4j.signal.heartbeat.HeartBeatProtocol.<init>(HeartBeatProtocol.java:70)
at org.eclipse.net4j.signal.heartbeat.HeartBeatProtocol.<init>(HeartBeatProtocol.java:75)
at org.eclipse.net4j.signal.heartbeat.HeartBeatProtocol.<init>(HeartBeatProtocol.java:83)
at org.eclipse.emf.cdo.internal.net4j.RecoveringCDOSessionImpl.createTCPConnector(RecoveringCDOSessionImpl.java:183)
at org.eclipse.emf.cdo.internal.net4j.ReconnectingCDOSessionImpl.updateConnectorAndRepositoryName(ReconnectingCDOSessionImpl.java:88)
at org.eclipse.emf.cdo.internal.net4j.RecoveringCDOSessionImpl.recoverSession(RecoveringCDOSessionImpl.java:206)
at org.eclipse.emf.cdo.internal.net4j.RecoveringCDOSessionImpl.recover(RecoveringCDOSessionImpl.java:124)
at org.eclipse.emf.cdo.internal.net4j.RecoveringCDOSessionImpl.sessionProtocolDeactivated(RecoveringCDOSessionImpl.java:115)
at org.eclipse.emf.internal.cdo.session.CDOSessionImpl$1.onDeactivated(CDOSessionImpl.java:186)
at org.eclipse.net4j.util.lifecycle.LifecycleEventAdapter.notifyLifecycleEvent(LifecycleEventAdapter.java:56)
at org.eclipse.net4j.util.lifecycle.LifecycleEventAdapter.notifyEvent(LifecycleEventAdapter.java:34)
at org.eclipse.net4j.util.event.Notifier.fireEventSafe(Notifier.java:167)
at org.eclipse.net4j.util.event.Notifier.fireEvent(Notifier.java:113)
at org.eclipse.net4j.util.lifecycle.Lifecycle.internalDeactivate(Lifecycle.java:136)
at org.eclipse.net4j.util.lifecycle.Lifecycle.deactivate(Lifecycle.java:167)
at org.eclipse.emf.internal.cdo.session.DelegatingSessionProtocol$1.onDeactivated(DelegatingSessionProtocol.java:93)
at org.eclipse.net4j.util.lifecycle.LifecycleEventAdapter.notifyLifecycleEvent(LifecycleEventAdapter.java:56)
at org.eclipse.net4j.util.lifecycle.LifecycleEventAdapter.notifyEvent(LifecycleEventAdapter.java:34)
at org.eclipse.net4j.util.event.Notifier.fireEventSafe(Notifier.java:167)
at org.eclipse.net4j.util.event.Notifier.fireEvent(Notifier.java:113)
at org.eclipse.net4j.util.lifecycle.Lifecycle.internalDeactivate(Lifecycle.java:136)
at org.eclipse.net4j.util.lifecycle.Lifecycle.deactivate(Lifecycle.java:167)
at org.eclipse.net4j.util.lifecycle.LifecycleUtil.deactivate(LifecycleUtil.java:234)
at org.eclipse.net4j.util.lifecycle.LifecycleUtil.deactivate(LifecycleUtil.java:224)
at org.eclipse.net4j.util.lifecycle.LifecycleUtil.deactivate(LifecycleUtil.java:250)
at org.eclipse.spi.net4j.Protocol.handleChannelDeactivation(Protocol.java:170)
at org.eclipse.net4j.signal.SignalProtocol.handleChannelDeactivation(SignalProtocol.java:337)
at org.eclipse.spi.net4j.Protocol$1.onDeactivated(Protocol.java:51)
at org.eclipse.net4j.util.lifecycle.LifecycleEventAdapter.notifyLifecycleEvent(LifecycleEventAdapter.java:56)
at org.eclipse.net4j.util.lifecycle.LifecycleEventAdapter.notifyEvent(LifecycleEventAdapter.java:34)
at org.eclipse.net4j.util.event.Notifier.fireEventSafe(Notifier.java:167)
at org.eclipse.net4j.util.event.Notifier.fireEvent(Notifier.java:113)
at org.eclipse.net4j.util.lifecycle.Lifecycle.internalDeactivate(Lifecycle.java:136)
at org.eclipse.net4j.util.lifecycle.Lifecycle.deactivate(Lifecycle.java:167)
at org.eclipse.net4j.util.lifecycle.LifecycleUtil.deactivate(LifecycleUtil.java:234)
at org.eclipse.net4j.util.lifecycle.LifecycleUtil.deactivate(LifecycleUtil.java:224)
at org.eclipse.spi.net4j.ChannelMultiplexer.doDeactivate(ChannelMultiplexer.java:316)
at org.eclipse.spi.net4j.Connector.doDeactivate(Connector.java:391)
at org.eclipse.net4j.internal.tcp.TCPConnector.doDeactivate(TCPConnector.java:417)
at org.eclipse.net4j.util.lifecycle.Lifecycle.internalDeactivate(Lifecycle.java:129)
at org.eclipse.net4j.util.lifecycle.ShareableLifecycle.internalDeactivate(ShareableLifecycle.java:52)
at org.eclipse.net4j.util.lifecycle.Lifecycle.deactivate(Lifecycle.java:167)
at org.eclipse.net4j.internal.tcp.TCPConnector$1.run(TCPConnector.java:430)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.eclipse.net4j.util.concurrent.TimeoutRuntimeException: Channel registration timeout after 10000 milliseconds
at org.eclipse.spi.net4j.ChannelMultiplexer.openChannel(ChannelMultiplexer.java:167)
... 48 more
Caused by: org.eclipse.net4j.util.concurrent.TimeoutRuntimeException: Registration timeout after 10.000 milliseconds
at org.eclipse.net4j.internal.tcp.ControlChannel.registerChannel(ControlChannel.java:102)
at org.eclipse.net4j.internal.tcp.TCPConnector.registerChannelWithPeer(TCPConnector.java:362)
at org.eclipse.spi.net4j.ChannelMultiplexer.openChannel(ChannelMultiplexer.java:161)
... 48 more
This seems to terminate the reconnecting Threads. So no reconnect is happening after I restart the Server.
I can work around this Problem by increasing the timeout.
config.setSignalTimeout(Long.MAX_VALUE);
But if I terminate the server again after the first reconnect, no more recovery events are created, and no recovery is happening.
Another strange thing debugging the problem is, that if I set breakpoints on CDOSessionImpl#hookSessionProtocol and CDOSessionImpl#unhookSessionProtocol methods, the TimeoutRuntimeException is not thrown, and the first reconnect works as expected. The second reconnect is never happening. I could not reproduce the problem within a unit test.
Is there some config Option I am missing, or has anyone else seen the same problem? Or is the setup using one acceptor for multiple repositories a bad idea?
Regards,
Thomas
[Updated on: Thu, 12 April 2018 08:57] Report message to a moderator
|
|
|
Re: [CDO] Problem with reconnecting CDO Session [message #1785323 is a reply to message #1785300] |
Thu, 12 April 2018 13:07 |
|
Hi Thomas,
From your small code snippet I can not see the cause of the problem. I've double-checked that our ReconnectingSessionTest is green. You can execute it yourself and compare if something is set up differently. The test case is included in the suite "CDO AllTests (MEM branching TCP)".
It's okay to use one acceptor for multiple repositories, but during the problem analysis I would start as simple as possible until the reconnecting session functions properly.
If you want me to reproduce your problem you should provide some code that I can directly execute.
Cheers
/Eike
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04151 seconds