#๐ Asyncio Server Problem
107 messages ยท Page 1 of 1 (latest)
@frosty grove
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.
Once again, server runs fine, 0 issues. Suddenly, i'll see it stops receving incoming connections for no apparent reason.
When i cntrl C, no unhandled exceptions or anything unexpected
@trail raven
Dont wanna bother u, but ur smart
and im on the verge of a meltdown
asyncio.create_task(tick()), await asyncio.Event().wait()
``` you should probably hold a strong reference to the tick task
or use a TaskGroup
having blank excepts will prevent exceptions from propagating
how do you know?
cus i just added that
the GC could be collecting that task and killing everything
and it was different before
it was different before
and had same issues
it was this before
hmm
Not sure if related , but also shouldn't you await the wait closed? https://docs.python.org/3/library/asyncio-stream.html#asyncio.StreamWriter.wait_closed
I just assume there's some resource leak, if it's 'fails after n minutes', so look at any cleanup.
okay
i have a feeling it has something to do with start
idk
all i know is the coroutine isnt being cancelled.
its super strange man
im sure this is right though
I'll refer you to nedbat's wisdom: #python-discussion message
Should i ping him?
i dont wanna be rude to him.
oh u mean the message
lmao
i thought u meant him
what seems to be the prob
I should add that it once actually died like less than a minute after running
did you add the canary task like I asked you to?
no
why?
I explained it to you
often the mistakes i make are stupid
and why you need it
you need it so that when it stops outputting text, you know the event loop is stuck
will canary task show me exactly where it when wrong
no, but it will confirm that the event loop is stuck
i can know if its stuck, will it show me where or how it got stuck
ive got something else doing that now
im waiting for something to go wrong again
and ill see
well, there is a way to get a stack trace from another thread
so if you detect, from another thread, that the event loop is stuck, you can use this technique to find out what the event loop thread is doing
do you have your current code up somewhere?
sys._current_frames() is the key function here
that's your old code, from when you opened this help channel?
current
see
it's still spawning threads
i dont use threads
at all
btw
for this
or threading
i removed it like u told me to
send pic
that picture tells me nothing
I want to see what we're working with
thats unrelated
wym
what do I mean? you have a problem with code, so maybe let me see what that code looks like?
here
you really should either store the tasks somewhere or use a task group
reading the docs helps, sometimes
right
task groups make this easy
and they also ensure that exceptions aren't lost
if you can't upgrade to Python 3.12 (where asyncio.TaskGroupis available), you can use AnyIO and its create_task_group()
Thank you so much btw
np
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.
๐ Asyncio Server Problem