question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

1006 (connection closed abnormally [internal]), no reason

See original GitHub issue

Hi, I am using pylivetrader to run my trade algo on a cloud VM. However, after running a while, I keep getting this error message: 1006 (connection closed abnormally [internal]), no reason. I guess the cloud infra have some TCP timeout mechanism to trigger this websocket closed abnormally.
I guess the reason I got this error is that the code around here:

 def _get_stream(self, context):
        set_context(context)
        asyncio.set_event_loop(asyncio.new_event_loop())
        conn = tradeapi.StreamConn(self._key_id, self._secret, self._base_url)
        channels = ['trade_updates']

Can you help to identify and fix the issue?

Thank you.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:51 (28 by maintainers)

github_iconTop GitHub Comments

1reaction
cunhafhcommented, Apr 19, 2020

Hi, thanks for your reply.

I’ve updated the packages as per your instructions and am currently testing it. I’ll let you know the results tomorrow.

Regards

On Apr 19, 2020, at 1:33 PM, Shlomi Kushchi notifications@github.com wrote:

I have a patch for this issue. before I merge it, could you check that it works for your scenario? you need to manually install these 2 packages:

pip install -U git+https://github.com/alpacahq/pylivetrader@fix_streamcon_connection_loss pip install -U git+https://github.com/shlomikushchi/alpaca-trade-api-python@stream2_exception_handling please let me know if that works for you too

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/alpacahq/pylivetrader/issues/127#issuecomment-616203059, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOM5MO2GQRUWWHL2HF3PMM3RNM7XRANCNFSM4KFCLF6Q.

0reactions
shlomikushchicommented, Oct 13, 2020

you could try running the proxy-agent locally and use a debugger to see what’s wrong. or give me a code sample to execute locally

Read more comments on GitHub >

github_iconTop Results From Across the Web

1006 Connection closed abnormally error with python 3.7 ...
it means that the TCP connection was lost. As a consequence, the WebSocket connection was closed without receiving a close frame, which is ......
Read more >
websockets.exceptions.ConnectionClosedError: code = 1006 ...
I am implementing a websocket connection between a client and a server with a webrtс connection established. The server receives the data, processes...
Read more >
1006 connection closed code but stream never restarts
WARNING [stream.py:224] websocket error, restarting connection: code = 1006 (connection closed abnormally [internal]), no reason.
Read more >
FAQ — websockets 8.1 documentation
it means that the TCP connection was lost. As a consequence, the WebSocket connection was closed without receiving a close frame, which is...
Read more >
What Is Meant By Channels Error 1006? - Pusher
When a WebSocket connection is closed without a "close frame", the pusher-js library emits an error with code 1006. Usually this is caused ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found