Opened 9 years ago
Closed 9 years ago
#27287 closed Bug (duplicate)
IndexError in logging on runserver broken pipe error
| Reported by: | Sjoerd Job Postmus | Owned by: | nobody |
|---|---|---|---|
| Component: | Utilities | Version: | 1.10 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description (last modified by )
In WSGIServer.handle_error, on a broken pipe, it calls logger.info with 2 arguments: a format and an address.
This uses the ServerFormatter, which expects either 0 or >= 2 args.
Traceback (most recent call last):
File "/usr/lib/python2.7/logging/__init__.py", line 851, in emit
msg = self.format(record)
File "/usr/lib/python2.7/logging/__init__.py", line 724, in format
return fmt.format(record)
File "/.../django/utils/log.py", line 173, in format
if args[1][0] == '2':
IndexError: tuple index out of range
Logged from file basehttp.py, line 85
I think a good fix might be to make it check against len(args) < 2 instead of len(args) == 0.
While the code is being touched, it might also be a good idea to write status_code = args[1], and use that in the if-chain.
Change History (2)
comment:1 by , 9 years ago
| Component: | Uncategorized → Utilities |
|---|---|
| Description: | modified (diff) |
| Summary: | IndexError on broken pipe → IndexError in logging on runserver broken pipe error |
comment:2 by , 9 years ago
| Resolution: | → duplicate |
|---|---|
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Duplicate of #27271.