-
Notifications
You must be signed in to change notification settings - Fork 104
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
pytest-xdist issues when libtmux > v0.16.1 #468
Comments
@cidrblock Thank you! If you could provide more of the traceback, I can give my full attention to it this weekend
Thank you! |
I'm trying to create a repro, will be in touch. thanks, Brad |
Sounds good! |
@cidrblock This doesn't necessarily need a full reproduction (that may be prohibitively difficult) If there's a more fuller traceback / etc. I can look at that as well. |
@cidrblock If you try v0.21.0 (which includes #475), is anything different? |
I need to get back to this.... Will try next week. I few other things popped up that needed attention. talk soon |
@cidrblock Sounds good. This is a priority since we definitely want libtmux to be xdist compatible |
Hi, I think I am facing the same issue. To reproduce the problem:
import libtmux
tmux_server = libtmux.Server()
session = tmux_server.new_session(session_name="repro-bug", kill_session=True)
window = session.windows[0]
window.rename_window("BOOM") The traceback
Done some digging
Some debugging with comments ipdb> bt
bug-repro-libtmux.py(6)<module>()
4 session = tmux_server.new_session(session_name="repro-bug", kill_session=True)
5 window = session.windows[0]
----> 6 window.rename_window("BOOM")
.../libtmux/window.py(480)rename_window()
479
--> 480 self.refresh()
481
.../libtmux/window.py(84)refresh()
83 assert isinstance(self.window_id, str)
---> 84 return super().\_refresh(
85 obj_key="window_id",
.../libtmux/neo.py(175)\_refresh()
174 assert isinstance(obj_id, str)
--> 175 obj = fetch_obj(
176 obj_key=obj_key, obj_id=obj_id, list_cmd=list_cmd, server=self.server
> .../libtmux/neo.py(243)fetch_obj()
242 breakpoint()
--> 243 if obj is None:
244 raise ObjectDoesNotExist(
#
# We can see that only the window for the current session is returned
# and not the one we are looking for so ObjectDoesNotExist will raise
#
ipdb> obj_id
'@17'
ipdb> obj_key
'window_id'
ipdb> pp [(x["window_name"], x["window_id"]) for x in obj_formatters_filtered]
[('python3.11', '@16')]
#
# Re-run fetch_obj but we will modify list_extra_args from None to ["-a"]
#
ipdb> jump 234
> .../libtmux/neo.py(234)fetch_obj()
233 ) -> OutputRaw:
--> 234 obj_formatters_filtered = fetch_objs(
235 server=server, list_cmd=list_cmd, list_extra_args=list_extra_args
#
# HACK make libtmux run tmux list-windows -a (list all windows of all sessions)
#
ipdb> list_extra_args = ["-a"]
ipdb> pp [(x["window_name"], x["window_id"]) for x in obj_formatters_filtered]
[('python3.11', '@16')]
ipdb> until 238
> .../libtmux/neo.py(238)fetch_obj()
237
--> 238 obj = None
239 for \_obj in obj_formatters_filtered:
# You can see now that the window from the new session is returned
ipdb> pp [(x["window_name"], x["window_id"]) for x in obj_formatters_filtered]
[('python3.11', '@16'), ('BOOM', '@17')]
ipdb> obj_id
'@17'
ipdb> obj_key
'window_id'
#
# and the script exits gracefully
#
ipdb> c hope this gives some pointers and thx for the lib :) |
A workaround that seems to work for me is to use import libtmux
import os
tmux_server = libtmux.Server()
session = tmux_server.new_session(session_name="repro-bug", kill_session=True)
window = session.windows[0]
window.cmd("rename-window", "BOOM") |
@cidrblock Pinning this, in re: ansible/ansible-navigator#1380 Thank you as well for the additional info @sgherdao |
@tony Any chance we could get a fix on this bug. Being forced to use an ancient version of libtmux is more like a playing with a grenade. I tried latest release and i still not working, so we are stuck with 0.16.1 for now. Usually I would have tried to make a fix it myself but sadly my tmux knowledge is not up for that. |
@ssbarnea Yes, happy to escalate this. |
@cidrblock @ssbarnea @sgherdao The above issue will be resolved by #523. TLDR: It was caused by refreshing not passing |
Resolves #468. # Changes ## Breaking changes - `Session.new_window()` + `Window.split_window()`: No longer `attach` by default. Pass `attach=True` for the old behavior. - `Pane.resize_pane` renamed to `Pane.resize()` ## `Window.resize_window()`: Added If `Pane.resize_pane()` didn't work before, try resizing the window. ## `Pane.resize()`: Arguments added ## `Server.panes`: Fix listing of panes Would list only panes in attached session, rather than all in a server. ## `Window.refresh()` and `Pane.refresh()`: Refresh more underlying state ## `Obj._refresh`: Allow passing args e.g. `-a` (all) to `list-panes` and `list-windows`
@cidrblock @ssbarnea @sgherdao:
|
We use libtmux for testing ansible-navigator and have the version pinned at 0.16.1.
I've installed the latest version v0.19.1 and if the tests are run with pytest-xdist and the number of CPUs > 1 the following errors are generated:
I'm still digging into it, but wanted to get an issue logged early.
What more information can I provide? How can I help?
Thanks, brad
(TY for libtmux BTW, I'm not sure what we would do without it)
The text was updated successfully, but these errors were encountered: