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

EMFILE: too many open files #936

Closed
albireox opened this issue Feb 11, 2021 · 12 comments
Closed

EMFILE: too many open files #936

albireox opened this issue Feb 11, 2021 · 12 comments
Labels
bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version

Comments

@albireox
Copy link

Environment data

  • Language Server version: 2021.2.1 (or insiders)
  • OS and version: macOS 11.2.1
  • Python version (& distribution if applicable, e.g. Anaconda): pyenv 3.9.1

Expected behaviour

No errors.

Actual behaviour

I'm seeing this error when I open a Python file

[Error - 10:33:31 PM] An internal error occurred while parsing file "/Users/albireo/Documents/Code/sdss5/flicamera/flicamera/lib.py": Error: EMFILE: too many open files, scandir '/Users/albireo/Documents/Code/sdss5/flicamera'
    at Object.readdirSync (fs.js:959:3)
    at Object.e.readdirSync (electron/js2c/asar_bundle.js:5:10231)
    at h.readdirEntriesSync (/Users/albireo/.vscode-insiders/extensions/ms-python.vscode-pylance-2021.2.2-pre.1/dist/pyright.bundle.js:1:609711)
    at B._getFilesInDirectory (/Users/albireo/.vscode-insiders/extensions/ms-python.vscode-pylance-2021.2.2-pre.1/dist/pyright.bundle.js:1:160020)
    at B.resolveAbsoluteImport (/Users/albireo/.vscode-insiders/extensions/ms-python.vscode-pylance-2021.2.2-pre.1/dist/pyright.bundle.js:1:152915)
    at B._resolveBestAbsoluteImport (/Users/albireo/.vscode-insiders/extensions/ms-python.vscode-pylance-2021.2.2-pre.1/dist/pyright.bundle.js:1:155203)
    at B.resolveImport (/Users/albireo/.vscode-insiders/extensions/ms-python.vscode-pylance-2021.2.2-pre.1/dist/pyright.bundle.js:1:147689)
    at t.SourceFile._resolveImports (/Users/albireo/.vscode-insiders/extensions/ms-python.vscode-pylance-2021.2.2-pre.1/dist/pyright.bundle.js:1:254912)
    at /Users/albireo/.vscode-insiders/extensions/ms-python.vscode-pylance-2021.2.2-pre.1/dist/pyright.bundle.js:1:247540
    at i.timeOperation (/Users/albireo/.vscode-insiders/extensions/ms-python.vscode-pylance-2021.2.2-pre.1/dist/pyright.bundle.js:1:631349)

and neither completion nor type linting works correctly. Doesn't seem to happen with 2021.2.0

@cmmadnat
Copy link

Same issue here

@albireox
Copy link
Author

VSCode Insiders updated and that seems to have fixed it. I'm seeing many

[Error - 11:02:55 PM] Error returned from file system watcher.

in the Python Language Server output when I first open VSCode but after that it seems to be working.

@albireox
Copy link
Author

Now, after a while, analysis seems stuck and I'm getting

/Applications/Visual Studio Code - Insiders.app/Contents/Frameworks/Code - Insiders Helper (Renderer).app/Contents/MacOS/Code - Insiders Helper (Renderer)[2775]: ../../third_party/electron_node/src/spawn_sync.cc:460:Maybe<bool> node::SyncProcessRunner::TryInitializeAndRunLoop(Local<v8::Value>): Assertion `(uv_loop_init(uv_loop_)) == (0)' failed.
 1: 0x105a5aa75 node::Buffer::New(v8::Isolate*, char*, unsigned long, void (*)(char*, void*), void*) [/Applications/Visual Studio Code - Insiders.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 2: 0x105a5a88b node::Buffer::New(v8::Isolate*, char*, unsigned long, void (*)(char*, void*), void*) [/Applications/Visual Studio Code - Insiders.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 3: 0x105b0a362 node::MultiIsolatePlatform::CancelPendingDelayedTasks(v8::Isolate*) [/Applications/Visual Studio Code - Insiders.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 4: 0x105b09ffa node::MultiIsolatePlatform::CancelPendingDelayedTasks(v8::Isolate*) [/Applications/Visual Studio Code - Insiders.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 5: 0x105b09f7c node::MultiIsolatePlatform::CancelPendingDelayedTasks(v8::Isolate*) [/Applications/Visual Studio Code - Insiders.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 6: 0x103d4649d v8::internal::ClassScope::ResolvePrivateNamesPartially() [/Applications/Visual Studio Code - Insiders.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 7: 0x103d46192 v8::internal::ClassScope::ResolvePrivateNamesPartially() [/Applications/Visual Studio Code - Insiders.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 8: 0x103d45791 v8::internal::ClassScope::ResolvePrivateNamesPartially() [/Applications/Visual Studio Code - Insiders.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
 9: 0x104324fd8 v8::internal::SetupIsolateDelegate::SetupHeap(v8::internal::Heap*) [/Applications/Visual Studio Code - Insiders.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
10: 0x1042b7058 v8::internal::SetupIsolateDelegate::SetupHeap(v8::internal::Heap*) [/Applications/Visual Studio Code - Insiders.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
[Error - 11:14:27 PM] Connection to server got closed. Server will not be restarted.
[Error - 11:14:27 PM] Request textDocument/semanticTokens/full/delta failed.
Error: Connection got disposed.
	at Object.dispose (/Users/albireo/.vscode-insiders/extensions/ms-python.python-2021.1.502429796/out/client/extension.js:52:98319)
	at Object.dispose (/Users/albireo/.vscode-insiders/extensions/ms-python.python-2021.1.502429796/out/client/extension.js:9:132399)
	at E.handleConnectionClosed (/Users/albireo/.vscode-insiders/extensions/ms-python.python-2021.1.502429796/out/client/extension.js:9:132611)
	at E.handleConnectionClosed (/Users/albireo/.vscode-insiders/extensions/ms-python.python-2021.1.502429796/out/client/extension.js:52:47738)
	at t (/Users/albireo/.vscode-insiders/extensions/ms-python.python-2021.1.502429796/out/client/extension.js:9:130704)
	at invoke (/Users/albireo/.vscode-insiders/extensions/ms-python.python-2021.1.502429796/out/client/extension.js:9:266828)
	at o.fire (/Users/albireo/.vscode-insiders/extensions/ms-python.python-2021.1.502429796/out/client/extension.js:9:267589)
	at X (/Users/albireo/.vscode-insiders/extensions/ms-python.python-2021.1.502429796/out/client/extension.js:52:87681)
	at invoke (/Users/albireo/.vscode-insiders/extensions/ms-python.python-2021.1.502429796/out/client/extension.js:9:266828)
	at o.fire (/Users/albireo/.vscode-insiders/extensions/ms-python.python-2021.1.502429796/out/client/extension.js:9:267589)
	at d.fireClose (/Users/albireo/.vscode-insiders/extensions/ms-python.python-2021.1.502429796/out/client/extension.js:52:77750)
	at ChildProcess.<anonymous> (/Users/albireo/.vscode-insiders/extensions/ms-python.python-2021.1.502429796/out/client/extension.js:9:262558)
	at ChildProcess.emit (events.js:327:22)
	at maybeClose (internal/child_process.js:1021:16)
	at Socket.<anonymous> (internal/child_process.js:443:11)
	at Socket.emit (events.js:315:20)
	at Pipe.<anonymous> (net.js:674:12)
[Error - 11:14:27 PM] Request completionItem/resolve failed.
Error: Connection got disposed.
	at Object.dispose (/Users/albireo/.vscode-insiders/extensions/ms-python.python-2021.1.502429796/out/client/extension.js:52:98319)
	at Object.dispose (/Users/albireo/.vscode-insiders/extensions/ms-python.python-2021.1.502429796/out/client/extension.js:9:132399)
	at E.handleConnectionClosed (/Users/albireo/.vscode-insiders/extensions/ms-python.python-2021.1.502429796/out/client/extension.js:9:132611)
	at E.handleConnectionClosed (/Users/albireo/.vscode-insiders/extensions/ms-python.python-2021.1.502429796/out/client/extension.js:52:47738)
	at t (/Users/albireo/.vscode-insiders/extensions/ms-python.python-2021.1.502429796/out/client/extension.js:9:130704)
	at invoke (/Users/albireo/.vscode-insiders/extensions/ms-python.python-2021.1.502429796/out/client/extension.js:9:266828)
	at o.fire (/Users/albireo/.vscode-insiders/extensions/ms-python.python-2021.1.502429796/out/client/extension.js:9:267589)
	at X (/Users/albireo/.vscode-insiders/extensions/ms-python.python-2021.1.502429796/out/client/extension.js:52:87681)
	at invoke (/Users/albireo/.vscode-insiders/extensions/ms-python.python-2021.1.502429796/out/client/extension.js:9:266828)
	at o.fire (/Users/albireo/.vscode-insiders/extensions/ms-python.python-2021.1.502429796/out/client/extension.js:9:267589)
	at d.fireClose (/Users/albireo/.vscode-insiders/extensions/ms-python.python-2021.1.502429796/out/client/extension.js:52:77750)
	at ChildProcess.<anonymous> (/Users/albireo/.vscode-insiders/extensions/ms-python.python-2021.1.502429796/out/client/extension.js:9:262558)
	at ChildProcess.emit (events.js:327:22)
	at maybeClose (internal/child_process.js:1021:16)
	at Socket.<anonymous> (internal/child_process.js:443:11)
	at Socket.emit (events.js:315:20)
	at Pipe.<anonymous> (net.js:674:12)

Sorry for the piecemeal report.

@aviramha
Copy link

aviramha commented Feb 11, 2021

Experiencing the same (macOS, Python 3.8)

@taketakeseijin
Copy link

taketakeseijin commented Feb 11, 2021

Same (macOS 10.15.7, anaconda python3.8) when import heartpy (via pip)

@Ramblestsad
Copy link

Same here. Said too many open files when I opened any .py files including a django project or simple .py file.

@jakebailey
Copy link
Member

Sorry about this; I'll look into this in the morning. For now, you can downgrade Pylance in the extension menu.

If anyone has trace logs, those would be helpful as well.

@raphaelts3
Copy link

@jakebailey here are some of mine

[Info  - 10:43:36 AM] Server root directory: /Users/raphaelts3/.vscode/extensions/ms-python.vscode-pylance-2021.2.1/dist
[Info  - 10:43:36 AM] No configuration file found.
[Info  - 10:43:36 AM] Setting pythonPath for service "arturas": "/Users/raphaelts3/.pyenv/shims/python"
Search paths found for configured python interpreter:
  /Users/raphaelts3/.pyenv/versions/3.8.6/lib/python3.8
  /Users/raphaelts3/.pyenv/versions/3.8.6/lib/python3.8/lib-dynload
  /Users/raphaelts3/.pyenv/versions/3.8.6/lib/python3.8/site-packages
  /Users/raphaelts3/projects/streamlink/src
[Error - 10:43:36 AM] stubPath /Users/raphaelts3/Downloads/arturas/typings is not a valid directory.
[Info  - 10:43:37 AM] Assuming Python version 3.8
[Info  - 10:43:37 AM] Assuming Python platform Darwin
[Info  - 10:43:37 AM] Watcher could not use native fsevents library. File system watcher disabled.
[Info  - 10:43:37 AM] Watcher could not use native fsevents library. File system watcher disabled.
[Info  - 10:43:37 AM] Watcher could not use native fsevents library. File system watcher disabled.
[Info  - 10:43:37 AM] Searching for source files
[Info  - 10:43:37 AM] Found 2 source files
[Info  - 10:43:37 AM] Background analysis(1) root directory: /Users/raphaelts3/.vscode/extensions/ms-python.vscode-pylance-2021.2.1/dist
[Info  - 10:43:37 AM] Background analysis(1) started
Background analysis message: setConfigOptions
Background analysis message: setTrackedFiles
Background analysis message: markAllFilesDirty
Background analysis message: setFileOpened
Background analysis message: getSemanticTokens
[BG(1)] parsing: /Users/raphaelts3/Downloads/arturas/insert_tokens_to_db.py (33ms)
[BG(1)] parsing: /Users/raphaelts3/.vscode/extensions/ms-python.vscode-pylance-2021.2.1/dist/typeshed-fallback/stdlib/builtins.pyi [fs read 3ms] (91ms)
[BG(1)] binding: /Users/raphaelts3/.vscode/extensions/ms-python.vscode-pylance-2021.2.1/dist/typeshed-fallback/stdlib/builtins.pyi (40ms)
[BG(1)] binding: /Users/raphaelts3/Downloads/arturas/insert_tokens_to_db.py (2ms)
[BG(1)] parsing: /Users/raphaelts3/.pyenv/versions/3.8.6/lib/python3.8/site-packages/psycopg2/__init__.py [fs read 0ms] (10ms)
[BG(1)] binding: /Users/raphaelts3/.pyenv/versions/3.8.6/lib/python3.8/site-packages/psycopg2/__init__.py (2ms)
[BG(1)] parsing: /Users/raphaelts3/.vscode/extensions/ms-python.vscode-pylance-2021.2.1/dist/typeshed-fallback/stubs/requests/requests/__init__.pyi [fs read 1ms] (17ms)
[BG(1)] binding: /Users/raphaelts3/.vscode/extensions/ms-python.vscode-pylance-2021.2.1/dist/typeshed-fallback/stubs/requests/requests/__init__.pyi (0ms)
[BG(1)] parsing: /Users/raphaelts3/.vscode/extensions/ms-python.vscode-pylance-2021.2.1/dist/typeshed-fallback/stdlib/_typeshed/__init__.pyi [fs read 3ms] (14ms)
[BG(1)] binding: /Users/raphaelts3/.vscode/extensions/ms-python.vscode-pylance-2021.2.1/dist/typeshed-fallback/stdlib/_typeshed/__init__.pyi (1ms)
[BG(1)] parsing: /Users/raphaelts3/.vscode/extensions/ms-python.vscode-pylance-2021.2.1/dist/typeshed-fallback/stdlib/typing.pyi [fs read 2ms] (27ms)
[BG(1)] binding: /Users/raphaelts3/.vscode/extensions/ms-python.vscode-pylance-2021.2.1/dist/typeshed-fallback/stdlib/typing.pyi (11ms)
[BG(1)] parsing: /Users/raphaelts3/.vscode/extensions/ms-python.vscode-pylance-2021.2.1/dist/typeshed-fallback/stubs/typing-extensions/typing_extensions.pyi [fs read 0ms] (4ms)
[BG(1)] binding: /Users/raphaelts3/.vscode/extensions/ms-python.vscode-pylance-2021.2.1/dist/typeshed-fallback/stubs/typing-extensions/typing_extensions.pyi (2ms)
[BG(1)] parsing: /Users/raphaelts3/.vscode/extensions/ms-python.vscode-pylance-2021.2.1/dist/typeshed-fallback/stubs/requests/requests/api.pyi [fs read 1ms] (3ms)
[BG(1)] binding: /Users/raphaelts3/.vscode/extensions/ms-python.vscode-pylance-2021.2.1/dist/typeshed-fallback/stubs/requests/requests/api.pyi (1ms)
[BG(1)] parsing: /Users/raphaelts3/.vscode/extensions/ms-python.vscode-pylance-2021.2.1/dist/typeshed-fallback/stdlib/abc.pyi [fs read 0ms] (0ms)
[BG(1)] binding: /Users/raphaelts3/.vscode/extensions/ms-python.vscode-pylance-2021.2.1/dist/typeshed-fallback/stdlib/abc.pyi (0ms)
[BG(1)] parsing: /Users/raphaelts3/.vscode/extensions/ms-python.vscode-pylance-2021.2.1/dist/typeshed-fallback/stubs/requests/requests/models.pyi [fs read 0ms] (5ms)
[BG(1)] binding: /Users/raphaelts3/.vscode/extensions/ms-python.vscode-pylance-2021.2.1/dist/typeshed-fallback/stubs/requests/requests/models.pyi (2ms)
[BG(1)] parsing: /Users/raphaelts3/.pyenv/versions/3.8.6/lib/python3.8/site-packages/psycopg2/extensions.py [fs read 0ms] (14ms)
[BG(1)] binding: /Users/raphaelts3/.pyenv/versions/3.8.6/lib/python3.8/site-packages/psycopg2/extensions.py (3ms)
[BG(1)] parsing: /Users/raphaelts3/.vscode/extensions/ms-python.vscode-pylance-2021.2.1/dist/typeshed-fallback/stdlib/re.pyi [fs read 0ms] (5ms)
[BG(1)] binding: /Users/raphaelts3/.vscode/extensions/ms-python.vscode-pylance-2021.2.1/dist/typeshed-fallback/stdlib/re.pyi (2ms)
[BG(1)] parsing: /Users/raphaelts3/.vscode/extensions/ms-python.vscode-pylance-2021.2.1/dist/typeshed-fallback/stdlib/enum.pyi [fs read 0ms] (5ms)
[BG(1)] binding: /Users/raphaelts3/.vscode/extensions/ms-python.vscode-pylance-2021.2.1/dist/typeshed-fallback/stdlib/enum.pyi (1ms)
Background analysis message: getSemanticTokens
Background analysis message: analyze
[BG(1)] analyzing: /Users/raphaelts3/Downloads/arturas/insert_tokens_to_db.py ...
[BG(1)]   checking: /Users/raphaelts3/Downloads/arturas/insert_tokens_to_db.py (8ms)
[BG(1)] analyzing: /Users/raphaelts3/Downloads/arturas/insert_tokens_to_db.py (8ms)
Background analysis message: resumeAnalysis
IntelliCode model /Users/raphaelts3/.vscode/extensions/visualstudioexptteam.vscodeintellicode-1.2.11/cache/E61945A9A512ED5E1A3EE3F1A2365B88F8FE_E4E9EADA96734F01970E616FAB2FAC19
[Error - 10:43:38 AM] Error returned from file system watcher.
[Error - 10:43:38 AM] Error returned from file system watcher.
[Error - 10:43:38 AM] Error returned from file system watcher.
[Error - 10:43:38 AM] Error returned from file system watcher.
[Error - 10:43:38 AM] Error returned from file system watcher.
[Error - 10:43:38 AM] Error returned from file system watcher.
[Error - 10:43:38 AM] Error returned from file system watcher.```

@cmmadnat
Copy link

I downgrade from the latest version to the previous version. Now it works again

@jakebailey jakebailey added bug Something isn't working needs investigation Could be an issue - needs investigation labels Feb 11, 2021
@github-actions github-actions bot removed the triage label Feb 11, 2021
@rarenatoe
Copy link

How can I install the previous version without installing this new one? I had to uninstall everything just to find out it was pylance.

@jakebailey
Copy link
Member

If you mean disabling auto-updates, there's "extensions.autoUpdate": false, but we are about to release a hotfix for this if you'd rather just wait a little.

@jakebailey jakebailey added fixed in next version (main) A fix has been implemented and will appear in an upcoming version and removed needs investigation Could be an issue - needs investigation labels Feb 11, 2021
@jakebailey
Copy link
Member

We've just published 2021.2.2, which reverts the change we applied to fix #923 but clearly caused issues. Let us know if the issue persists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version
Projects
None yet
Development

No branches or pull requests

8 participants