-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Spyder crashes after Monitor Scale change #14273
Comments
Hi @Caseyb87. Thanks for reporting this! @dalthviz can you please try to reproduce this on Windows? |
@Caseyb87 could you run Spyder from cmd in you remote machine and check if any traceback appears in the console? And thanks for the info :) Also, if I manage to get a way to test this I will let you know @juanis2112 (currently I don't have access to a remote windows machine to check with a remote desktop connection). @andfoy you have access to remote windows machines to check this? |
No - nothing appears in cmd (I ran through Anaconda prompt). If there are any other debugging steps I can take or log files that might contain anything useful do let me know. |
@Caseyb87 maybe running Any new info is greatly appreciated :) |
Looks like something got recorded. This was triggered after clicking "dismiss" on the prompt (the previous line was just an autosave). Spyder then crash/closed. 2020-11-24 16:27:12,753 [DEBUG] [urllib3.connectionpool] -> http://127.0.0.1:46624 "GET /clientapi/status?filename=removed for privacy HTTP/1.1" 200 121 Hopefully that's helpful! |
Thanks @Caseyb87 ! |
I have this problem too - it is real. Thanks for trying to resolve. |
Confirmed still present in 4.2.0 (unsurprisingly) - also enabling the "Enable auto high res DPI" setting does not prevent the crash. |
HI! @ccordoba12 why removing it from milestone ? It will be resolved in 4.2.2 ? |
I guess because they don't plan to fix it in the upcoming release - which is a shame as this is a major bug, but probably only for quite a limited set of users. I think preventing the crash shouldn't be too hard, just check that self.screen is not None I guess. Or just wrap this whole block in a try and catch. Fixing why self.screen is NoneType may be harder but may not be necessary. |
Hi @arnaud-nt2i sorry to hear that :/ and yes as @Caseyb87 said, basically we will not be working on this for the next release. However if someone else wants to work on it (for example if you guys @Caseyb87 or @arnaud-nt2i want to try to fix the issue) we could review the work and add it to the next release! (if finished before the next release of course). So, let us know if you guys want to try to implement the fix! We will more than happy to guide/help you and review the work :D |
@Caseyb87, I thought this was harder to solve, but you're right, we could catch the error and pass. So we'll try to solve it for 4.2.2 @dalthviz, do you have a way to connect remotely to another Windows machine to test this? |
Nop that's one of the main reasons why I was unable to reproduce this and find the root cause of the issue (I was unable to reproduce this by using just a local Spyder instance) |
Ok, I think we can ask @CAM-Gerlach to give us a hand with that. @CAM-Gerlach, are you able to connect to a Windows machine using Remote Desktop? |
I can RDP into machines with Spyder installed, but the remote machines are configured by the admin to log out the connected account if I terminate the RDP connection. Therefore, I was not able to reproduce the specific problem, since it seems to require reconnecting to the same logged in session after terminating the connection previously. You'll need someone with access to a Windows machine over RDP that does not have the setting configured to log the user out automatically when disconnecting RDP so they can re-connect to the same session, or else that has control/admin on a RDP-acessable machine where they can set this setting. Alternatively, the user could try to find a way to reproduce the issue without re-connecting to the same active session (e.g. while still connected over RDP, like forcing a monitor scale change locally), but this may simply not be possible due to the nature of the problem. This is a pretty niche case; I'm sorry I don't have a better solution. |
I think that is what I did by putting
in the beginning of the method. Unfortunately, the crash/close when clicking the menu then occurs - do you think those two are unrelated? |
Um that's strange, and are you able to capture any kind of traceback in the console/terminal/cmd after Spyder crashes/closes when running with My guess is that somehow GUI objects are getting destroyed when disconnecting and reconnecting through RDP but not totally sure (maybe such destruction is related with the messages about |
You'll notice that the |
What happens if you wrap the section spyder/spyder/app/mainwindow.py Lines 1535 to 1541 in a3a35fd
I was just wondering if the If the error is caught there then Spyder should (maybe?) just act like the screen never changed? |
I was thinking something similar too @Caseyb87. However, searching a little bit I found that maybe this could be Qt related:
Also regarding the messages about the LSP seems like that is also failing (the LSP crashes and is not being able to restart) |
Sorry it was unclear—you need to pass that option through to Spyder, not the bootstrap.py script, via python bootstrap.py -- --debug-info verbose
@dalthviz 's Qt knowledge vastly exceeds mine, but FWIW, the evidence available is consistent with some problem caused by the user session's screen being disconnected for some time, and then another reconnected; as this is a pretty niche case on Windows (compared to *nix, with X11 forwarding and lots of screenless boxes) its possible that simply no one has reported it in this case. I'm not sure what exactly we can do about it at the Spyder level, as it seems its something at the Qt level given we're not seeing an exception traceback in Spyder and its instead just crashing to desktop, and the core GUI of the menu bar etc. is handled by Qt. I only see calls to the |
@bilderbuchi, instead of doing that, please replace if not sys.platform == 'darwin': by if False: That would avoid executing that |
I also found this bug while searching for possible solutions. So this problem looks like a bug in Qt, and in that case we won't be able to do anything about it. Basically, it seems the screen is removed by Windows after you logout from Remote desktop and recreated again after you start a new session. |
I'll be interested to see if avoiding that This should, of course, be reported to Qt. Probably best by one of the Spyder developers?
But only if you start a new session in from a new local machine. That's the weird part. It all works fine if you start the new session from the same local machine (or at least same display). |
with this change and the early return in place, I get neither the screen change dialog, nor can I trigger any crashes anymore.
The repro procedure I have been using is using a laptop (1080p display) with an external monitor attached (1680x1050) to connect to a remote PC (1080p display). By switching on either only the laptop screen or only the external monitor when connecting to the remote PC, I can force a change in resolution and trigger the bug. |
Fantastic! So Spyder can handle this (by just ignoring it), even if it is a bug with Qt.
Ah OK - that makes sense, it's the display (not the device) that is important. |
I've managed to get a dev version of Spyder set up myself too. I can confirm @bilderbuchi 's observations in that skipping that block entirely results in no crashing. Additionally, if lines 1556-1558 are commented out: spyder/spyder/app/mainwindow.py Lines 1556 to 1558 in 72e9952
then Spyder does not crash but will throw the following error: if self.current_dpi != screen.logicalDotsPerInch():
AttributeError: 'MainWindow' object has no attribute 'current_dpi' I tried to add some condition code to prevent those lines being executed but couldn't get it to work. Guess I'm checking the wrong thing. For example: if not sys.platform == 'darwin':
window = self.window().windowHandle()
if window.screen() is not None:
window.screenChanged.connect(self.handle_new_screen)
self.screen = self.window().windowHandle().screen()
self.current_dpi = self.screen.logicalDotsPerInch()
self.screen.logicalDotsPerInchChanged.connect(
self.show_dpi_change_message) did not work. Spyder still showed the dpi change messages and then crashed after clicking dismiss. |
Additionally, I think I figured out why the dpi change message is being shown twice. spyder/spyder/app/mainwindow.py Line 1554 in 72e9952
calls handle_new_screen which can then call spyder/spyder/app/mainwindow.py Lines 1575 to 1576 in 72e9952
but spyder/spyder/app/mainwindow.py Lines 1557 to 1558 in 72e9952
also calls Perhaps this behaviour is OK in normal situations but I guess due to this particular issue, we end up with the |
Thanks @bilderbuchi and @Caseyb87 for the info regarding this! Seems like now we have more clues about how to prevent the crash to happen :) Maybe the condition to check needs to be regarding if we are currently running in a RDP session (although I'm unsure how we can achieve such validation :/) |
I can reproduce something similar with Version 4.1.5 AND 4.2.0 on Windows 10 20H2Build 19042.746. Sypder is installed through Anaconda. I opened Spyder on my secondary screen, through thunderbolt dock. Unplugged the laptop. Spyder opens on a non-existing screen. Some dialogs are shown (the update to 4.2.0) dialogue pops up on the only aptop screen, but as soon as the main window opens (animation zooming out of task bar sometimes shows the window moving to the screen on the left), spyder crashes and disappears from the task bar. No processes to be seen in task explorer. So, no remote desktop, only physical screens, but similar issues.
It crashes right after the urrlib3 call (left out lots of lines!)
No segfault-reporter popping up! |
Just downgraded to 3.3.6. Windows stayed open, i could move it to the laptop screen. Closed Sypder 3.3.6 gracefully. updated to 4.1.5. segfault reporter pops up. then crash, spyder goes away Tried --reset and --defaults, but 4.1.5 still always crashes some seconds after showing up on the main screen. |
Hey everyone, @dalthviz managed to fix this problem in PR #14696. We'd really appreciate your help to extra test it and be sure that we correctly fixed this nasty crash (@dalthviz already tested it). For that you need to install Also, we don't have a way to test this in thunderbolt dock. So we'd appreciate your help with that too. |
I tried to test this out but couldn't get it working - sorry (new to Git). I got Spyder running on the 4.x branch but it didn't have this fix in it. I tried to follow the contributing guide but it wasn't clear to me how to get Spyder to run with the new fix in. If anyone can help me figure that out, I'm happy to test. |
You need to check out the PR branch before running Spyder; there are aliases to do that or a manual method involving several steps, but the easiest way is to just download and use hub (e.g. with |
Thank you. I tried as you suggested but got a "Not Found" error - must have done something wrong there. In the end, I just copied/pasted new mainwindow.py file into the installation directory and it worked! I was able to connect/disconnect/reconnect from the remote machine with different local machines and Spyder did not crash. Got the warning (only once), clicked dismiss and was able to continue as expected. |
Thanks for checking, I did not get the opportunity to quickly test this time around! And also thanks for the fix, of course! 👍 |
Hello, Thanks |
Hi @sienamo , what version of Spyder are you using? Please update to the latest release, Spyder 5.3.2 and check if that helps. Also, just in case, the related changes to the |
I am using spyder 5.2.2. I copied and pasted the new mainwindow.py into my installation route. The problem was fixed! |
@sienamo glad to hear the is working for you however, since you are using Spyder 5.2.2, probably copy-pasting the Not sure about your setup (OS, way you installed Spyder, etc), but if you are using the anaconda distribution, try to create a new environment using only the conda-forge channel. For that, you can run from an Anaconda prompt (Windows) or terminal (MacOS or Linux) the following:
Then please check if with that new Spyder installation you still got the monitor scale change issue. If the issue persist please open a new issue. |
I run your command in anaconda prompt. my spyder version is still 5.2.2. |
Then either something weird is going on with conda's dependency resolution, or the Spyder you are checking the version on is not the one you installed. To ensure you get the latest version, replace the first line with conda create -n spyder-cf -c conda-forge spyder=5.3.2 |
Description
Spyder crashes after closing ("dismiss") the Monitor Scale change detected pop-up on remote machine.
What steps will reproduce the problem?
Specific scenario:
Note: monitor scale change pop up seems to work normally when I move Spyder (in the RD window) between monitors on the local machine.
Pure speculation: could it be that there are three monitor scale changes going on (local machine #1 > remote machine (when RD connection from LM1 is closed) > local machine #2) which is what's causing the issue?
Versions
Dependencies
The text was updated successfully, but these errors were encountered: