question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ResourceWarning: unclosed event loop on macOS, within pytest

See original GitHub issue

I just updated command line tools and macOS to 10.15.4, I’m within a virtualenv, using ipdb within pytest, Python v. 3.7.7. Don’t know if the update is related.

I’m getting the following error:

Traceback (most recent call last):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/base_events.py", line 622, in __del__
    source=self)
ResourceWarning: unclosed event loop <_UnixSelectorEventLoop running=False closed=False debug=False>
Exception ignored in: <socket.socket fd=8, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0>
ResourceWarning: unclosed <socket.socket fd=8, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0>
Exception ignored in: <socket.socket fd=9, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0>
ResourceWarning: unclosed <socket.socket fd=9, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0>
Exception ignored in: <function BaseEventLoop.__del__ at 0x11b5d73b0>
Traceback (most recent call last):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/base_events.py", line 622, in __del__
    source=self)
ResourceWarning: unclosed event loop <_UnixSelectorEventLoop running=False closed=False debug=False>
Exception ignored in: <socket.socket fd=32, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0>
ResourceWarning: unclosed <socket.socket fd=32, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0>
Exception ignored in: <socket.socket fd=33, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0>
ResourceWarning: unclosed <socket.socket fd=33, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0>
Exception ignored in: <function BaseEventLoop.__del__ at 0x11b5d73b0>
Traceback (most recent call last):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/base_events.py", line 622, in __del__
    source=self)
ResourceWarning: unclosed event loop <_UnixSelectorEventLoop running=False closed=False debug=False>
Exception ignored in: <socket.socket fd=46, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0>
ResourceWarning: unclosed <socket.socket fd=46, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0>
Exception ignored in: <socket.socket fd=47, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0>
ResourceWarning: unclosed <socket.socket fd=47, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0>
Exception ignored in: <function BaseEventLoop.__del__ at 0x11b5d73b0>
Traceback (most recent call last):

Randomly in the ipdb prompt.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:7
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
mzr1996commented, Nov 5, 2021

Any updates on this problem? There are too many noisy warnings during debugging. Or any method to suppress these warnings temporarily?

3reactions
lyrixderavencommented, Aug 3, 2020

Just to verify, I can reproduce the issue as well, at the same line in prompt_toolkit’s application.py:808. Is there any quickfix to just suppress the warning for now? It’s really hindering to the debugging process due to all the noise.

Read more comments on GitHub >

github_iconTop Results From Across the Web

debugging python code while doing unitest using ipdb ...
... ResourceWarning: unclosed event loop <_UnixSelectorEventLoop ... I'm having this issue on osx. upgraded my python to 3.8.1 and am still ...
Read more >
pytest Documentation - Read the Docs
The first test passed and the second failed. You can easily see the intermediate values in the assertion to help you under-.
Read more >
Testing with AnyIO — AnyIO 3.6.2 documentation
The test runner keeps an event loop open during the request, making it possible for code in fixtures to communicate with the code...
Read more >
Changelog — pytest documentation
Backward incompatible (breaking) changes will only be introduced in major versions with advance notice in the Deprecations section of releases. pytest 7.1.3 ( ......
Read more >
no running event loop sys:1: runtimewarning: coroutine 'loop ...
Asyncio in corroutine RuntimeError: no running event loop ... Open side panel ... ResourceWarning: unclosed event loop <_UnixSelectorEventLoop running=False ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found