Bug 994937 - Alternating error messages (Bug object needs a bug_id/xml.parsers.expat.ExpatError: syntax error: line 1, column 49)
Alternating error messages (Bug object needs a bug_id/xml.parsers.expat.Expat...
Status: CLOSED NOTABUG
Product: Fedora EPEL
Classification: Fedora
Component: python-bugzilla (Show other bugs)
el6
Unspecified Unspecified
unspecified Severity high
: ---
: ---
Assigned To: Will Woods
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-08-08 05:29 EDT by Steve Whitehouse
Modified: 2013-08-15 12:04 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-08-15 12:04:59 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)
Bugzilla script (needs username and password to be added to make it work) (8.05 KB, text/x-python)
2013-08-08 05:29 EDT, Steve Whitehouse
no flags Details

  None (edit)
Description Steve Whitehouse 2013-08-08 05:29:42 EDT
Created attachment 784270 [details]
Bugzilla script (needs username and password to be added to make it work)

Description of problem:

After an upgrade of python-bugzilla my script fails to work with differing error messages depending upon the state of .bugzillacookies

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


[swhiteho@sts-a ~]$ rpm -qi python-bugzilla
Name        : python-bugzilla              Relocations: (not relocatable)
Version     : 0.9.0                             Vendor: Fedora Project
Release     : 1.el6                         Build Date: Wed 19 Jun 2013 01:00:14 PM CDT
Install Date: Wed 07 Aug 2013 08:29:00 AM CDT      Build Host: buildvm-16.phx2.fedoraproject.org
Group       : Development/Languages         Source RPM: python-bugzilla-0.9.0-1.el6.src.rpm
Size        : 255131                           License: GPLv2+
Signature   : RSA/8, Wed 19 Jun 2013 02:42:19 PM CDT, Key ID 3b49df2a0608b895
Packager    : Fedora Project
URL         : https://fedorahosted.org/python-bugzilla
Summary     : A python library for interacting with Bugzilla


How reproducible:

Every time

Steps to Reproduce:
1. Run my python bugzilla script
2. Receive error messages as shown below
3.

Actual results:

With .bugzillacookies existing at time of running script:

[swhiteho@sts-a ~]$ ./tasks.sh 
Traceback (most recent call last):
  File "/home/msp/swhiteho/bz.py", line 43, in <module>
    res = bz.query(q)
  File "/usr/lib/python2.6/site-packages/bugzilla/base.py", line 927, in query
    return [_Bug(bugzilla=self, dict=b) for b in r['bugs']]
  File "/usr/lib/python2.6/site-packages/bugzilla/bug.py", line 42, in __init__
    raise TypeError("Bug object needs a bug_id")
TypeError: Bug object needs a bug_id

I looked this up on google and there appeared to be a reference to this simply being a problem with .bugzillacookies, so I removed that file and then got the following error on a subsequent run:

[swhiteho@sts-a ~]$ ./tasks.sh 
Traceback (most recent call last):
  File "/home/msp/swhiteho/bz.py", line 43, in <module>
    res = bz.query(q)
  File "/usr/lib/python2.6/site-packages/bugzilla/base.py", line 925, in query
    r = self._query(query)
  File "/usr/lib/python2.6/site-packages/bugzilla/base.py", line 915, in _query
    return self._proxy.Bug.search(query)
  File "/usr/lib64/python2.6/xmlrpclib.py", line 1199, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib64/python2.6/xmlrpclib.py", line 1489, in __request
    verbose=self.__verbose
  File "/usr/lib/python2.6/site-packages/bugzilla/base.py", line 166, in request
    return self.parse_response(stringio)
  File "/usr/lib64/python2.6/xmlrpclib.py", line 1361, in parse_response
    return self._parse_response(file, None)
  File "/usr/lib64/python2.6/xmlrpclib.py", line 1387, in _parse_response
    p.feed(response)
  File "/usr/lib64/python2.6/xmlrpclib.py", line 601, in feed
    self._parser.Parse(data, 0)
xml.parsers.expat.ExpatError: syntax error: line 1, column 49

I again tried google, but it was a bit more vague. I found references to suggest that this might be bugzilla returning incorrect XML, but I'm not 100% sure of that as it all seemed a bit vague. Any ideas?

One thing which I did discover is that if I then run the script again I get the original error message. Removing .bugzillacookies again then results in the second set of error messages once more, so both seem to be easily reproducible.

Expected results:

The script should run correctly.

Additional info:

As usual I'm attaching the latest version of the script. It will need editing at the top to add a username and password in order to make it work.
Comment 1 Steve Whitehouse 2013-08-08 06:17:37 EDT
Hmm, actually I think that .bugzillacookies maybe has no effect. A few more trials show that I get one or the other message randomly.

Also, sts-b which has:

swhiteho@sts-b ~]$ rpm -qi python-bugzilla
Name        : python-bugzilla              Relocations: (not relocatable)
Version     : 0.8.0                             Vendor: Fedora Project
Release     : 2.el6                         Build Date: Mon 04 Mar 2013 03:19:22 PM CST
Install Date: Thu 30 May 2013 10:43:52 AM CDT      Build Host: buildvm-02.phx2.fedoraproject.org
Group       : Development/Languages         Source RPM: python-bugzilla-0.8.0-2.el6.src.rpm
Size        : 270437                           License: GPLv2+
Signature   : RSA/8, Fri 08 Mar 2013 07:42:39 PM CST, Key ID 3b49df2a0608b895
Packager    : Fedora Project
URL         : https://fedorahosted.org/python-bugzilla
Summary     : A python library for interacting with Bugzilla

seems to run the script without any problem
Comment 2 Cole Robinson 2013-08-15 12:04:59 EDT
There's a few things here.

The expat XML error likely means that the query is hitting rhbz's 120 second timeout, but python-bugzilla isn't raising that error correctly. This is fixed upstream, see bug 995694. But that's just error reporting.

The fact that this query is timing out means it is just too big. The search criteria means it has to search the summary and whiteboard of every bug in the database, which is pretty intensive. The more bugs that are added, the more frequently this will time out, unless RH BZ makes some improvements here. Either way that is outside the scope of python-bugzilla.

The bug_id error issue means that the lookup succeeded, but the data returned by RHBZ didn't contain a bug_id which python-bugzilla requires. This is happening because your include_fields is no longer compatible with the latest RHBZ version. 0.8.0 tried to convert that automatically but we turned that behavior off by default because we want to phase it out. You should be able to fix things by doing

q = bz.build_query(include_fields=...)

q[field-0-0-1] = ...
...

That way python-bugzilla will convert your include_fields to the values that the current bugzilla instance accepts.

Please give that a try, and reopen if you are still seeing issues.

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