Bug 1316045 - INTERNAL SERVER ERROR while reading job results in junit format
INTERNAL SERVER ERROR while reading job results in junit format
Status: CLOSED CURRENTRELEASE
Product: Beaker
Classification: Community
Component: reports (Show other bugs)
22
Unspecified Unspecified
unspecified Severity urgent (vote)
: 22.3
: ---
Assigned To: matt jia
tools-bugs
: Patch
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2016-03-09 05:20 EST by Linqing Lu
Modified: 2016-04-04 01:34 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-04-04 01:34:57 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Linqing Lu 2016-03-09 05:20:31 EST
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 18:41:47 EST
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 18:43:04 EST
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-09 23:30:38 EST
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 02:03:28 EST
(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 02:26:45 EDT
please feel free to reach me if more samples needed to verify this fix.
Comment 6 matt jia 2016-03-17 02:31:55 EDT
(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 01:34:57 EDT
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.