Terbau / fortnitepy

Async python library for interacting with Fortnite's API and XMPP services.
MIT License
148 stars 52 forks source link

ConnectionError: connection timeout #67

Closed Pulse-Git closed 4 years ago

Pulse-Git commented 4 years ago

Getting the following error

broker task failed Traceback (most recent call last): File "/usr/local/lib/python3.7/dist-packages/aioxmpp/stream.py", line 1939, in _run timeout=timeout) File "/usr/lib/python3.7/asyncio/tasks.py", line 363, in wait return await _wait(fs, timeout, return_when, loop) File "/usr/lib/python3.7/asyncio/tasks.py", line 456, in _wait await waiter concurrent.futures._base.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.7/dist-packages/aioxmpp/stream.py", line 892, in _done_handler task.result() File "/usr/local/lib/python3.7/dist-packages/aioxmpp/stream.py", line 1987, in _run raise self._xmlstream_exception ConnectionError: connection timeout (dead time hard limit exceeded) stream failed: connection timeout (dead time hard limit exceeded)

Terbau commented 4 years ago

I've known about this error for quite some time but never managed to find a solution to it. The error seems to be raised only on specific accounts and other problems are often noticed on these accounts making everything unstable. The best fix for now is to make a new account and use that if possible.

Pulse-Git commented 4 years ago

mh really strange, i will try it on another account. Maybe the best way to resolve this issue is to debug all functions where python can raise this error and access the aioxmpp Library

Terbau commented 4 years ago

A little update on this issue. After experiencing a little bit myself I have noticed that the "member expire" event seems to be called whenever this happens. Not sure exactly how this works considering the error is raised because of a cancel error from the xmpp connection, but regardless I might have some workarounds for this issue. One of them might be to recreate the xmpp session or just call Client.restart(). I will look more into it in the future but for now this is still quite rare (i would say it happens on 1-2 of 100 accounts).

Terbau commented 4 years ago

Not sure why you closed this issue. No fixes has been made for this particular bug and therefore im opening the issue again.

As to any updates on it I can say that I've been digging a bit and discovered that it has something to do with these aioxmpp stream variables:

Both are set to datetime.timedelta(minutes=1) by default and my hypothesis is that this might be too low for some scenarios. I'm currently testing with 5 minutes instead of 1 on one of my projects that have somewhere around 200 bots running simultaneously. This is the only place I've seen the bug before. I'll update this thread when I have the results after running it for a couple of days.

Terbau commented 4 years ago

After testing for a while the error has seemed to disappear. Therefore I decided to add the fix to master.