#16700: The request_started signal is not called for the first request a newly-
initialized webserver receives.
---------------------+------------------------------
 Reporter:  etianen  |          Owner:  nobody
     Type:  Bug      |         Status:  new
Milestone:           |      Component:  Core (Other)
  Version:  1.3      |       Severity:  Normal
 Keywords:           |   Triage Stage:  Unreviewed
Has patch:  0        |  Easy pickings:  0
    UI/UX:  0        |
---------------------+------------------------------
 When running Django on Apache and mod_wsgi via the WSGIHandler, the
 request_started signal is not sent on the first request. This problem
 potentially affects other server handlers too.

 This problem occurs because on the first request to the server, the
 following sequence of actions occurs:

 1. request_started signal called
 2. Application modules are loaded, code containing signal connections is
 run.
 3. Request is handled
 4. request_finished signal is called

 On the second request, because the application code which contains the
 signal handlers has been run, and the signal connections established,
 everything behaves has expected.

 A consequence of this is that code which is expecting matched pairs of
 request_started and request_finished invocations for the current thread
 will perform unpredictably on the first request handled by the server.
 Subsequent requests will behave as expected. Even code that only connects
 to request_started will behave oddly on the first request.

 The solution might be to have a module in each application which is
 guaranteed to be loaded before the request_started signal is called.
 Something like app_label/signals.py. The BaseHandler would be modified to
 have a load_signals() method that would iterate over the installed apps
 and import the signals module if present. Handler subclasses would then
 call this load_signals() method before the first request is handled, in a
 similar way to the current handling of the load_middleware() method.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/16700>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to