spyder-ide / spyder

Official repository for Spyder - The Scientific Python Development Environment
https://www.spyder-ide.org
MIT License
8.29k stars 1.61k forks source link

Spyder stalls for 2 minutes on startup when starting a remote Xorg session #10221

Closed markdayel closed 4 years ago

markdayel commented 5 years ago

Issue Report Checklist

Problem Description

When Starting Spyder 3.3.6 on Python 3.7.3 via SSH from cygwin, startup pauses for 120 seconds, then completes successfully. This pause doesn't happen when starting spyder via ssh under Python 2.7, nor under Python 3.7.3 with local x-server.

What steps reproduce the problem?

  1. ssh -X from cygwin to linux machine
  2. start spyder with from command line under python 3.7

What is the expected output? What do you see instead?

Expect startup to complete within a few seconds (as happens using Python 2.7 to start spyder), but instead it pauses for 2 minutes during startup.

Paste Traceback/Error Below (if applicable)

With SPYDER_DEBUG set to 3:

$ spyder
Start of MainWindow constructor
End of MainWindow constructor
*** Start of MainWindow setup ***
  ..core actions
  ..toolbars
  ..tools
  ..sift?
  ..plugin: internal console

Pauses for 2 minutes here, then continues...

    ..internal console: initializing
  ..plugin: working directory

Versions

Dependencies

IPython >=4.0     :  7.6.1 (OK)
cython >=0.21     :  0.29.12 (OK)
jedi >=0.9.0      :  0.13.3 (OK)
matplotlib >=2.0.0:  3.1.0 (OK)
nbconvert >=4.0   :  5.5.0 (OK)
numpy >=1.7       :  1.16.4 (OK)
pandas >=0.13.1   :  0.24.2 (OK)
psutil >=0.3      :  5.6.3 (OK)
pycodestyle >=2.3 :  2.5.0 (OK)
pyflakes >=0.6.0  :  2.1.1 (OK)
pygments >=2.0    :  2.4.2 (OK)
pylint >=0.25     :  2.3.1 (OK)
qtconsole >=4.2.0 :  4.5.1 (OK)
rope >=0.9.4      :  0.14.0 (OK)
sphinx >=0.6.6    :  2.1.2 (OK)
sympy >=0.7.3     :  1.4 (OK)
ccordoba12 commented 5 years ago

When Starting Spyder 3.3.6 on Python 3.7.3 via SSH from cygwin

Sorry, we don't support cygwin nor use it, so we can't offer any help about this. Besides, no one else has reported an error like this before.

markdayel commented 5 years ago

Found the issue---it's in the spyder.widgets.github.backend widget. Commenting it out from reporterror.py fixes the startup delay. The 'import keyring' line seems to be the culprit, which blocks if called from inside an SSH session (and takes 2 minutes to timeout). Issue has nothing to do with cygwin---starting spyder via 'ssh -X localhost' on the linux machine is enough to replicate.

ccordoba12 commented 5 years ago

Ok, thanks for finding the issue. How do you think we could fix this?

markdayel commented 5 years ago

Looks like maybe the 'import keyring' is stalling waiting for a response from dbus, which is failing when connecting over SSH. I don't immediately see a way of detecting the failure without waiting 2 minutes, so maybe a quick workaround would be to detect that spyder is being launched from an ssh session ("SSH_CONNECTION" in os.environ) and if so, print a warning to the user and disable the import of spyder.widgets.github.backend widget in reporterror.py

ccordoba12 commented 5 years ago

a quick workaround would be to detect that spyder is being launched from an ssh session ("SSH_CONNECTION" in os.environ)

That's nice, I didn't know about that env var, thanks! I think we're going to deactivate using keyring in that situation.

We're using keyring to allow users saving their GH credentials safely to not enter them every time they want to report a bug. But you just proved us that it can't be used all the time.

ybagdasa commented 3 years ago

I have the same problem except I'm just mounting a remote server and editing the source files there. My delay occurs between these lines in the debug output:

2021-03-04 11:40:12,049 [DEBUG] [chardet.universaldetector] -> no data received!
2021-03-04 11:40:12,049 [DEBUG] [chardet.universaldetector] -> no probers hit minimum threshold
2021-03-04 11:43:30,462 [DEBUG] [watchdog.observers.inotify_buffer] -> in-event <InotifyEvent: src_path=b'/data/amd-data/cera-rpd/cera-rpd-train/.git/index.lock', wd=10, mask=IN_MODIFY, cookie=0, name=index.lock>

Do these provide any clue as to why the 3 minute delay?