bountysource / bountysource/core

GitHub plugin locks with PG::UniqueViolation

Open
#1,470 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Ruby
Stars
643
Forks
199
PR merge metrics
No merged PRs in 30d

Description

The GitHub plugin locks regularly with following error:

`Reason: PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "index_linked_accounts_on_uid_and_type" DETAIL: Key (uid, type)=(39604003, LinkedAccount::Github::Bot) already exists. : UPDATE "linked_accounts" SET "type" = 'LinkedAccount::Github::Bot', "updated_at" = '2020-05-04 05:19:03.094210', "cloudinary_id" = 'https://avatars2.githubusercontent.com/in/12637?v=4' WHERE "linked_accounts"."id" = 19320591 `

Unlocking it usually helps for some period, but the error eventually reappears (with exactly same avatar URL).

![image](https://user-images.githubusercontent.com/212189/81310260-28a1da00-9084-11ea-9cf3-062a12eff0b1.png)

PS: Sometimes it also ends up with #1447.

Contributor guide

Open the contributing guide

Research direction

Start by tracing the GitHub plugin's linked-account update and locking path around the reported PostgreSQL unique constraint, then compare the related behavior in issue #1447. Reproduce the recurring PG::UniqueViolation and determine what handling is needed so the plugin no longer remains locked by the duplicate (uid, type) record.

Written by the indexing model from the issue text.

Assessment

Tech stack
github, postgresql, ruby
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.