Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closing last wezterm window should not terminate the mux server (by design?) #631

Closed
xunnanxu opened this issue Apr 3, 2021 · 5 comments
Labels
bug Something isn't working waiting-on-op Waiting for more information from the original poster

Comments

@xunnanxu
Copy link
Contributor

xunnanxu commented Apr 3, 2021

Describe the bug

Closing the last window somehow would terminate the mux server today.

Caused by:
    Connection refused (os error 111)

 2021-04-03T20:56:44.087Z INFO  wezterm_gui::termwindow > OpenGL initialized! Mesa Intel(R) UHD Graphics 620 (KBL GT2) OpenGL ES 3.2 Mesa 20.2.2 is_context_loss_possible=false wezterm version: 
 2021-04-03T20:56:44.095Z ERROR wezterm_gui             > connecting to <hostname>: Connection refused (os error 111); terminating
 2021-04-03T20:56:44.095Z ERROR mux::connui             > while running ConnectionUI loop: recv_timeout: channel is empty and disconnected

Environment (please complete the following information):

  • OS: Fedora 32 client side + CentOS 8 server
  • Version: client: master build, server: wezterm 20210314-114017-04b7cedd-124-gb057e1f6

To Reproduce

Enable multiplexing:

server:

WEZTERM_LOG=trace wezterm-mux-server --daemonize 2> /tmp/server.txt

client:

wezterm connect <name>

After connection is established, ctrl d to terminate the session and close the window.

Reconnect and connections is refused. Check server side the mux server is not running any more.

Configuration

don't think this is actually relevant here

Expected behavior

The server process should not quit and reconnection should be successful.

Additional context

tail -f /tmp/server.txt
2021-04-03T20:54:01.001Z TRACE polling::epoll > new: epoll_fd=4, event_fd=5, timer_fd=Some(6)
2021-04-03T20:54:01.001Z TRACE async_io::driver > main_loop: waiting on I/O
2021-04-03T20:54:01.001Z TRACE async_io::reactor > process_timers: 0 ready wakers
2021-04-03T20:54:01.001Z TRACE polling > Poller::wait(_, None)
2021-04-03T20:54:01.001Z TRACE polling::epoll > wait: epoll_fd=4, timeout=None
2021-04-03T20:54:01.001Z TRACE polling::epoll > modify: epoll_fd=4, fd=6, ev=Event { key: 18446744073709551615, readable: true, writable: false }
2021-04-03T20:54:01.006Z DEBUG config > Reloaded configuration! generation=1
2021-04-03T20:54:01.007Z TRACE mio::poll > registering with poller
2021-04-03T20:54:01.007Z TRACE mio::poll > registering with poller
2021-04-03T20:54:01.007Z TRACE mio::poll > registering with poller

@xunnanxu xunnanxu added the bug Something isn't working label Apr 3, 2021
wez added a commit that referenced this issue Apr 3, 2021
This has been a commonly requested feature in the past week,
and it's a reasonable one.  The mux server inherited the
close-when-done behavior from when it used to be an alternate
front-end in the same executable as the gui, but it doesn't
need to be that way any more.

We also need to accomodate that case in the client: if the
newly attached domain doesn't result in any panes being imported,
we need to spawn a new command there in order to keep the client
alive.  The pre-existing check for whether the mux was empty had
false positives because the local mux may still reference the
pane from the connection UI, which would finish closing out shortly
after we had decided not to spawn anything, and then the client
would close.

refs: #631
refs: #507
@wez
Copy link
Owner

wez commented Apr 3, 2021

Yeah, that's a fair request. This behavior was by design, but that design was from when the mux server was a separate front-end within the same binary as the GUI.

@wez wez added the fixed-in-nightly This is (or is assumed to be) fixed in the nightly builds. label Apr 3, 2021
@xunnanxu
Copy link
Contributor Author

xunnanxu commented Apr 4, 2021

Thanks for the quick fix @wez ! There's one remaining minor issue:
If I close the window directly, things are fine.
If I ctrl D to terminate the session first and then close the window, I get an error saying client is destroyed.

After some digging it seems like the actual error is receiving from an empty and closed channel. Seems like we need to add a check to not send close when a session is already terminated when window is closed.

@wez wez removed the fixed-in-nightly This is (or is assumed to be) fixed in the nightly builds. label Apr 16, 2021
wez added a commit that referenced this issue Apr 16, 2021
propagate the likely client destroyed error instead

refs: #631
@wez
Copy link
Owner

wez commented Apr 16, 2021

I couldn't directly reproduce this, but I did just push a commit that might help. Let me know how it works out!

@wez wez added the waiting-on-op Waiting for more information from the original poster label Apr 24, 2021
@no-response
Copy link

no-response bot commented May 8, 2021

This issue has been automatically closed because there has been no response to the request for more information from the original author. With only the information that is currently in the issue, there isn't enough information to take further action. Please reach out if you have or find the answers we need so that we can investigate further.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2023

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working waiting-on-op Waiting for more information from the original poster
Projects
None yet
Development

No branches or pull requests

2 participants