2200: ReviewBoard cannot accept a new change from Perforce with a description with accent

Faller******@gmai***** (Google Code) (Is this you? Claim this profile.)
chipx86
chipx86
Feb. 18, 2012
2047
What version are you running?
1.6rc2

What's the URL of the page containing the problem?
private

What steps will reproduce the problem?
1.Trying to post-review a change from Perforce with a description with accent
2. The posting fails with a strange error message.
3.

What is the expected output? What do you see instead?
A successful posting.

What operating system are you using? What browser?
WinXP, Firefox, Perforce

Please provide any additional information below.

 If no accent the posting is OK. I suspect it is not a post-review problem, because the post-review posts only the change number. I suspect the perforce.py on the server side, but maybe I am wrong.

Part of the output with the -d option:

Microsoft Windows [Version 5.2.3790]
(C) Copyright 1985-2003 Microsoft Corp.

c:\GSDev\Main>post-review -d 111111
>>> RBTools 0.3.2
>>> Attempting to create review request on xx.graphisoft.hu:1666 for 236441
>>> HTTP POSTing to http://rr.graphisoft.hu/api/review-requests/: {'cha
ngenum': '111111', 'repository': 'xx.graphisoft.hu:1666'}
>>> Got API Error 210 (HTTP code 500): There was an error fetching extended info
rmation for this repository
>>> Error data: {u'stat': u'fail', u'err': {u'msg': u'There was an error fetchin
g extended information for this repository', u'code': 210}}
Error creating review request: There was an error fetching extended information
for this repository (HTTP 500, API Error 210)
chipx86
#1 chipx86
I'll need more info to diagnose this. Can you edit your reviewboard install's reviewboard/webapi/resources.py file, find the "create" function in ReviewRequestResource, and look for:

        except SCMError:
            return REPO_INFO_ERROR
 
Change this to:

        except SCMError, e:
            logging.error("Got SCMError when creating review request: %s" % e, exc_info=1)
            return REPO_INFO_ERROR

Then restart and try again. The log should should contain more useful information.
  • +NeedInfo
  • -Priority-Medium
    +Priority-High
    +Milestone-Release1.6.x
chipx86
#2 chipx86
  • +chipx86
#3 Faller******@gmai***** (Google Code) (Is this you? Claim this profile.)
What I found in the log was the following, I dont know is it helps or not:

Internal Server Error: /api/review-requests/
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/Django-1.3-py2.6.egg/django/core/handlers/base.py", line 178, in get_response
    response = middleware_method(request, response)
  File "/usr/local/lib/python2.6/dist-packages/Django-1.3-py2.6.egg/django/middleware/http.py", line 15, in process_response
    response['Content-Length'] = str(len(response.content))
  File "/usr/local/lib/python2.6/dist-packages/Djblets-0.6.9-py2.6.egg/djblets/webapi/core.py", line 276, in _get_content
    content = adapter.encode(self.api_data, request=self.request)
  File "/usr/local/lib/python2.6/dist-packages/Djblets-0.6.9-py2.6.egg/djblets/webapi/core.py", line 88, in encode
    return super(JSONEncoderAdapter, self).encode(o)
  File "/usr/lib/python2.6/json/encoder.py", line 367, in encode
    chunks = list(self.iterencode(o))
  File "/usr/lib/python2.6/json/encoder.py", line 309, in _iterencode
    for chunk in self._iterencode_dict(o, markers):
  File "/usr/lib/python2.6/json/encoder.py", line 275, in _iterencode_dict
    for chunk in self._iterencode(value, markers):
  File "/usr/lib/python2.6/json/encoder.py", line 317, in _iterencode
    for chunk in self._iterencode_default(o, markers):
  File "/usr/lib/python2.6/json/encoder.py", line 309, in _iterencode
    for chunk in self._iterencode_dict(o, markers):
  File "/usr/lib/python2.6/json/encoder.py", line 275, in _iterencode_dict
    for chunk in self._iterencode(value, markers):
  File "/usr/lib/python2.6/json/encoder.py", line 294, in _iterencode
    yield encoder(o)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xf3 in position 10: invalid continuation byte
#4 Faller******@gmai***** (Google Code) (Is this you? Claim this profile.)
Now I am sure that there are two errors here. One with the ChangeNumberInUseError, and one with international characters in the Perforce description.
Now I can reconstruct the history around this bug:
 - We tried to post-review a change with international characters but we failed by Unicode problems.
 - Then we re-try the post-review and consistently failed with the mysterious SCMError error I entered originally.
 - I entered the bug into the tracker. You suggested me the patch for better error reporting. I applied the patch and tried another post-review. Then I hit and reported the Unicode problem again (see comment 3)
 - Now I hit the SCMError again, and with your patch I located the better error reporting in the log.
Here it is:
Got SCMError when creating review request: None
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/ReviewBoard-1.6rc2-py2.6.egg/reviewboard/webapi/resources.py", line 5657, in create
    changenum, local_site)
  File "/usr/local/lib/python2.6/dist-packages/ReviewBoard-1.6rc2-py2.6.egg/reviewboard/reviews/managers.py", line 96, in create
    raise ChangeNumberInUseError(review_request)
ChangeNumberInUseError: None

But to tell the truth, seeing the code I don't understand what is the problem.
Please fix both problems!

#5 Faller******@gmai***** (Google Code) (Is this you? Claim this profile.)
I missed to mention that we really tried to upload the same change twice. But the error message about the extended information misleading and not helpful.