Create bug link is failing for python tracebacks

Bug #1322325 reported by Brian Murray on 2014-05-22
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Errors
High
Unassigned

Bug Description

This may be the same issue as bug 1197186. Clicking the Create link on the following OOPS will create an error.

http://errors.ubuntu.com/problem/9b006966434c4db556a21641f728a6ef31553a9f

Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/tastypie/resources.py", line 196, in wrapper
    response = callback(request, *args, **kwargs)
  File "/usr/lib/pymodules/python2.7/tastypie/resources.py", line 421, in dispatch_list
    return self.dispatch('list', request, **kwargs)
  File "/var/www/errors/errors/metrics.py", line 40, in wrapper
    result = view(*args, **kwargs)
  File "/var/www/errors/errors/api/resources.py", line 86, in dispatch
    return Resource.dispatch(self, *args, **kwargs)
  File "/usr/lib/pymodules/python2.7/tastypie/resources.py", line 454, in dispatch
    response = method(request, **kwargs)
  File "/usr/lib/pymodules/python2.7/tastypie/resources.py", line 1235, in post_list
    deserialized = self.deserialize(request, request.raw_post_data, format=request.META.get('CONTENT_TYPE', 'application/json'))
  File "/usr/lib/pymodules/python2.7/tastypie/resources.py", line 370, in deserialize
    deserialized = self._meta.serializer.deserialize(data, format=request.META.get('CONTENT_TYPE', 'application/json'))
  File "/usr/lib/pymodules/python2.7/tastypie/serializers.py", line 194, in deserialize
    deserialized = getattr(self, "from_%s" % desired_format)(content)
  File "/usr/lib/pymodules/python2.7/tastypie/serializers.py", line 344, in from_json
    return simplejson.loads(content)
  File "/usr/lib/python2.7/dist-packages/simplejson/__init__.py", line 413, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python2.7/dist-packages/simplejson/decoder.py", line 402, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python2.7/dist-packages/simplejson/decoder.py", line 418, in raw_decode
    obj, end = self.scan_once(s, idx)
JSONDecodeError: Invalid control character at: line 1 column 49 (char 49)

I'm pretty sure this has to do with the format of bucket / signature from errors/templates/bucket.html which is passed to errors/api/resources.py.

This also happens on the main page (https://errors.ubuntu.com/?release=Ubuntu%2014.10&package=ubuntu-release-upgrader&period=day) when you click create bug for the same bug report.

Related branches

Brian Murray (brian-murray) wrote :

The main page just uses the function from the json data so in this particular case it is:

"function": "Traceback (most recent call last):\n File \"/usr/lib/ubuntu-release-upgrader/do-partial-upgrade\", line 105, in <module>\n controller.doPartialUpgrade()\n File \"/usr/lib/python3/dist-packages/DistUpgrade/DistUpgradeController.py\", line 1846, in doPartialUpgrade\n if not self.doPostUpgrade():\n File \"/usr/lib/python3/dist-packages/DistUpgrade/DistUpgradeController.py\", line 1249, in doPostUpgrade\n remove_candidates = now_obsolete - self.obsolete_pkgs\nTypeError: unsupported operand type(s) for -: 'set' and 'list'\n",

I'd guess it is the carriage returns causing an issue.

Changed in errors:
importance: Undecided → High
Brian Murray (brian-murray) wrote :

I dig into this a bunch today, and while I've resolved the issue in my testing environment and created bug 1632842 the tile of the bug is quite a mouthful.

This is because the title of the bug ends up using the signature, which in the Error Tracker is the whole traceback.

apport has a standard_title function in apport/report.py and that would be an improvement but that requires ExecutablePath which isn't in the metadata table which is used to create the report.

Changed in errors:
status: New → Triaged
Brian Murray (brian-murray) wrote :

I've fixed the original issue documented in this bug, Invalid control character, in r574 of errors by using encodeURIComponent to pass the signature to the create-bug API and then unquoting the signature in that API call.

As an interim solution to the long bug title I've committed r721 of daisy which uses the source package name and the last line of the Traceback for the bug title. Certainly, using standard_title from apport would be better but this'll help in the interim.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers