Closed un-hongly closed 5 months ago
I'd guess this is the problem:
<= [11/06 08:07:43] POST https://azwus1-client-s.gateway.messenger.live.com/v1/users/ME/endpoints
{'headers': {'Authentication': 'skypetoken=***',
'BehaviorOverride': 'redirectAs404',
'LockAndKey': 'appId=msmsgs@msnmsgr.com; time=1718093263; '
'lockAndKeyResponse=e9a72ea6428574f6a0c38e365dc3d061'},
'json': {'endpointFeatures': 'Agent'}}
timed out
I assume timed out
is coming from your print(e)
? (NB. import traceback; traceback.print_exception(e)
would be more useful, in order to capture the exception type as well as the actual traceback.)
It looks like SkPy is correctly trying to recreate its endpoint, needs to switch domain (to azwus1
), but the create request there failed due to a network timeout. Does this happen consistency at that step?
Yes ,timed out
is from my print(e)
. I will add import traceback; traceback.print_exception(e)
to my code.
I believe timed out
is from httpx.post(self.message_endpoint, json=data)
. When new event come I forward the message to another server for handling the message. I think when user send a a large size file I also upload it to file server and I think it might take longer than 5 seconds that can cause httpx.post()
to timeout.
During my httpx.post()
wait time will it interrupted your create request and cause network timeout? Sorry I'm just a python beginner.
Today it happened again and the error message is ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
During my
httpx.post()
wait time will it interrupted your create request and cause network timeout?
It seems to have been interrupted somehow, as there's no response (section beginning <=
) logged for the request before that timeout, possibly due to the use of threading. Are you creating other threads not shown in the code above?
the error message is
('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
Traceback?
It would be useful to have a clean run of this without interference from httpx
or whatever else -- remove your onEvent
logic and see if the token renewal still fails when just listening for events. I'd also like to know exactly how long it takes to fall over (tokens typically last 24 hours so I'd expect it to be roughly a whole number of days if it is down to that).
Are you creating other threads not shown in the code above?
=> There is only one thread that run the loop that I've shown above.
It would be useful to have a clean run of this without interference from httpx or whatever else -- remove your onEvent logic and see if the token renewal still fails when just listening for events.
=> I have a test environment running as well but the problem never happen as no one use it everyday like the production one.
By those I assume that the problem is came from my event handler. I think due to synchronous execution cause process to hang by waiting my httpx.post()
to finish.
I'm still not entirely clear how it would break in the place it appears to, but if you're spending time in the event handler doing slow uploads then it may well be that Skype is invalidating your endpoint because you haven't listened for events in a while.
I'd suggest moving anything slow into its own thread or separate worker process etc. so that you can immediately resume listening for more Skype events (you're currently joining to a single thread which is doing nothing useful).
Seeing as it doesn't happen on a clean event loop (I also set my own no-op test going and that appears to be working), I am to assume the event loop handling is working as intended. If you can trigger it without external factors, please post an updated code sample and logs.
Before we start...
Summary
I got an unexpected error after a fews day running it the loop start to crash. The error message said "You must create an endpoint before performing this operation."
Code sample
Code output
Explain your code
I build a bot on Skype to handle user messages. Bot will send message to group and user quote a reply to perform some action after perform success I remove the bot message.
In this code, I ran loop to pull new messages and It's work fine until 3 or 4 day later it will throw an error and my loop stopped. When the loop stop I need to restart server for it to work again.
SkPy version
0.10.7
Python version
3.11.7
Anything else?
No response