-
Notifications
You must be signed in to change notification settings - Fork 8
possible race condition: (sqlite3.IntegrityError) UNIQUE constraint failed: tokens.repo
#53
Comments
🤦 Thanks! Nice catch! This means it can and will happen... I guess I'll need to reconfigure tokman to use a single worker. Any better idea? |
Could we in theory utilize SQL transactions and make it work with 2 workers? |
We already do that, I think... but even that wouldn't help. The error is triggered, b/c the repo name is expected to be unique in the DB so that we don't allow duplicate to tokens. The issue is that by the time this error occurred a new token was already requested, and the previous one is invalidated by this—at least this is how it worked in the past. I could check if GitHub changed behaviour since then. |
Hm, interesting. Could we also make the repo name not unique and return the latest issued token? |
We could, but then there would be very little benefit to run tokman, as workers could still end up trying to use invalid tokens, and ending up with failed GitHub requests. |
Adding discuss label so we can come up with next steps here. Scaling down to a single worker sounds like the best short term solution. |
It turns out that the GitHub API behaviour tokman was ment to work around is no longer a thing 😄 Tokens seem to stay valid, even after a new token was requested for the same installation. So yeah, let's discuss what to do with this. |
whaaaaaat, very nice! |
tokman: reduce the number of workers and resources in packit prod It turns out, that having 2 workers running in parallel will lead to a race condition, and there will be times when there are multiple tokens requested for the same repo. Avoid this, by dropping the number of workers to 1. Adjust resources accordingly. Related to packit/tokman#53. Reviewed-by: Tomas Tomecek <[email protected]>
https://red-hat-it.sentry.io/issues/3556205037/?query=is%3Aunresolved&referrer=issue-stream
https://red-hat-it.sentry.io/issues/3952931168/?query=is%3Aunresolved&referrer=issue-stream
The text was updated successfully, but these errors were encountered: