Modify

Opened 9 years ago

Closed 8 years ago

#5148 closed defect (fixed)

[Patch] Traceback from logging module when log is empty

Reported by: Erik M. Bray Owned by: Odd Simon Simonsen
Priority: normal Component: TracDeveloperPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11

Description

Immediately after enabling the developer plugin in a particular environment I started getting an IndexError with this traceback on every page:

File "/usr/local/lib/python2.5/site-packages/trac/web/main.py", line 438, in _dispatch_request
  dispatcher.dispatch(req)
File "/usr/local/lib/python2.5/site-packages/trac/web/main.py", line 230, in dispatch
  data, content_type)
File "/usr/local/lib/python2.5/site-packages/trac/web/chrome.py", line 745, in render_template
  stream.render(method, doctype=doctype, out=buffer)
File "/usr/local/lib/python2.5/site-packages/genshi/core.py", line 179, in render
  return encode(generator, method=method, encoding=encoding, out=out)
File "/usr/local/lib/python2.5/site-packages/genshi/output.py", line 61, in encode
  for chunk in iterator:
File "/usr/local/lib/python2.5/site-packages/genshi/output.py", line 311, in __call__
  for kind, data, pos in stream:
File "/usr/local/lib/python2.5/site-packages/genshi/output.py", line 753, in __call__
  for kind, data, pos in stream:
File "/usr/local/lib/python2.5/site-packages/genshi/output.py", line 592, in __call__
  for kind, data, pos in stream:
File "/usr/local/lib/python2.5/site-packages/genshi/output.py", line 698, in __call__
  for kind, data, pos in chain(stream, [(None, None, None)]):
File "/usr/local/lib/python2.5/site-packages/genshi/output.py", line 532, in __call__
  for ev in stream:
File "/usr/local/lib/python2.5/site-packages/genshi/core.py", line 283, in _ensure
  for event in stream:
File "/usr/local/lib/python2.5/site-packages/genshi/core.py", line 283, in _ensure
  for event in stream:
File "/usr/local/lib/python2.5/site-packages/trac/web/chrome.py", line 811, in _strip_accesskeys
  for kind, data, pos in stream:
File "/usr/local/lib/python2.5/site-packages/genshi/core.py", line 283, in _ensure
  for event in stream:
File "/usr/local/lib/python2.5/site-packages/trac/web/chrome.py", line 800, in _generate
  for kind, data, pos in stream:
File "/usr/local/lib/python2.5/site-packages/genshi/core.py", line 283, in _ensure
  for event in stream:
File "/usr/local/lib/python2.5/site-packages/genshi/core.py", line 283, in _ensure
  for event in stream:
File "/mnt/hgfs/home/Source/tracdeveloperplugin/trunk/tracdeveloper/log.py", line 64, in fn
  first_time = req._tracdeveloper_hdlr.buf[0].created

Eventually I realized that it was because nothing was coming up in the log during that request (as the log level was set to WARNING). Clearly this feature was meant to be used with the log level set to DEBUG, which would make sense for development purposes. But this bit me by trying to use the plugin in an environment where DEBUG would not be the default.

Perhaps the log module should itself log a warning if the log level is set above DEBUG.

Attachments (1)

5148.empty_log.diff (640 bytes) - added by anatoly techtonik 8 years ago.
patch to fix this issue - add check for empty buffer

Download all attachments as: .zip

Change History (6)

Changed 8 years ago by anatoly techtonik

Attachment: 5148.empty_log.diff added

patch to fix this issue - add check for empty buffer

comment:1 Changed 8 years ago by Ryan J Ollos

Summary: Traceback from logging module when log is empty[Patch] Traceback from logging module when log is empty

I have also been seeing this issue. Thank you for the patch and explanation of the cause of the issue.

comment:2 Changed 8 years ago by Ryan J Ollos

Specifically, I think this was the cause of #6483.

comment:3 Changed 8 years ago by Ryan J Ollos

Owner: changed from Alec Thomas to Noah Kantrowitz

Question to plugin maintainer: do you have any objections to applying this patch? If it is just a matter of not having time to do it, I would be happy to take care of the issue given write access to the repository.

Thanks.

comment:4 Changed 8 years ago by Odd Simon Simonsen

Owner: changed from Noah Kantrowitz to Odd Simon Simonsen

Makes sense. I'll look at it and commit.

comment:5 Changed 8 years ago by Odd Simon Simonsen

Resolution: fixed
Status: newclosed

(In [7968]) TracDeveloperPlugin: Gracefully handle empty log. Closes #5148. Thanks for report and patch.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Odd Simon Simonsen.
The resolution will be deleted.

Add Comment


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

 
Note: See TracTickets for help on using tickets.