saros icon indicating copy to clipboard operation
saros copied to clipboard

The state of the Saros view is not reset correctly when the the host is unexpectedly disconnected from the XMPP server

Open tobous opened this issue 5 years ago • 7 comments

The state of the Saros view is not reset correctly for the host when they are unexpectedly disconnected from the XMPP server (e.g. by somebody else connecting to the Server with the same account).

This might be restricted to whether the buttons are enabled/disabled, but it also lead to issue with tearing down the contact/session view tree. Such issues are harder to reproduce, but I will add the stacktrace once I do.

Update: This seems to be an issue in the core.

tobous avatar Jan 23 '20 16:01 tobous

@srossbach Could you provide a reference to the piece of code that needs to be changed to fix this?

tobous avatar Jan 29 '20 09:01 tobous

https://github.com/saros-project/saros/blob/master/core/src/saros/session/SarosSessionManager.java#L166

It also have to been tested if a "clean" shutdown is performed even if there is an error, i.e the logic should not thrown an excpetion but tear down everything, finally closing any broken network connection and disconnect from everything (EditorManager and other stuff).

srossbach avatar Jan 30 '20 02:01 srossbach

if (state == ConnectionState.DISCONNECTING || state == ConnectionState.ERROR)

srossbach avatar Jan 30 '20 02:01 srossbach

if (state == ConnectionState.DISCONNECTING || state == ConnectionState.ERROR)

Just adding this does kind of work, but it freezes the UI in the process for a couple of seconds. So there seem to be some more issues to resolve here.

Furthermore the MUC complains that it can't be torn down, but I am not sure whether this is an issue as a TODO in the code already suggests that it is not persistent.

stacktrace
WARN  16:58:38,229 [main] (MultiUserChat.java:194) could not leave or destroy room: [email protected]
java.lang.IllegalStateException: Not connected to server.
	at org.jivesoftware.smack.XMPPConnection.sendPacket(XMPPConnection.java:483)
	at org.jivesoftware.smackx.muc.MultiUserChat.destroy(MultiUserChat.java:716)
	at saros.communication.chat.muc.MultiUserChat.disconnect(MultiUserChat.java:191)
	at saros.communication.chat.muc.MultiUserChatService.destroyChat(MultiUserChatService.java:132)
	at saros.ui.widgets.chat.ChatRoomsComposite$4$3.run(ChatRoomsComposite.java:260)
	at saros.util.ThreadUtils$1.run(ThreadUtils.java:34)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:40)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:185)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4857)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4409)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1160)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1049)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:633)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:557)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:150)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:137)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:107)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:660)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:597)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1468)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1441)

I don't have any time right now, so I re-unassigned myself.

tobous avatar Jan 30 '20 16:01 tobous

@srossbach @stefaus Any of you interested in having a more detailed look at this at some point?

tobous avatar Jan 30 '20 16:01 tobous

Looking at the issue the Smack Packet Reader (0) thread will shutdown the session which is quite bad. You can fork another thread and I am pretty sure this will avoid the 5 sec freeze but I am more interested which code triggers this freeze.

srossbach avatar Aug 02 '20 22:08 srossbach

TRACE 00:15:57,414 [main] (EditorManager.java:416) .disconnect(L/A/src/B.java) invoked
DEBUG 00:16:02,421 [Smack Packet Reader (0)] (SharedProjectDecorator.java:75) clearing project decoration for all shared projects

srossbach avatar Aug 02 '20 22:08 srossbach