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

webbrowser.get() can hang and should be timeouted #1259

Open
dg-nvm opened this issue Jun 27, 2024 · 6 comments
Open

webbrowser.get() can hang and should be timeouted #1259

dg-nvm opened this issue Jun 27, 2024 · 6 comments

Comments

@dg-nvm
Copy link

dg-nvm commented Jun 27, 2024

https://github.com/Keeper-Security/Commander/blob/fe9c026e600f6d60cc636e30ae1546436df18d03/keepercommander/auth/console_ui.py#L264C18-L264C28

webbrowser.get() under some circumstances (my case is WSL2 and wslu from Flox) can hang indefinetelly on xdg-settings:

xdg-settings get default-web-browser will just not return anything

This will render UI blank until interrupted with "ctrl+c", then normal keeper UI proceeds

There are multiple issues (e.g microsoft/WSL#8892) touching the subject on the topic but I believe timeouting it will be easiest as there is an Exception catcher there anyway.

@aaunario-keeper
Copy link
Contributor

Thanks for shedding light on this issue. Upgrading to Commander v16.11.3 or higher should fix it.

@dg-nvm
Copy link
Author

dg-nvm commented Jul 4, 2024

I don't think this will fix it as 6d15bdb as you will never go out from line 264

@aaunario-keeper
Copy link
Contributor

From my own testing, webbrowser.get() does not hang when xdg-open is not configured properly (i.e., is using the default WSL xdg settings), but does hang when wb.open_new_tab(url) is called. This change is intended to prevent the latter from happening if a mis-configuration is detected.
If you have stack-trace evidence contrary to that, I'd be more than happy to see it.

@dg-nvm
Copy link
Author

dg-nvm commented Jul 5, 2024

My patch:

image

When it breaks:

image

keeper.mp4

@aaunario-keeper
Copy link
Contributor

I'm not entirely sure what that script is supposed to show.
Yes, calling webbrowser.get() does result in a call to xdg-settings get default-web-browser, but when no suitable browser is found, it returns nothing but does not hang (which is what I'm assuming your timeout replacement for the xdg-settings call is meant to simulate).
Are you seeing something different? What do you get if you call xdg-settings get default-web-browser under the scenario described above?

@dg-nvm
Copy link
Author

dg-nvm commented Jul 8, 2024

@aaunario-keeper exactly, there are problems with dbus on WSL and dbus-send that xdg-settings bash script uses to detect if perhaps browser is set in Gnome Settings manager is hanging -

https://github.com/alyptik/dotfiles/blob/2c3d5a5c9886e998042ea4eee21097241a65a890/xdg-settings#L465

for testing purpose I replaced whole script with sleep but it's hanging on the line I pasted here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants