Cant see traceback #1711
Replies: 23 comments
-
I'm having the same issue: if anything inside the socket fails there's no stacktrace in the logs. @LukenAgile42 We've implemented a really simple class decorator (just for easier debugging locally) that basically catches any exception inside the current class and prints the stacktrace:
However it would be great if someone take a look ! 🙂 |
Beta Was this translation helpful? Give feedback.
-
We just ran into a comparable issue. On a test system, it was due to a missing HOSTS entry for the Redis server. We're seeing the same behavior on a prototype production system but it sounds like what we're seeing is so non-specific that the actual error could be pretty much anything in the consumer. EDIT: To be clear, we're getting the slightly more interesting:
EDIT2: In our prototype production instance (AWS), the problem was that TransitEncyption defaults to "true" in the Elasticache Redis template we were using. We weren't using Obviously, the details are less important than the fact that none of these error are bubbling up into logging (Django or otherwise). |
Beta Was this translation helpful? Give feedback.
-
OK, so there's clearly logging lacking here. Question: if you dig-in, or use @Ivo-Donchev's suggestion, where are the errors occurring? Can we add logging in the right places there to surface the issues? (Anyone want to put together a minimal project that replicates this that we can play with?) |
Beta Was this translation helpful? Give feedback.
-
OK. If I wrap my If I watch the error, it reaches
I'm not clear why a production runner doesn't behave the same way. |
Beta Was this translation helpful? Give feedback.
-
Hey guys 🙂 , I think I found what's the issue 🔥 🎉 So, what I did:
I searched in the other issues and found this - #1193 (there's a suggested quickfix there) I started debugging the django-debug-toolbar code to find the root of the problem and turned out that this class is causing it - https://github.com/jazzband/django-debug-toolbar/blob/87eb27ffb2d0aea60b8b139360ece4d9fc91b47e/debug_toolbar/utils.py#L222 It's used by a code hooked to the python logging module and collects only the logs from the current thread (which channels is not part from) 😞 #1340 (comment) - this was solving the problem because the Hope this will help someone ^ |
Beta Was this translation helpful? Give feedback.
-
We're not using the debug toolbar. However, it certainly could be an issue with other middleware. |
Beta Was this translation helpful? Give feedback.
-
Hi @Ivo-Donchev — Thanks for the follow-up! Super. |
Beta Was this translation helpful? Give feedback.
-
This issue still persists. Anyone who found a workaround? Not using the debug toolbar and this makes it working blindly. |
Beta Was this translation helpful? Give feedback.
-
@Ivo-Donchev I also removed |
Beta Was this translation helpful? Give feedback.
-
Something else that worked for me is to set the root logger explicitly in settings:
|
Beta Was this translation helpful? Give feedback.
-
@LukenAgile42 Hmm. Can I see your code? (if It's open source of course 😄) |
Beta Was this translation helpful? Give feedback.
-
Its closed source, but my usage was just
I tried it while inheriting from |
Beta Was this translation helpful? Give feedback.
-
I stripped away all middleware and apps, except for some core django ones, but the logging was still broken. Must be an infrastructure issue somehow. |
Beta Was this translation helpful? Give feedback.
-
If this is really a logging issue, try installing logging_tree https://pypi.org/project/logging_tree/ and then inspecting the actual loggers in the connect function. Put a breakpoint in. Log something, is it displayed? (Sometimes a dictConfig will override all the existing loggers, so you don't get the config you thought you were.)
The decorator is Without a minimal reproduce it's really hard to see what can be happening. |
Beta Was this translation helpful? Give feedback.
-
No stdout. Just
as before. |
Beta Was this translation helpful? Give feedback.
-
@LukenAgile42 Can you setup a minimal django app so we can see it reproduced in isolation? I'd love to play with it and help fixing it. |
Beta Was this translation helpful? Give feedback.
-
+1 have problem |
Beta Was this translation helpful? Give feedback.
-
I keep hoping to actually build an example of this for testing, but haven't found time yet. I wonder if it's enough to analyze the stack trace I posted above. Shouldn't we expect to log (and possibly re In this case, channels.utils.await_many_dispatch seems to wrap activities from other modules (
If one of the tasks error, isn't this method a logical place to catch and log it?
To ensure all of the cancels are attempted ASAP, I suspect the block should look more like this:
|
Beta Was this translation helpful? Give feedback.
-
P.S. this is the caller. There isn't a logger at this level either, but at least a message here is put into the context of the |
Beta Was this translation helpful? Give feedback.
-
Is there any progress on this issue. I am also facing this. Unable to see any sort of logs. |
Beta Was this translation helpful? Give feedback.
-
Same here backend:
frontend:
|
Beta Was this translation helpful? Give feedback.
-
I also had this issue, but finally, I figured out that I simply forgot to set
|
Beta Was this translation helpful? Give feedback.
-
Thank you @Pithikos. This actually helped me to show the traceback in the console. Is there a way to find out which logger handled the exception? |
Beta Was this translation helpful? Give feedback.
-
produces
With no traceback
When I try to reproduce this with a minimal setup, it gives traceback
as expected.
Adding a print
inside
daphne.server.Server.application_checker
allows me to see the output, so it seems daphne swallows the errors somehow.
Beta Was this translation helpful? Give feedback.
All reactions