3555: ExpatError: not well-formed (invalid token) when browsing to review

mam****@gmai***** (Google Code) (Is this you? Claim this profile.)
Jan. 2, 2015
What version are you running?
2.0.6

What's the URL of the page containing the problem?
internal URL in our company
http://bld-rb01.cisco.com/r/10588/

What steps will reproduce the problem?
1. User updates the review description and paste test info into description.
2. Next the user goes back into the review and receives Error 500


What is the expected output? What do you see instead?
The user is unable to go back into that review request - always crashes - This should not happen no mater what was pasted into the description.


What operating system are you using? What browser?
Linux - Red Hat Enterprise 5.5

Please provide any additional information below.

For a quick patch to get around this problem so the user can get back in and look at the review I did a quick patch but It may not be that great of a patch.
In reviewboard/reviews/markdown_utils.py
In the get_markdown_element_tree I put a try, except around the parseString to return a empty list.  This is a temporary fix for our production site.

    try:
        doc = parseString(b'<html>%s</html>' % markdown_html)
    except:
        return list()
    return doc.childNodes[0].childNodes


Traceback (most recent call last):

  File "/local/ichnaea_conf/site/python_ve/reviewboard_v2.0/lib/python2.7/site-packages/Django-1.6.6-py2.7.egg/django/core/handlers/base.py", line 112, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)

  File "/local/ichnaea_conf/site/python_ve/reviewboard_v2.0/lib/python2.7/site-packages/ReviewBoard-2.0.6-py2.7.egg/reviewboard/accounts/decorators.py", line 21, in _check
    return login_required(view_func)(*args, **kwargs)

  File "/local/ichnaea_conf/site/python_ve/reviewboard_v2.0/lib/python2.7/site-packages/Django-1.6.6-py2.7.egg/django/contrib/auth/decorators.py", line 22, in _wrapped_view
    return view_func(request, *args, **kwargs)

  File "/local/ichnaea_conf/site/python_ve/reviewboard_v2.0/lib/python2.7/site-packages/ReviewBoard-2.0.6-py2.7.egg/reviewboard/site/decorators.py", line 35, in _check
    return view_func(request, local_site=local_site, *args, **kwargs)

  File "/local/ichnaea_conf/site/python_ve/reviewboard_v2.0/lib/python2.7/site-packages/ReviewBoard-2.0.6-py2.7.egg/reviewboard/reviews/views.py", line 660, in review_detail
    changedesc.fields_changed[field_id])

  File "/local/ichnaea_conf/site/python_ve/reviewboard_v2.0/lib/python2.7/site-packages/ReviewBoard-2.0.6-py2.7.egg/reviewboard/reviews/fields.py", line 159, in get_change_entry_sections_html
    'rendered_html': mark_safe(self.render_change_entry_html(info)),

  File "/local/ichnaea_conf/site/python_ve/reviewboard_v2.0/lib/python2.7/site-packages/ReviewBoard-2.0.6-py2.7.egg/reviewboard/reviews/fields.py", line 486, in render_change_entry_html
    old_lines = list(iter_markdown_lines(old_value))

  File "/local/ichnaea_conf/site/python_ve/reviewboard_v2.0/lib/python2.7/site-packages/ReviewBoard-2.0.6-py2.7.egg/reviewboard/reviews/markdown_utils.py", line 146, in iter_markdown_lines
    nodes = get_markdown_element_tree(markdown_html)

  File "/local/ichnaea_conf/site/python_ve/reviewboard_v2.0/lib/python2.7/site-packages/ReviewBoard-2.0.6-py2.7.egg/reviewboard/reviews/markdown_utils.py", line 199, in get_markdown_element_tree
    doc = parseString(b'<html>%s</html>' % markdown_html)

  File "/local/releng/pkgs/python-v2.7.8s/lib/python2.7/xml/dom/minidom.py", line 1928, in parseString
    return expatbuilder.parseString(string)

  File "/local/releng/pkgs/python-v2.7.8s/lib/python2.7/xml/dom/expatbuilder.py", line 940, in parseString
    return builder.parseString(string)

  File "/local/releng/pkgs/python-v2.7.8s/lib/python2.7/xml/dom/expatbuilder.py", line 223, in parseString
    parser.Parse(string, True)

ExpatError: not well-formed (invalid token): line 39, column 9


<WSGIRequest
path:/r/10588/,
GET:<QueryDict: {}>,
POST:<QueryDict: {}>,
COOKIES:{'CP_GUTC': '173.36.27.119.1406106611977745',
 'ObSSOCookie': 'IQvg8PhWbpJ6lwqDzArz6TNakviJHeuLp13B3l5stEIq1J%2FmCEjoCdG0uhEHMzJ05jvSkU%2FeLMY6MgNXuYl%2FPdGURRfrf6j3vnzpVX2eqeRovaBrXwsIQ5aY3Qj2Sv0m8TjKkKyKnCiUl42GUhcAqr1O9vZVGMr0uTozR%2Fj4ouQi9zwLW13st3Z%2FPPfoR4vsts0%2BU4OsGfQ3NQafQYjdp58o2%2FgNGJHvxF1aav9IIRXqm9W0mpPoDr12WmMTdVoV7tRxUu1Viz3N1dTbUJ7UMYfbmIzTN1ly4XxSPzB3gF45rhof2BYOn0QrAmKQ9S5GtMay1%2Bbj09uBdasCaui8GCFpe4Y4pPSPnhlU0zX4vBU%3D',
 'VISITORID': '974852090',
 '__unam': '1119172-147e933e990-1b78c140-8',
 '_ga': 'GA1.2.143604190.1408366799',
 '_mkto_trk': 'id:564-WHV-323&token:_mch-cisco.com-1409435318360-45002',
 'cec_cn': 'amkuma4',
 'cec_user_id': 'amkuma4',
 'collapsediffs': 'True',
 'csrftoken': '8tmJL9SJwhz8zlHvxTGRJdfPQ02T3gQ5',
 'mbox': 'PC#1409602589456-384413.22_02#1410944031|check#true#1409734491|session#1409734430293-155290#1409736291',
 'rbsessionid': '1qrx0jsmdo4184zlgyu9b5zj4lhz1np8',
 's_nr': '1409824685030-Repeat',
 'v1st': 'F5C8ECE203C99D46'},
META:{'DOCUMENT_ROOT': '/local/ichnaea_conf/www/bld-rb01/htdocs',
 'GATEWAY_INTERFACE': 'CGI/1.1',
 'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
 'HTTP_ACCEPT_ENCODING': 'gzip,deflate,sdch',
 'HTTP_ACCEPT_LANGUAGE': 'en-US,en;q=0.8',
 'HTTP_CONNECTION': 'keep-alive',
 'HTTP_COOKIE': 'CP_GUTC=173.36.27.119.1406106611977745; v1st=F5C8ECE203C99D46; _mkto_trk=id:564-WHV-323&token:_mch-cisco.com-1409435318360-45002; __unam=1119172-147e933e990-1b78c140-8; _ga=GA1.2.143604190.1408366799; VISITORID=974852090; csrftoken=8tmJL9SJwhz8zlHvxTGRJdfPQ02T3gQ5; rbsessionid=1qrx0jsmdo4184zlgyu9b5zj4lhz1np8; mbox=PC#1409602589456-384413.22_02#1410944031|check#true#1409734491|session#1409734430293-155290#1409736291; cec_user_id=amkuma4; cec_cn=amkuma4; s_nr=1409824685030-Repeat; ObSSOCookie=IQvg8PhWbpJ6lwqDzArz6TNakviJHeuLp13B3l5stEIq1J%2FmCEjoCdG0uhEHMzJ05jvSkU%2FeLMY6MgNXuYl%2FPdGURRfrf6j3vnzpVX2eqeRovaBrXwsIQ5aY3Qj2Sv0m8TjKkKyKnCiUl42GUhcAqr1O9vZVGMr0uTozR%2Fj4ouQi9zwLW13st3Z%2FPPfoR4vsts0%2BU4OsGfQ3NQafQYjdp58o2%2FgNGJHvxF1aav9IIRXqm9W0mpPoDr12WmMTdVoV7tRxUu1Viz3N1dTbUJ7UMYfbmIzTN1ly4XxSPzB3gF45rhof2BYOn0QrAmKQ9S5GtMay1%2Bbj09uBdasCaui8GCFpe4Y4pPSPnhlU0zX4vBU%3D; collapsediffs=True',
 'HTTP_HOST': 'bld-rb01.cisco.com',
 'HTTP_REFERER': 'http://bld-rb01.cisco.com/dashboard/?view=outgoing',
 'HTTP_USER_AGENT': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.143 Safari/537.36',
 'PATH_INFO': u'/r/10588/',
 'PATH_TRANSLATED': '/local/ichnaea_conf/www/bld-rb01/htdocs/reviewboard.wsgi/r/10588/',
 'QUERY_STRING': '',
 'REMOTE_ADDR': '10.77.236.150',
 'REMOTE_PORT': '62275',
 'REQUEST_METHOD': 'GET',
 'REQUEST_URI': '/r/10588/',
 'SCRIPT_FILENAME': '/local/ichnaea_conf/www/bld-rb01/htdocs/reviewboard.wsgi',
 'SCRIPT_NAME': u'',
 'SERVER_ADDR': '10.22.27.98',
 'SERVER_ADMIN': 'ichnaea@cisco.com',
 'SERVER_NAME': 'bld-rb01.cisco.com',
 'SERVER_PORT': '80',
 'SERVER_PROTOCOL': 'HTTP/1.1',
 'SERVER_SIGNATURE': '',
 'SERVER_SOFTWARE': 'Apache/2.2.27 (Unix) mod_ssl/2.2.27 OpenSSL/0.9.8za DAV/2 mod_wsgi/4.2.8 Python/2.7.8',
 'UNIQUE_ID': 'VAlUlAoWG2IAAG6nKeYAAAAI',
 'apache.version': (2, 2, 27),
 'mod_wsgi.application_group': 'releng16.cisco.com|',
 'mod_wsgi.callable_object': 'application',
 'mod_wsgi.enable_sendfile': '0',
 'mod_wsgi.handler_script': '',
 'mod_wsgi.input_chunked': '0',
 'mod_wsgi.listener_host': '',
 'mod_wsgi.listener_port': '80',
 'mod_wsgi.process_group': '',
 'mod_wsgi.request_handler': 'wsgi-script',
 'mod_wsgi.request_start': '1409897620481888',
 'mod_wsgi.script_reloading': '1',
 'mod_wsgi.script_start': '1409897620482166',
 'mod_wsgi.version': (4, 2, 8),
 'wsgi.errors': <mod_wsgi.Log object at 0x2b9d9d741a08>,
 'wsgi.file_wrapper': <type 'mod_wsgi.FileWrapper'>,
 'wsgi.input': <mod_wsgi.Input object at 0x2b9d9c13d430>,
 'wsgi.multiprocess': True,
 'wsgi.multithread': False,
 'wsgi.run_once': False,
 'wsgi.url_scheme': 'http',
 'wsgi.version': (1, 0)}>
chipx86
#1 chipx86
Would it be possible to get a copy of some text that's causing the breakage? You can send it to us privately at support@beanbaginc.com.
  • +NeedInfo
david
#2 david
This is already fixed in git and will ship in 2.0.12
  • -NeedInfo
    +Fixed
#3 mam****@gmai***** (Google Code) (Is this you? Claim this profile.)
I am still getting this error with 2.0.12 or something similar.  This is the error now.

2015-01-12 15:33:50,719 - ERROR -  - Exception thrown for user mamiles at https://bld-rb01.cisco.com/r/13072/

unsupported operand type(s) for +=: 'instance' and 'int'
Traceback (most recent call last):
  File "/local/ichnaea_conf/site/python_ve/reviewboard_v2.0/lib/python2.7/site-packages/Django-1.6.9-py2.7.egg/django/core/handlers/bas
e.py", line 112, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/local/ichnaea_conf/site/python_ve/reviewboard_v2.0/lib/python2.7/site-packages/ReviewBoard-2.0.12-py2.7.egg/reviewboard/accoun
ts/decorators.py", line 21, in _check
    return login_required(view_func)(*args, **kwargs)
  File "/local/ichnaea_conf/site/python_ve/reviewboard_v2.0/lib/python2.7/site-packages/Django-1.6.9-py2.7.egg/django/contrib/auth/deco
rators.py", line 22, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/local/ichnaea_conf/site/python_ve/reviewboard_v2.0/lib/python2.7/site-packages/ReviewBoard-2.0.12-py2.7.egg/reviewboard/site/d
ecorators.py", line 35, in _check
    return view_func(request, local_site=local_site, *args, **kwargs)
  File "/local/ichnaea_conf/site/python_ve/reviewboard_v2.0/lib/python2.7/site-packages/ReviewBoard-2.0.12-py2.7.egg/reviewboard/review
s/views.py", line 663, in review_detail
    changedesc.fields_changed[field_id])
  File "/local/ichnaea_conf/site/python_ve/reviewboard_v2.0/lib/python2.7/site-packages/ReviewBoard-2.0.12-py2.7.egg/reviewboard/reviews/fields.py", line 161, in get_change_entry_sections_html
    'rendered_html': mark_safe(self.render_change_entry_html(info)),
  File "/local/ichnaea_conf/site/python_ve/reviewboard_v2.0/lib/python2.7/site-packages/ReviewBoard-2.0.12-py2.7.egg/reviewboard/reviews/fields.py", line 514, in render_change_entry_html
    new_lines = list(iter_markdown_lines(new_value))
  File "/local/ichnaea_conf/site/python_ve/reviewboard_v2.0/lib/python2.7/site-packages/ReviewBoard-2.0.12-py2.7.egg/reviewboard/reviews/markdown_utils.py", line 241, in iter_markdown_lines
    i += 1
TypeError: unsupported operand type(s) for +=: 'instance' and 'int'
#4 mam****@gmai***** (Google Code) (Is this you? Claim this profile.)
I am going to open a new issue since this one is closed.