Ticket #2206 (closed defect: fixed)
Change Hooks always return a HTTP 500 error
| Reported by: | kalessin | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | undecided |
| Version: | master | Keywords: | master, status, web, change_hook |
| Cc: |
Description
Hello,
I recently added support for the Google Code webhook in buildbot's change_hooks.
But I noticed that even when the Google POST request is correctly parsed (and the changes correctly returned to buildbot.status.web.change_hook.ChangeHookResource.getChanges), buildbot was returning a 500 error to Google Code (then Google Code resubmits the request which triggers a lot of builds for the same revision).
Here is an example:
> 2012/02/16 05:36:36.576258 length=2128 from=0 to=2127
POST /change_hook/googlecode HTTP/1.1
Google-Code-Project-Hosting-Hook-HMAC: 59721811b23b664451aad75dc8cb03ff
Content-Type: application/json; charset=UTF-8
User-Agent: Google Code Project Hosting (+http://code.google.com/p/support/wiki/PostCommitWebHooks)
Host: builds.rathaxes.org:20096
Content-Length: 1788
Accept-Encoding: gzip
{"repository_path":"https://code.google.com/p/rathaxes/","project_name":"rathaxes","revisions":[{"added":[],"parents":["8021567e5b325faf82150f85b91e49cc3e5f7aa1"],"author":"David xxxxxx \u003Cdav.xxxxxx@gmail.com\u003E","url":"http://rathaxes.googlecode.com/hg-history/068f44aee029127b0fc45af999b8d4c131e54fa7/","timestamp":1329355433,"message":"rathaxes: compiler: Fix the builtins and the way to manage the config matching to reflect the recent changes.","path_count":11,"removed":[],"modified":["/rathaxes/compiler/rtxLink/rtxLink_ConfigMatcher.inc.cws","/rathaxes/compiler/rtxNode/rtxNode.inc.cws","/rathaxes/compiler/rtxType/rules_types/number.inc.cws","/rathaxes/compiler/rtxType/rules_types/string.inc.cws","/rathaxes/compiler/rtxType/rules_types/symbol.inc.cws","/rathaxes/compiler/tests/03_A_test_config_match_lesser.cws","/rathaxes/compiler/tests/03_B_test_config_match_lesser_or_equal.cws","/rathaxes/compiler/tests/03_C_test_config_match_equal.cws","/rathaxes/compiler/tests/03_D_test_config_match_greater_or_equal.cws","/rathaxes/compiler/tests/03_E_test_config_match_greater.cws","/rathaxes/compiler/tests/03_F_test_config_match.cws"],"revision":"068f44aee029127b0fc45af999b8d4c131e54fa7"},{"added":[],"parents":["068f44aee029127b0fc45af999b8d4c131e54fa7","819e991f716f24a5eb7ee7ec1fb1d6f60b5f1f94"],"author":"David xxxxxx \u003Cdav.xxxxxx@gmail.com\u003E","url":"http://rathaxes.googlecode.com/hg-history/69e66ba52716815d2b358c22b4260234962235cf/","timestamp":1329355461,"message":"merge","path_count":3,"removed":[],"modified":["/rathaxes/compiler/rtxType/rules_types/number.inc.cws","/rathaxes/compiler/rtxType/rules_types/string.inc.cws","/rathaxes/compiler/rtxType/rules_types/symbol.inc.cws"],"revision":"69e66ba52716815d2b358c22b4260234962235cf"}],"revision_count":2}
< 2012/02/16 05:36:36.598502 length=548 from=0 to=547
HTTP/1.1 500 Internal Server Error
Date: Thu, 16 Feb 2012 05:36:36 GMT
Content-Length: 385
Content-Type: text/html; charset=utf-8
Server: TwistedWeb/11.1.0
<html>
<head><title>500 - Request did not return a string</title></head>
<body>
<h1>Request did not return a string</h1>
<p>Request: <pre><POST /change_hook/googlecode HTTP/1.1></pre><br />Resource: <pre><buildbot.status.web.change_hook.ChangeHookResource instance at 0x2075cf8></pre><br />Value: <pre><Deferred at 0x2d6cea8></pre></p>
</body>
</html>
I'm not familiar with Twisted at all, so I'm not sure what the problem is. Could that be something missing in ChangeHookResource.render_POST to indicate that the request is a success?
Thanks
Change History
Note: See
TracTickets for help on using
tickets.
![[Buildbot Logo]](/chrome/site/header-text-transparent.png)
web: Return server.NOT_DONE_YET from change_hooks.
twisted.web.resource predates deferreds, and so has idiosyncratic handling of asynchronous results. Fix /change_hook handling to return proper results and add support from properly testing this in FakeRequest?.test_render.
Fixes #2206.