-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Just Enabling Debug Toolbar as Middleware creates Delays of Several Seconds on each request #1927
Comments
Can you explain these points further? I don't know enough about them.
Why would a resolver running locally time out? Are there other resolvers you're considering or is it the local case? If there are others can you explain those to me? I don't use docker often enough to know these answers. Any details you can provide will help. I'm surprised this is an issue running everything locally. |
Hi Tim Funny thing is, i am not even using Docker to run Django, i rather use a Python virtualenv. The Effect is, that every request takes at least 5 (and up to 10) Seconds to complete. time wget http://localhost:8000/django-url/
--2024-05-28 19:27:51-- http://localhost:8000/django-url/
Resolving localhost (localhost)... 127.0.0.1
Connecting to localhost (localhost)|127.0.0.1|:8000... connected.
HTTP request sent, awaiting response... 200 OK
Length: 15666 (15K) [text/html]
Saving to: ‘index.html’
index.html
100%[======================================================================================================>] 15,30K --.-KB/s in 0s
2024-05-28 19:28:01 (804 MB/s) - ‘index.html’ saved [15666/15666]
real 0m10,054s
user 0m0,001s
sys 0m0,004s Regarding Resolvers that might cause such timeouts for non-existing domains, Ubuntu using |
Also, if I think about it a bit longer, the code above opens the server far more than intended. in two ways:
So i really think, that if the user wants such a behaviour they should be able to manually add |
I can't reproduce this problem you're encountering. Can you create a reproducible environment for me? When I run
|
I'm good with creating a separate show toolbar callback for docker. |
Hi Tim, what one needs for reproducing this failure is an environment that uses a DNS resolver that times out on resolving then you will get the server to hang for as long as the timeout of resolving I think basicly it should not try to resolve that domain when not running in a docker. As a workaround i put |
We share the same observation on Ubuntu.
This from is within a docker container on an Ubuntu host btw. A quick google search reveals that |
A first change has already landed addressing this but isn't yet a part of a release. |
Awesome, cf0cc0d will solve our issue, thank you :) However, there will still be the issue that |
I created a very simple project using following command. And I added just django-debug-toolbar to make test. Here are my settings.
As you can see, I disabled almost panels, but the same problem. It seems the problem only happens with note
|
Is this still an issue? The DNS resolving now only happens after checking |
I tried on Ubuntu 22.04 directly it worked, but when I try on VM it didn't work. |
@heindrickdumdum0217 The regression was in The fix for this was And was released in So you should try updating to I believe this issue can be closed now. |
@johnthagen |
Closing as fixed. Thanks @johnthagen for communicating that. |
in
debug_toolbar/middleware.py
is following code:on every request it tries to resolve
host.docker.internal
which might lead to a timeout from the resolver running locally.I believe at least this behaviour should be described in the documentation and that it might cause problems with certain resolvers.
Also I believe it should be sufficient to do this name resolution only once per server startup and not at every request.
Another way might be to use the documentation to decribe how to add
host.docker.internal
toINTERNAL_IPS
if a user is inclined to do so.What do you think?
The text was updated successfully, but these errors were encountered: