Modify

Opened 5 years ago

Closed 4 years ago

#5148 closed defect (fixed)

[Patch] Traceback from logging module when log is empty

Reported by: ebray Owned by: osimons
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 techtonik 5 years ago.
patch to fix this issue - add check for empty buffer

Download all attachments as: .zip

Change History (6)

Changed 5 years ago by techtonik

patch to fix this issue - add check for empty buffer

comment:1 Changed 4 years ago by rjollos

  • Summary changed from Traceback from logging module when log is empty to [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 4 years ago by rjollos

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

comment:3 Changed 4 years ago by rjollos

  • Owner changed from athomas to coderanger

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 4 years ago by osimons

  • Owner changed from coderanger to osimons

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

comment:5 Changed 4 years ago by osimons

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

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

Add Comment

Modify Ticket

Action
as closed .
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from osimons. Next status will be 'closed'.
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.