Opened 12 years ago

Closed 12 years ago

#18781 closed Cleanup/optimization (fixed)

FallbackStorage fails its purpose with uwsgi's default settings

Reported by: Aymeric Augustin Owned by: nobody
Component: contrib.messages Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


FallbackStorage stores up to 3072 bytes of messages in cookies and the remainder in the session.

This is controlled by CookieStorage.max_cookie_size = 3072.


  • other HTTP headers can take more than 1024 bytes,
  • uwsgi's default buffer-size is 4k,
  • all the HTTP headers must fit in one uwsgi buffer, otherwise uwsgi barfs.

uwsgi's doc says:

If you plan to receive big requests with a lot of headers you can increase this value upto 64k

uwsgi is a common WSGI app server. To reduce the likelihood of this problem, I suggest to reduce CookieStorage.max_cookie_size to 2048. This is rather arbitrary, but it gives a bit more headroom.

The main purpose of FallbackStorage is to store one or two messages in cookies, to avoid touching the session in possible. 2048 bytes is enough to store about 25 lines of text.

Change History (2)

comment:1 by Aymeric Augustin, 12 years ago

Triage Stage: UnreviewedAccepted

I just discussed this with Alex Gaynor, he agrees to modify the max size.

comment:2 by Aymeric Augustin <aymeric.augustin@…>, 12 years ago

Resolution: fixed
Status: newclosed

In [4e1fd38bd6f007b6bb4cc57a0a841b78475a9d26]:

Fixed #18781 -- Reduced max session cookie size.

Note: See TracTickets for help on using tickets.
Back to Top