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

Issues with async discord connection #11

Open
NyaomiDEV opened this issue Oct 31, 2019 · 5 comments
Open

Issues with async discord connection #11

NyaomiDEV opened this issue Oct 31, 2019 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@NyaomiDEV
Copy link

NyaomiDEV commented Oct 31, 2019

INFO:discordrp_mpris.__main__:Connection to Discord client lost. Reconnecting...
WARNING:asyncio:socket.send() raised exception.
WARNING:asyncio:socket.send() raised exception.
INFO:discordrp_mpris.__main__:Connection to Discord client lost. Reconnecting...
WARNING:asyncio:socket.send() raised exception.
WARNING:asyncio:socket.send() raised exception.
INFO:discordrp_mpris.__main__:Connection to Discord client lost. Reconnecting...
WARNING:asyncio:socket.send() raised exception.
WARNING:asyncio:socket.send() raised exception.
INFO:discordrp_mpris.__main__:Connection to Discord client lost. Reconnecting...
WARNING:asyncio:socket.send() raised exception.
WARNING:asyncio:socket.send() raised exception.

Discord is running fine in the meantime. I am using Ubuntu 18.04.3 LTS

@FichteFoll
Copy link
Owner

Has this worked for you before? Has discord been installed as a snap?

@NyaomiDEV
Copy link
Author

NyaomiDEV commented Nov 4, 2019

It only works for some time (~10 minutes) after it is launched. Discord is installed via deb file.
The "workaround" to this is stopping / relaunching the program; but I wanted to run it as a daemon, so it's not that effective as a workaround

@FichteFoll
Copy link
Owner

FichteFoll commented Nov 4, 2019

I'm thinking of rewriting parts of the tool, in addition to implementing the other enhancements in open issues, which may or may not make it more stable, but no ETA as of now.

I've also experienced occasional malfunction, but I couldn't pin down a cause.

@PoorPocketsMcNewHold
Copy link

 pm@VIX  /home/pm   systemctl --user status discordrp-mpris.service                                                                                                                                                         14:58:21 
● discordrp-mpris.service - Discord Rich Presence based on mpris2 media players
     Loaded: loaded (/usr/lib/systemd/user/discordrp-mpris.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Thu 2020-07-09 14:58:13 CEST; 25s ago
    Process: 301790 ExecStart=/usr/bin/discordrp-mpris (code=exited, status=1/FAILURE)
   Main PID: 301790 (code=exited, status=1/FAILURE)

juil. 09 14:58:13 VIX discordrp-mpris[301790]:     op, length = await self._recv_header()
juil. 09 14:58:13 VIX discordrp-mpris[301790]:   File "/usr/lib/python3.8/site-packages/discord_rpc/async_.py", line 108, in _recv_header
juil. 09 14:58:13 VIX discordrp-mpris[301790]:     header = await self._recv_exactly(8)
juil. 09 14:58:13 VIX discordrp-mpris[301790]:   File "/usr/lib/python3.8/site-packages/discord_rpc/async_.py", line 247, in _recv_exactly
juil. 09 14:58:13 VIX discordrp-mpris[301790]:     return await self.reader.readexactly(size)
juil. 09 14:58:13 VIX discordrp-mpris[301790]:   File "/usr/lib/python3.8/asyncio/streams.py", line 721, in readexactly
juil. 09 14:58:13 VIX discordrp-mpris[301790]:     raise exceptions.IncompleteReadError(incomplete, n)
juil. 09 14:58:13 VIX discordrp-mpris[301790]: asyncio.exceptions.IncompleteReadError: 0 bytes read on a total of 8 expected bytes
juil. 09 14:58:13 VIX systemd[3478]: discordrp-mpris.service: Main process exited, code=exited, status=1/FAILURE
juil. 09 14:58:13 VIX systemd[3478]: discordrp-mpris.service: Failed with result 'exit-code'.

 pm@VIX  /home/pm   systemctl --user start discordrp-mpris.service                                                                                                                                                          14:58:39 

 pm@VIX  /home/pm   systemctl --user status discordrp-mpris.service                                                                                                                                                         14:58:47 
● discordrp-mpris.service - Discord Rich Presence based on mpris2 media players
     Loaded: loaded (/usr/lib/systemd/user/discordrp-mpris.service; enabled; vendor preset: enabled)
     Active: active (running) since Thu 2020-07-09 14:58:47 CEST; 2s ago
   Main PID: 360463 (discordrp-mpris)
     CGroup: /user.slice/user-1000.slice/user@1000.service/discordrp-mpris.service
             └─360463 /usr/bin/python /usr/bin/discordrp-mpris

juil. 09 14:58:47 VIX systemd[3478]: Started Discord Rich Presence based on mpris2 media players.

Not sure if we are talking about the same issue there, but discordrp-mpris does fail when discord is not yet started.

As said, One workaround is manually restarting it after one instance of Discord has been started.

@FichteFoll FichteFoll added the bug Something isn't working label Jan 27, 2021
@azizLIGHT
Copy link

Basically discordrp-mpris works OK if it is started after Discord is launched, but not otherwise.

When systemd unit is started on boot, discordrp-mpris tries to connect when Discord isn't started, it will log continuously every second:
ERROR:discord_rpc.async_:failed to open '/run/user/1000/discord-ipc-0': [Errno 111] Connection refused

If Discord is launched at this point, then discordrp-mpris crashes with these logs:

Apr 02 15:17:57 fractal discordrp-mpris[139309]: ERROR:discord_rpc.async_:failed to open '/run/user/1000/discord-ipc-0': [Errno 111] Connection refused
Apr 02 15:17:58 fractal discordrp-mpris[139309]: ERROR:discord_rpc.async_:failed to open '/run/user/1000/discord-ipc-0': [Errno 111] Connection refused
Apr 02 15:17:59 fractal discordrp-mpris[139309]: ERROR:discord_rpc.async_:failed to open '/run/user/1000/discord-ipc-0': [Errno 111] Connection refused
Apr 02 15:18:00 fractal discordrp-mpris[139309]: ERROR:discord_rpc.async_:failed to open '/run/user/1000/discord-ipc-0': [Errno 111] Connection refused
Apr 02 15:18:01 fractal discordrp-mpris[139309]: WARNING:discord_rpc.async_:closing connection
Apr 02 15:18:01 fractal discordrp-mpris[139309]: Traceback (most recent call last):
Apr 02 15:18:01 fractal discordrp-mpris[139309]:   File "/usr/bin/discordrp-mpris", line 33, in <module>
Apr 02 15:18:01 fractal discordrp-mpris[139309]:     sys.exit(load_entry_point('discordrp-mpris==0.3.0', 'console_scripts', 'discordrp-mpris')())
Apr 02 15:18:01 fractal discordrp-mpris[139309]:   File "/usr/lib/python3.9/site-packages/discordrp_mpris/__main__.py", line 292, in main
Apr 02 15:18:01 fractal discordrp-mpris[139309]:     loop.run_until_complete(wait_task)
Apr 02 15:18:01 fractal discordrp-mpris[139309]:   File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
Apr 02 15:18:01 fractal discordrp-mpris[139309]:     return future.result()
Apr 02 15:18:01 fractal discordrp-mpris[139309]:   File "/usr/lib/python3.9/asyncio/tasks.py", line 478, in wait_for
Apr 02 15:18:01 fractal discordrp-mpris[139309]:     return fut.result()
Apr 02 15:18:01 fractal discordrp-mpris[139309]:   File "/usr/lib/python3.9/site-packages/discordrp_mpris/__main__.py", line 287, in main
Apr 02 15:18:01 fractal discordrp-mpris[139309]:     return loop.run_until_complete(main_task)
Apr 02 15:18:01 fractal discordrp-mpris[139309]:   File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
Apr 02 15:18:01 fractal discordrp-mpris[139309]:     return future.result()
Apr 02 15:18:01 fractal discordrp-mpris[139309]:   File "/usr/lib/python3.9/site-packages/discordrp_mpris/__main__.py", line 280, in main_async
Apr 02 15:18:01 fractal discordrp-mpris[139309]:     return await instance.run()
Apr 02 15:18:01 fractal discordrp-mpris[139309]:   File "/usr/lib/python3.9/site-packages/discordrp_mpris/__main__.py", line 67, in run
Apr 02 15:18:01 fractal discordrp-mpris[139309]:     await self.connect_discord()
Apr 02 15:18:01 fractal discordrp-mpris[139309]:   File "/usr/lib/python3.9/site-packages/discordrp_mpris/__main__.py", line 56, in connect_discord
Apr 02 15:18:01 fractal discordrp-mpris[139309]:     await self.discord.connect()
Apr 02 15:18:01 fractal discordrp-mpris[139309]:   File "/usr/lib/python3.9/site-packages/discord_rpc/async_.py", line 64, in connect
Apr 02 15:18:01 fractal discordrp-mpris[139309]:     await self._do_handshake()
Apr 02 15:18:01 fractal discordrp-mpris[139309]:   File "/usr/lib/python3.9/site-packages/discord_rpc/async_.py", line 94, in _do_handshake
Apr 02 15:18:01 fractal discordrp-mpris[139309]:     raise RuntimeError(ret_data)
Apr 02 15:18:01 fractal discordrp-mpris[139309]: RuntimeError: {'code': 1000, 'message': 'User logged out'}

The workaround is to launch discordrp-mpris after launching Discord for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants