Bug 1316045 - INTERNAL SERVER ERROR while reading job results in junit format
Summary: INTERNAL SERVER ERROR while reading job results in junit format
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Beaker
Classification: Retired
Component: reports
Version: 22
Hardware: Unspecified
OS: Unspecified
unspecified
urgent
Target Milestone: 22.3
Assignee: matt jia
QA Contact: tools-bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-03-09 10:20 UTC by Linqing Lu
Modified: 2016-04-04 05:34 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-04-04 05:34:57 UTC
Embargoed:


Attachments (Terms of Use)

Description Linqing Lu 2016-03-09 10:20:31 UTC
Description of problem:
We got constant error today when retrieving certain beaker job result in junit format:
    $ bkr job-results --format junit-xml J:1256877
    HTTP error: 500 Server Error: INTERNAL SERVER ERROR for url: https://beaker.engineering.redhat.com/jobs/1256877.junit.xml
However `bkr job-results J:1256877` works without problem. And some other jobs worked well in either way (e.g J:1244773).

Version-Release number of selected component (if applicable):
22.1

How reproducible:
always

Steps to Reproduce:
1. run `bkr job-results --format junit-xml` against existing beaker job, e.g. J:1256877
2. 
3.

Actual results:
HTTP error: 500 Server Error: INTERNAL SERVER ERROR for url: https://beaker.engineering.redhat.com/jobs/1256877.junit.xml

Expected results:
returns job results in junit format 

Additional info:
This problem is failing major number of jobs on Platform Jenkins from analyzing/reporting correct testing results.

Comment 1 Dan Callaghan 2016-03-09 23:41:47 UTC
Sorry about this, the new JUnit XML export is obviously not as well battle-tested as the regular results XML export...

Traceback is:

Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/flask/app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/lib/python2.6/site-packages/flask/app.py", line 1477, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/lib/python2.6/site-packages/flask/app.py", line 1381, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/lib/python2.6/site-packages/flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/lib/python2.6/site-packages/flask/app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/lib/python2.6/site-packages/bkr/server/jobs.py", line 1068, in job_junit_xml
    response = make_response(to_junit_xml(job))
  File "/usr/lib/python2.6/site-packages/bkr/server/junitxml.py", line 63, in to_junit_xml
    testsuite.extend(_testcases_for_task(task))
  File "lxml.etree.pyx", line 682, in lxml.etree._Element.extend (src/lxml/lxml.etree.c:31838)
  File "/usr/lib/python2.6/site-packages/bkr/server/junitxml.py", line 41, in _testcases_for_task
    time='%.0f' % total_seconds(result.duration))
  File "/usr/lib/python2.6/site-packages/bkr/server/model/scheduler.py", line 3704, in duration
    return self.start_time - self.recipetask.start_time
TypeError: unsupported operand type(s) for -: 'datetime.datetime' and 'NoneType'

Comment 2 Dan Callaghan 2016-03-09 23:43:04 UTC
This will happen on recipes where some tasks never started, either because the recipe was cancelled or it was aborted by the external watchdog (as in this case).

Comment 3 matt jia 2016-03-10 04:30:38 UTC
On Gerrit:

  http://gerrit.beaker-project.org/#/c/4728/

I guess this can go to beaker 22.3 if we have other stuffs that need to be released before beaker 23.

Comment 4 Linqing Lu 2016-03-10 07:03:28 UTC
(In reply to Dan Callaghan from comment #1)
> Sorry about this, the new JUnit XML export is obviously not as well
> battle-tested as the regular results XML export...

Thanks for quick investment/fix!

It's a nice feature since its output can be consumed directly by Jenkins junit plugin.
Previously we had to use a 3rd-party converter to translate regular XML to xunit (and lost a lot of extra info like log links).

Looking forward to having this fix asap.

Comment 5 Linqing Lu 2016-03-17 06:26:45 UTC
please feel free to reach me if more samples needed to verify this fix.

Comment 6 matt jia 2016-03-17 06:31:55 UTC
(In reply to Linqing Lu from comment #4)
> (In reply to Dan Callaghan from comment #1)
> > Sorry about this, the new JUnit XML export is obviously not as well
> > battle-tested as the regular results XML export...
> 
> Thanks for quick investment/fix!
> 
> It's a nice feature since its output can be consumed directly by Jenkins
> junit plugin.
> Previously we had to use a 3rd-party converter to translate regular XML to
> xunit (and lost a lot of extra info like log links).
> 
> Looking forward to having this fix asap.

Thank you for your patient, we will get this fix out of the door asap.

Comment 9 Roman Joost 2016-04-04 05:34:57 UTC
Beaker 22.3 has been released. Release Notes can be found here: https://beaker-project.org/docs/whats-new/release-22.html#beaker-22-3


Note You need to log in before you can comment on or make changes to this bug.