Code

#18781 closed Cleanup/optimization (fixed)

FallbackStorage fails its purpose with uwsgi's default settings

Reported by: aaugustin Owned by: nobody
Component: contrib.messages Version: master
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

Description

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.

Unfortunately:

  • 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.

Attachments (0)

Change History (2)

comment:1 Changed 20 months ago by aaugustin

  • Triage Stage changed from Unreviewed to Accepted

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

comment:2 Changed 20 months ago by Aymeric Augustin <aymeric.augustin@…>

  • Resolution set to fixed
  • Status changed from new to closed

In [4e1fd38bd6f007b6bb4cc57a0a841b78475a9d26]:

Fixed #18781 -- Reduced max session cookie size.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.