Skip to content

Close code: 1011 (No logging) #1383

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
dpineiden opened this issue Nov 19, 2019 · 4 comments
Open

Close code: 1011 (No logging) #1383

dpineiden opened this issue Nov 19, 2019 · 4 comments

Comments

@dpineiden
Copy link

Hi.

I'm trying to configure channels, with redis layer, i'm well connected to the channels with a source-client.
After some messages correctrly sended, the channel fails and cut the communication.

Send: 1011 close_code and no more information....

What can i do?

@TonisPiip
Copy link

TonisPiip commented Feb 14, 2020

Had very similar issue. What was happening for me was in our chat system, when sending a message, connection would close with error 1011 and no error in the logs.
What was happening was right after sending, the server sends the message to other groups, which were based on the user-names, which caused the error :

  File "/home/tonis/Projects/lino/py3/lib/python3.7/site-packages/channels/layers.py", line 168, in valid_group_name
    "Group name must be a valid unicode string containing only ASCII "
  Group name must be a valid unicode string containing only ASCII alphanumerics, hyphens, or periods.

For some reason unknown to me it didn't actually log this error anywhere. But just crashed.
solution was to wrap the channels sending code in a try block and use:

except Exception as E:
    logger.exception(e)

Then I could see the error. Hopfully this helps you or someone in the future.

@carltongibson
Copy link
Member

For some reason unknown to me it didn't actually log this error anywhere.

This is the first issue. It would be nice for this to bubble up. @CylonOven Could you put a minimal project together showing your set up so we can work out what would need to change there? (Ta!)

@carltongibson carltongibson changed the title Close code: 1011 Close code: 1011 (No logging) Feb 26, 2020
@JulienPalard
Copy link
Contributor

The missing logs can be related to django-commons/django-debug-toolbar#1300
Just configure a handler for the "daphne" logger in the meantime.

@jamiegau
Copy link

Just wanted to contribute to this issue, how I caused it. ;) and fixed it.

I am using async. Its easy to forget you need to convert certain calls into
@sync_to_async
They will work SOMETIMES. So recommend you take special care when developing this code.. Drop some global try: exceptions in to catch the error and log.. As typically this will fail silently and with a 1011 error in the browser side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants