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

Warning: socket.send() raised exception [asyncio] #36

Open
gaussandhisgun opened this issue Jun 12, 2024 · 4 comments
Open

Warning: socket.send() raised exception [asyncio] #36

gaussandhisgun opened this issue Jun 12, 2024 · 4 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@gaussandhisgun
Copy link

So I'm using this from an AUR package on Arch Linux, with ArmCord flatpak and arRPC (but this also happened to me back when i was using the normal discord app from base repos). After some time and probably some resource usage, the script just starts doing... this.
изображение
I can CTRL-C out of the script (and it floods my terminal with asyncio errors if i do that), launch it again and keep going, but that needs manual intervention. Maybe there should be a way to auto-restart the script if this kind of thing happens? Like, the script does not stop on these exceptions, but it also does not function until a restart.

This is the commit the AUR package is based on.

@BnDLett
Copy link

BnDLett commented Jun 24, 2024

Perhaps there could be a change in the code where the tool closes upon an exception rather than remaining open. 🤔

Discord-py-interactions does something like that. If a connection error occurs, then the Python program should be terminated. If you wish to keep it running in the event of a terminating exception, then you'll need an external script that will do that for you.

Although, that shouldn't really be the focus. The focus probably should be why this happens. It may be useful if you go to your configuration file (if it exists) and set the debug variable to true. It should look like this:

config.toml

[global]
debug = true

After that, send the error message here.

@gaussandhisgun
Copy link
Author

The error message is approximately 40 000 lines of this:

  File "/usr/lib/python3.12/asyncio/streams.py", line 741, in readexactly                                                                                                 
    raise self._exception                                                                                                                                                 
  File "/usr/lib/python3.12/site-packages/discordrp_mpris/__main__.py", line 91, in run                                                                                   
    await self.tick()                                                                                                                                                     
  File "/usr/lib/python3.12/site-packages/discordrp_mpris/__main__.py", line 182, in tick                                                                                 
    op_recv, result = await self.discord.set_activity(activity)                                                                                                           
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                           
  File "/usr/lib/python3.12/site-packages/discord_rpc/async_.py", line 176, in set_activity                                                                               
    return await self.send_recv(data)                                                                                                                                     
           ^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                     
  File "/usr/lib/python3.12/site-packages/discord_rpc/async_.py", line 144, in send_recv                                                                                  
    reply = await self.recv()                                                                                                                                             
            ^^^^^^^^^^^^^^^^^                                                                                                                                             
  File "/usr/lib/python3.12/site-packages/discord_rpc/async_.py", line 163, in recv                                                                                       
    op, length = await self._recv_header()                                                                                                                                
                 ^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                
  File "/usr/lib/python3.12/site-packages/discord_rpc/async_.py", line 105, in _recv_header                                                                               
    header = await self._recv_exactly(8)                                                                                                                                  
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                  
  File "/usr/lib/python3.12/site-packages/discord_rpc/async_.py", line 252, in _recv_exactly                                                                              
    return await self.reader.readexactly(size)                                                                                                                            
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                            

repeating over and over again.

@FichteFoll
Copy link
Owner

Is there also a specific exception mentioned somewhere?

@FichteFoll FichteFoll added the bug Something isn't working label Jun 28, 2024
@FichteFoll
Copy link
Owner

Just in case this wasn't obvious already, error handling is … not exactly the forte of this project. Partially because I personally didn't run into many but also because even when running into them, I wasn't sure what exactly to do to remedy the situation. Close the connection and try to start over? Close the application with an exit code to signal errors (and make the systemd unit fail)? Provide configuration for retries? Those are all questions I didn't want to answer back in the day and haven't really looked into again since.

I'll see if I can find some time in the coming weeks to overhaul the code since there are quite a few thinks I've learned since 2018.

Related: #11.

@FichteFoll FichteFoll added this to the 0.4.0 milestone Jun 28, 2024
@FichteFoll FichteFoll self-assigned this Sep 9, 2024
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

3 participants