Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Store Build Number in repository table #1919
There are webhook 500 errors with
The most of the http
For example here is a github webhook which is failing with id
and here is the corresponding error for that in the logs
This issue has been discussed here http://discourse.drone.io/t/webhook-500-errors/151/7
Also observing this infrequently
time="2017-03-08T11:05:00Z" level=error msg="failure to save commit for GITHUB_ORG/GITHUB_PROJECT. meddler.Insert: DB error in Exec: UNIQUE constraint failed: builds.build_number, builds.build_repo_id" time="2017-03-08T11:05:00Z" level=error msg="Error #01: meddler.Insert: DB error in Exec: UNIQUE constraint failed: builds.build_number, builds.build_repo_id\n" ip=184.108.40.206 latency=2.142335821s method=POST path="/hook" status=500 time="2017-03-08T11:05:00Z" user-agent="GitHub-Hookshot/6b02022"
Redelivering the payload via GitHub GUI always works.
The root cause is when two webhooks are received at the same time and drone tries to increment and use the same build number for each, thus violating the database unique constraint. No need to delete the database when this happens, just resent the webhook.
A fix is planned, but not for this release cycle.
I will update the issue when there is progress to share.
I'm renaming this issue to reflect the proposed solution for 0.7. Instead of doing a
To increment we will execute the following sql statement:
If the build number fails to increment and has already been incremented by another go routine, it will returns a result set indicating zero rows were updated, and we can retry. Once the build number is acquired it can be used to persist the build.