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

Fix windows rpc close & broken ipc pipe detection #236

Merged
merged 5 commits into from
Mar 2, 2024

Conversation

NikOverflow
Copy link
Collaborator

It includes this pull request too: #234

Under Windows, the socket is not closed and cleaned up properly for some reason. So we have to force it. This pull request fixes the problem completely.

Here is the POC:

import gc
from pypresence import Presence

rpc = Presence(client_id="1193490043612971030")
rpc.connect()
rpc.close()
rpc = None
gc.collect()

And here is the error:

Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x000001A7FAAEF160>
Traceback (most recent call last):
  File "C:\Users\joria\anaconda3\lib\asyncio\proactor_events.py", line 115, in __del__
    _warn(f"unclosed transport {self!r}", ResourceWarning, source=self)
  File "C:\Users\joria\anaconda3\lib\asyncio\proactor_events.py", line 79, in __repr__
    info.append(f'fd={self._sock.fileno()}')
  File "C:\Users\joria\anaconda3\lib\asyncio\windows_utils.py", line 102, in fileno   
    raise ValueError("I/O operation on closed pipe")
ValueError: I/O operation on closed pipe

This guy helped me a lot: @JorianWoltjer

@qwertyquerty qwertyquerty merged commit 9562a8c into qwertyquerty:master Mar 2, 2024
1 check passed
NikOverflow added a commit to SecSchool/discord-rich-presence that referenced this pull request Mar 7, 2024
For more information here is the description:
qwertyquerty/pypresence#236
@NikOverflow NikOverflow deleted the fix-windows-stuff branch March 11, 2024 06:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants