-
Notifications
You must be signed in to change notification settings - Fork 133
Python seg fault at startup while using scikit-learn #341
Comments
See also microsoft/vscode-python#2693. I can't seem to get macOS to show anything about an unexpected error, but I can see that the last thing in AnalysisLog.txt is the scraper inspecting _k_means_elkan, and that stubs we produce in the languageServer directory don't include the k-means stuff (which hints that it's not completing). I'm not sure that is a problem with anything we've written. It's the library that's segfaulting, and it's only under us in the process tree because the language server sometimes needs to call out to python to inspect things. The scraper could be doing something wrong, since that k-means stuff is compiled, but we'd probably need a better stack trace to know where it came from.
|
Python crash, not LS. LS is managed code and does not normally run any Python except when to inspect Python types not available in source otherwise. |
I can reproduce this and grab a stack trace with
As far as I can tell, we're not doing anything bad in how we're calling into the At the very least, you shouldn't have trouble using the editor with incomplete data. In terms of preventing some macOS error prompt, I'm not sure we can do much. The language server already recognizes that the scraper crashed (look for ExitCode 139 in AnalysisLog.txt), and macOS displaying something extra is something separate. |
OK, understood. But it is strange that when the language server restarts itself after this crash, it runs just fine the second time around and IntelliSense works for this package and KMeans object just fine. Not sure why the first time around a crash occurs. Edit: just read the linked vscode-python issue. As a note, I've tried with two separate Python installs and two different versions of scikit so I think that reduces the chances of it being a corrupt install. But still could be in scikit. |
Hmm, the language server itself shouldn't be crashing, and I didn't see that behavior on my machine. At worst, the python process it runs will crash, we see that there's an error code set, and move on. From your crash report, I think it's only saying that the parent process of the crashing process was the language server, not that the language server itself is crashing. (There should be a message in the Python output panel if the langauge server restarts, too.) |
Yes, you are correct. I just checked the output panel at trace level and the server never restarts. It is just the python process. I also confirmed that via the macOS Activity Monitor. There are a bunch of python processes showing up and disappearing but the language server is always there. |
Yep, that's normal (besides the crash). For things we can't inspect directly (e.g. Python libraries written in C, even many standard library modules) we have to spawn a Python process to generate something we can use (stubs). This is definitely the case for many scientific/numerical libraries which implement things in C for speed, or call out to system libraries like GMP. If the scraper crashes, then we won't have that type information and won't have accurate info in some cases, but it won't be fatal to the language server. |
Uh oh!
There was an error while loading. Please reload this page.
Environment data
Actual behavior
Mac OS throws an error "Python quit unexpectedly" upon startup of vscode and a project that is using sklearn. Posting this here because crash report says parent process is Microsoft Language Server.
Expected behavior
No error.
Steps to reproduce:
Make a file with the following:
Open it in a fresh run of vscode
Wait 30 secs... Python process crashes but vscode is still running and then everything works normally afterwards.
Logs
Output for
Python
in theOutput
panel (View
→Output
, change the drop-down the upper-right of theOutput
panel toPython
)Output from
Console
under theDeveloper Tools
panel (toggle Developer Tools on underHelp
)Mac OS Crash Report (incomplete):
The text was updated successfully, but these errors were encountered: