#1635 Apparently using LOG.exception here raises another exception.
Merged by pingou. Opened by pingou.
fix_mk  into  master

Download 1635.patch

So demoting to use LOG.debug instead of LOG.exception.

The error has been reported by email and this fix has been tested and
does solve the issue (although, it's an odd one, granted).

rebased

Out of curiosity, what's the exception it raises?

This is the end of the stack-trace:

  File "/usr/lib/python2.7/site-packages/pagure/ui/filters.py", line 367, in markdown_filter
    return pagure.lib.text2markdown(text)
  File "/usr/lib/python2.7/site-packages/pagure/lib/__init__.py", line 2980, in text2markdown
    LOG.exception(text)
  File "/usr/lib64/python2.7/logging/__init__.py", line 1182, in exception
    self.error(msg, *args, **kwargs)
  File "/usr/lib64/python2.7/logging/__init__.py", line 1175, in error
    self._log(ERROR, msg, args, **kwargs)
  File "/usr/lib64/python2.7/logging/__init__.py", line 1268, in _log
    self.handle(record)
  File "/usr/lib64/python2.7/logging/__init__.py", line 1278, in handle
    self.callHandlers(record)
  File "/usr/lib64/python2.7/logging/__init__.py", line 1318, in callHandlers
    hdlr.handle(record)
  File "/usr/lib64/python2.7/logging/__init__.py", line 745, in handle
    rv = self.filter(record)
  File "/usr/lib64/python2.7/logging/__init__.py", line 608, in filter
    if not f.filter(record):
  File "/usr/lib/python2.7/site-packages/pagure/mail_logging.py", line 90, in filter
    record.callstack = self.format_callstack()
  File "/usr/lib/python2.7/site-packages/pagure/mail_logging.py", line 121, in format_callstack
    for ind, frame in enumerate(f[0] for f in inspect.stack()):
  File "/usr/lib64/python2.7/inspect.py", line 1054, in stack
    return getouterframes(sys._getframe(1), context)
  File "/usr/lib64/python2.7/inspect.py", line 1032, in getouterframes
    framelist.append((frame,) + getframeinfo(frame, context))
  File "/usr/lib64/python2.7/inspect.py", line 1007, in getframeinfo
    lines, lnum = findsource(frame)
  File "/usr/lib64/python2.7/inspect.py", line 580, in findsource
    if pat.match(lines[lnum]): break
IndexError: list index out of range

Oh, that's quite interesting. This looks like a bug in the standard library's inspect module. Is it possible that the Python files changed on disk, but Apache wasn't restarted or something?

Possible but I kinda doubt it, since I could replicate the issue here quite easily and I was restarting apache in between (to ensure the code was reloaded)

A final thought on this on?

Sorry, I meant to follow up here and clearly forgot.

It might be worth seeing if you can come up with a small reproducer and check if this is still a thing that happens in the latest Python, but as for the PR itself, it's fine. :thumbsup:

So, for the record, the error occurred on the page: https://pagure.io/pungi-fedora/pull-request/103

rebased

I added the link to the PR that triggered the bug in case we want to try making that reproducer.

For now I'm going to merge this PR.

If you have the time and will @jcline feel free to poke at the reproducer, otherwise, we'll see as time allows :)

Pull-Request has been merged by pingou

Metadata