Workspaces: IllegalStateException: connection is closed #2745
jbauer opened 2 months ago

I tried the new workspaces feature using the container template and after a while deleted the workspace. So OneDev shows no workspace and Docker also has no running workspace container.

While the workspace was running I did use the button to create a new shell (second tmux session), did play a bit with tmux inside each session (one with codex running, the other just console), then closed both tabs in OneDev.

Now I noticed in the OneDev logs MANY exceptions. I don't know when exactly these exceptions happened as they stopped appearing in the logs after a while:

2026-04-27 15:29:16,687 ERROR [pool-3-thread-57] i.o.c.utils.command.StreamPumper Error writing to output stream
java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.IllegalStateException: The connection is closed.
	at io.onedev.server.ee.clustering.DefaultClusterService.waitFor(DefaultClusterService.java:397)
	at io.onedev.server.ee.clustering.DefaultClusterService.runOnAllServers(DefaultClusterService.java:381)
	at io.onedev.server.workspace.DefaultWorkspaceService$4$1.onShellOutput(DefaultWorkspaceService.java:789)
	at io.onedev.server.workspace.WorkspaceRuntime$1.onShellOutput(WorkspaceRuntime.java:24)
	at io.onedev.server.terminal.CommandlineShell$1$1.write(CommandlineShell.java:50)
	at io.onedev.commons.utils.command.StreamPumper.lambda$pump$0(StreamPumper.java:37)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at io.onedev.server.security.SecurityUtils.lambda$inheritSubject$1(SecurityUtils.java:648)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: java.util.concurrent.ExecutionException: java.lang.IllegalStateException: The connection is closed.
	at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
	at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
	at com.hazelcast.executor.impl.DistributedExecutorService$Processor.run(DistributedExecutorService.java:278)
	at com.hazelcast.internal.util.executor.CachedExecutorServiceDelegate$Worker.run(CachedExecutorServiceDelegate.java:217)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:840)
	at com.hazelcast.internal.util.executor.HazelcastManagedThread.executeRun(HazelcastManagedThread.java:76)
	at com.hazelcast.internal.util.executor.HazelcastManagedThread.run(HazelcastManagedThread.java:111)
Caused by: java.lang.IllegalStateException: The connection is closed.
	at io.onedev.server.web.websocket.WebSocketConnection.checkClosed(WebSocketConnection.java:106)
	at io.onedev.server.web.websocket.WebSocketConnection.sendMessage(WebSocketConnection.java:89)
	at io.onedev.server.workspace.DefaultWorkspaceService$HandleShellOutputTask.call(DefaultWorkspaceService.java:1142)
	at io.onedev.server.workspace.DefaultWorkspaceService$HandleShellOutputTask.call(DefaultWorkspaceService.java:1112)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at com.hazelcast.executor.impl.DistributedExecutorService$Processor.run(DistributedExecutorService.java:276)
	... 6 common frames omitted
  • Robin Shen commented 2 months ago

    This is normal, as terminal outputs can be sent indicating the shell is terminated while websocket is being closed. Nevertheless, will handle such exception gracefully not to worry users.

  • Robin Shen changed state to 'Closed' 2 months ago
    Previous Value Current Value
    Open
    Closed
1/1
Type
Bug
Priority
Normal
Assignee
Affected Versions
15.0.1
Labels
No labels
Issue Votes (0)
Watchers (3)
Reference
OD-2745
Please wait...
Connection lost or session expired, reload to recover
Page is in error, reload to recover