Django **not responding** when DEBUG = FALSE - No error raised / Apache HTTPError issue (?)

106 views
Skip to first unread message

Paul Antropius

unread,
Jan 3, 2015, 6:19:03 AM1/3/15
to django...@googlegroups.com
Good morning,

The production server sends absolutely **no response** when DEBUG is set to FALSE.
Browser still waits for a response : no error (neither 404, nor 500) is raised. Minutes later, it ends up with a 503 error.

Apache error log reads :
HTTPError: HTTP Error 404: Not Found trying request again in 5 seconds
HTTPError: HTTP Error 404: Not Found trying request again in 10 seconds
HTTPError: HTTP Error 404: Not Found trying request again in 15 seconds
...
I can find not instance of this king of behaviour looking in Google : why would apache repeatingly try to connect after a HTTPError ? Is the server supposed to set himself up after realizing it has been wrong ??

I have looked after the common issues :

1) ALLOWED_HOST is set correctly. ['*'] leads to the same result.

2) It looks like there is no "ImportError" (I have grossly checked that the code is loaded, and I guess it would otherwise raise an ImportError).

3) I do have static files issues : some are not loading as expected, using {% load staticfiles %} and {% static ''%}.
I have suspected that my custom 404.html page would loop with a static file HTTPError, but it is apparently not the case.

What I can affirm :
The error occurs after :
* settings.py is loaded.
* models are loaded ;

The error occurs before :
* urls.conf is loaded ;
* views.py is loaded.

Eventually, I do not understand :
* what raises a HTTPError when DEBUG is set to False ;
* why this HTTPError is not caught by Django ;
* Why apache does not simply sends back a 404 signal ?

I'm stuck on a saturday trying to figure out where and what would be this error.

Any help would be very appreciated.

Thank you very much.

Mike Dewhirst

unread,
Jan 3, 2015, 6:16:33 PM1/3/15
to django...@googlegroups.com
On 3/01/2015 10:19 PM, Paul Antropius wrote:
> Good morning,
>
> The production server sends absolutely **no response** when DEBUG is set
> to FALSE.
> Browser still waits for a response : no error (neither 404, nor 500) is
> raised. Minutes later, it ends up with a 503 error.
>
> Apache error log reads :
> HTTPError: HTTP Error 404: Not Found trying request again in 5 seconds
> HTTPError: HTTP Error 404: Not Found trying request again in 10 seconds
> HTTPError: HTTP Error 404: Not Found trying request again in 15 seconds
> ...
> I can find not instance of this king of behaviour looking in Google :
> why would apache repeatingly try to connect after a HTTPError ? Is the
> server supposed to set himself up after realizing it has been wrong ??
>
> I have looked after the common issues :
>
> 1) ALLOWED_HOST is set correctly. ['*'] leads to the same result.
>
> 2) It looks like there is no "ImportError" (I have grossly checked that
> the code is loaded, and I guess it would otherwise raise an ImportError).

If the system works under the dev server it looks like all the software
works. But the dev server is quite forgiving if software loads in the
"wrong" sequence. Apache might be revealing import loops.

You could try moving imports out of the module and down into the method
namespaces experimentally to see if that helps.

>
> 3) I do have static files issues : some are not loading as expected,
> using {% load staticfiles %} and {% static ''%}.
> I have suspected that my custom 404.html page would loop with a static
> file HTTPError, but it is apparently not the case.

Try vanilla 404 for the moment.

>
> What I can affirm :
> The error occurs after :
> * settings.py is loaded.
> * models are loaded ;
>
> The error occurs before :
> * urls.conf is loaded ;
> * views.py is loaded.
>
> Eventually, I do not understand :
> * what raises a HTTPError when DEBUG is set to False ;
> * why this HTTPError is not caught by Django ;
> * Why apache does not simply sends back a 404 signal ?

Apache seems to be retrying the 404 every 5*n seconds where n is
incrementing by 1 for each retry. I think I would be trying to change
that behaviour first and maybe eliminate retries until the "main"
problem surfaces.

>
> I'm stuck on a saturday trying to figure out where and what would be
> this error.

Sunday morning here :)

>
> Any help would be very appreciated.
>
> Thank you very much.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users...@googlegroups.com
> <mailto:django-users...@googlegroups.com>.
> To post to this group, send email to django...@googlegroups.com
> <mailto:django...@googlegroups.com>.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/9f348c04-79e7-43e7-be51-31180d7658e0%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/9f348c04-79e7-43e7-be51-31180d7658e0%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

Paul Antropius

unread,
Jan 4, 2015, 7:00:26 AM1/4/15
to django...@googlegroups.com


Le dimanche 4 janvier 2015 00:16:33 UTC+1, Mike Dewhirst a écrit :
On 3/01/2015 10:19 PM, Paul Antropius wrote:
> Good morning,
>
> The production server sends absolutely **no response** when DEBUG is set
> to FALSE.
> Browser still waits for a response : no error (neither 404, nor 500) is
> raised. Minutes later, it ends up with a 503 error.
>
> Apache error log reads :
> HTTPError: HTTP Error 404: Not Found trying request again in 5 seconds
> HTTPError: HTTP Error 404: Not Found trying request again in 10 seconds
> HTTPError: HTTP Error 404: Not Found trying request again in 15 seconds
> ...
> I can find not instance of this king of behaviour looking in Google :
> why would apache repeatingly try to connect after a HTTPError ? Is the
> server supposed to set himself up after realizing it has been wrong ??
>
> I have looked after the common issues :
>
> 1) ALLOWED_HOST is set correctly. ['*'] leads to the same result.
>
> 2) It looks like there is no "ImportError" (I have grossly checked that
> the code is loaded, and I guess it would otherwise raise an ImportError).

If the system works under the dev server it looks like all the software
works. But the dev server is quite forgiving if software loads in the
"wrong" sequence. Apache might be revealing import loops.

You could try moving imports out of the module and down into the method
namespaces experimentally to see if that helps.  
Yes, I'm afraid I will have to chat a few hours with my beloved server to get it right (it's for tomorrow morning... !).
However, I wonder : wouldn't an ImportError be raised in that case ?

>
> 3) I do have static files issues : some are not loading as expected,
> using {% load staticfiles %} and {% static ''%}.
> I have suspected that my custom 404.html page would loop with a static
> file HTTPError, but it is apparently not the case.

Try vanilla 404 for the moment.

Huh ? Ok, i'll see what I can find :-)
>
> What I can affirm :
> The error occurs after :
> * settings.py is loaded.
> * models are loaded ;
>
> The error occurs before :
> * urls.conf is loaded ;
> * views.py is loaded.
>
> Eventually, I do not understand :
> * what raises a HTTPError when DEBUG is set to False ;
> * why this HTTPError is not caught by Django ;
> * Why apache does not simply sends back a 404 signal ?

Apache seems to be retrying the 404 every 5*n seconds where n is
incrementing by 1 for each retry. I think I would be trying to change
that behaviour first and maybe eliminate retries until the "main"
problem surfaces.

I'd like to, but... a Google search "Aapche trying request again in " gave me no clue ! Interestingly, my post is now the first Google reference under this key expression...
I think I will have to find without this indication.
>
> I'm stuck on a saturday trying to figure out where and what would be
> this error.

Sunday morning here :)

Mid in France. Thank you for your response :-)
>
> Any help would be very appreciated.
>
> Thank you very much.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users...@googlegroups.com

Paul Antropius

unread,
Jan 4, 2015, 11:58:19 AM1/4/15
to django...@googlegroups.com
Okay, it was just an old and obsolete custom security with my wikitools module, that prevents the code to access an external website under debug mode...
It thus returned a 404 code, and the wikitools api was forcing the connection with this 5 seconds step pattern...

Let's rock ! :-)

BTW : I figured out when the bugs come from by running the debug django server on my production server. Quitting it after realizing it produced the same error dumped a very useful backtrack message...
Reply all
Reply to author
Forward
0 new messages