#34989: APPEND_SLASH redirects much slower in Django 4.2 when used with uWSGI's
http11-socket
-------------------------------------+-------------------------------------
               Reporter:  Tenzer     |          Owner:  nobody
                   Type:  Bug        |         Status:  new
              Component:  HTTP       |        Version:  4.2
  handling                           |       Keywords:  CommonMiddleware
               Severity:  Normal     |  uWSGI
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 We upgraded from Django 4.1.13 to 4.2.7 this week, and as part of this, we
 noticed redirects for URLs that added a missing trailing slash took 4-5
 seconds. Before the upgrade, the redirects only took a fraction of a
 second to return.

 Debugging this, I've found out it's related to the change made for #33700.
 If I revert that change the delay goes away.

 I've also found out this requires a slightly specific setup. So far I've
 only seen it when using uWSGI as the application server using the
 `http11-socket` option. I am not able to reproduce the issue when using
 `http-socket` for configuring the listening socket.

 I have adapted the reproduction case from #33700 to show this issue. It
 can be found at https://github.com/Tenzer/django-slow-redirect. When
 making a request against the `http-socket` port, it returns immediately:
 {{{
 % time curl -si http://127.0.0.1:8010/url
 HTTP/1.1 301 Moved Permanently
 Content-Type: text/html; charset=utf-8
 Location: /url/

 curl -si http://127.0.0.1:8010/url  0.01s user 0.01s system 65% cpu 0.033
 total
 }}}
 but when I make a request against the `http11-socket` port, it instead
 takes at least 4 seconds extra:
 {{{
 % time curl -si http://127.0.0.1:8011/url
 HTTP/1.1 301 Moved Permanently
 Content-Type: text/html; charset=utf-8
 Location: /url/

 curl -si http://127.0.0.1:8011/url  0.01s user 0.01s system 0% cpu 4.026
 total
 }}}

 I am assuming this might be hitting a timeout somewhere but I can't work
 out where that might be or how the changes in
 https://github.com/django/django/pull/15689 might have caused it.

 We have for now had to switch to using the `http-socket` option in uWSGI,
 but it would be ideal if the `http11-socket` option also would work, as
 that is required for uWSGI to support keep-alive.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34989>
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018bf7ac2845-34f07ad1-a666-4735-82b0-30e756e1c841-000000%40eu-central-1.amazonses.com.

Reply via email to