#๐Ÿ”’ Extremely Annoying and Out Of Hand Asyncio Server Problem

92 messages ยท Page 1 of 1 (latest)

earnest pierBOT
#

@mortal ivy

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

dire torrent
#

this looks really weird

#

why are you even using asyncio if you're just spawning threads anyway?

mortal ivy
#

im not?

#

im using one thread for the server

#

and im not sure why

#

i just kept it like that after i switched to asyncio

#

@dire torrent HELP

#

please

#

its a huge problem

dire torrent
#

this whole architecture looks really strange...if you have services written for asyncio, you shouldn't be spawning any extra threads

#

which Python version are you running?

mortal ivy
#

3.11

mortal ivy
#

i just use it to run the server's classes

#

thats it

dire torrent
#

you're contradicting yourself

#

you ARE spawning threads here

mortal ivy
#

you sound like im sapwning extra ones

#

or tons

#

or like many

dire torrent
#

I never said that

#

but you don't need any threads here

#

is it possible that your threads are crashing silently?

mortal ivy
#

but why would they you think?

#

all exceptions are handled

#

cpu is stable

#

memory is stable

dire torrent
#

I don't expect CPU or memory to be affected if a thread crashes

mortal ivy
#

oh

dire torrent
#

at any rate, it doesn't seem like there's any point in using threads here so I'd advise you to simplify the architecture at first

mortal ivy
#

Well

#

you do think its the thread?

#

i mean it never used to be an issue

dire torrent
#

hard to say at this point

mortal ivy
#

sure

#

ill test that

dire torrent
#

why you have so many made-up dunder methods?

mortal ivy
#

for?

dire torrent
#

like __close_socket__

mortal ivy
#

readability

#

ik its weird

#

ive been advised to stop using that

dire torrent
#

the point of dunder methods is that they have special meaning for the interpreter

mortal ivy
#

cus its for built in functions

#

ik

#

but

#

i just idk

#

its not like anyone else is supposed to see it

#

so i did it

dire torrent
#

why add extra characters then...

#

but that's not the prob

mortal ivy
#

ik its looks shit rn

dire torrent
#

when you get rid of the threads, you could add a "canary" task that prints something to the console every 10 seconds or so, so it the messages stop coming, you know the event loop is stuck

#

you could also check the status of tasks

#

I also can't understand this:

        async def container():
            await asyncio.create_task(self.__run__())
        asyncio.run(container())
#

why do this in such a roundabout way, instead of just asyncio.run(self.__run__())?

#

(not that I recommend doing this in __init__() anyway)

mortal ivy
#

thats what it was

#

thats literally what it was

#

but i changed it cus im so confused what the fuck is going wrong here

dire torrent
#

the event loop getting blocked is a common cause for weird things like these

#

hence the suggestion for the canary task

mortal ivy
#

it never exits the loop

#

ever

#

its not even the loop i dont think

dire torrent
#

when should it exit the event loop then?

mortal ivy
#

its serve_forever

dire torrent
#

yes, hence my question

mortal ivy
#

its not supposed to exit

dire torrent
#

well, does it?

mortal ivy
#

no

dire torrent
#

so no problem then?

mortal ivy
#

but idk why it gets "stuck"

#

it must the server itself

#

it wont receive sockets

dire torrent
#

that's what you need to confirm with the canary task

mortal ivy
#

my other logs

#

of Establishing SONY PSN CC show me when it stops working

#

and ive logged all exceptions in error.txt

#

everything

#

there is no thing unusual

#

ever

#

@dire torrent

#

there is my point

#

thats why i used threads

#

if i await the __run__, it pauses everyhting

#

nvm

earnest pierBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.

#

๐Ÿ”’ Extremely Annoying and Out Of Hand Asyncio Server Problem