4438: sending emails fails with excessively large number of files


What version are you running?

What steps will reproduce the problem?

(This problem is admittedly unlikely to happen with anything other than reviewing autogenerated code.)
1. File a review request with 400 files with file names with ~100 charcter names
2. Publish review request
3. Fail to receive email and note server log

What is the expected output? What do you see instead?

The size is pathologically large since
File "/scr/rb/lib/python2.7/site-packages/reviewboard/notifications/email.py", line 694, in send_review_mail
File "/scr/rb/lib/python2.7/site-packages/django/core/mail/message.py", line 276, in send
return self.get_connection(fail_silently).send_messages([self])
File "/scr/rb/lib/python2.7/site-packages/django/core/mail/backends/smtp.py", line 94, in send_messages
sent = self._send(message)
File "/scr/rb/lib/python2.7/site-packages/django/core/mail/backends/smtp.py", line 110, in _send
self.connection.sendmail(from_email, recipients, message.as_bytes())
File "/usr/lib64/python2.7/smtplib.py", line 720, in sendmail
raise SMTPDataError(code, resp)
SMTPDataError: (552, '5.6.0 Headers too large (32768 max)')

What operating system are you using? What browser?

centos 7, sendmail

Please provide any additional information below.

The header file is large since we add:

  • X-ReviewBoard-Diff-For : full/path/to/filename

for each file

Obviously it's not possible for a human to meaningfully review all these files but the default MaxHeaderSize for sendmail on redhat systems is 32768 and may be different for other mail servers. It might make sense to truncate including filenames in headers of there is a large number of files.

#1 david
  • +Component:EMail
#2 totoroliu

I created a pull-request to disable "X-ReviewBoard-Diff-For" line to fix this issue:

#3 brennie
  • +DanielPBak
#4 david

Fixed in release-2.5.x (5e19619). This will ship in 2.5.12. Thanks!

  • -New