Opening a Pull-Request results in a 500 #21

Closed
opened 2022-04-16 14:25:24 +02:00 by revol-xut · 8 comments
Owner

Whats the Problem

Opening a Pull Request on this gitea instance results in Http error 500. You can perfectly fine write the text but on submitting you get the error.

## Whats the Problem Opening a Pull Request on this gitea instance results in Http error 500. You can perfectly fine write the text but on submitting you get the error.
Owner

Cc: @j03 @sand20

Cc: @j03 @sand20
sandro was assigned by astro 2022-04-16 18:14:53 +02:00
j03 was assigned by astro 2022-04-16 18:14:53 +02:00
Author
Owner

I did some digging in the journalctl log:

Apr 20 18:54:11 gitea gitea[14667]: 2022/04/20 18:54:11 Completed POST /c3d2/nix-config/compare/master...broken 500 Internal Server Error in 741.986012ms
Apr 20 18:54:11 gitea gitea[14667]: 2022/04/20 18:54:11 ...ers/web/repo/pull.go:1128:CompareAndPullRequestPost() [E] NewPullRequest: insert pull repo: pq: duplicate key value violates unique constraint "pull_request_pkey"
I did some digging in the journalctl log: ``` Apr 20 18:54:11 gitea gitea[14667]: 2022/04/20 18:54:11 Completed POST /c3d2/nix-config/compare/master...broken 500 Internal Server Error in 741.986012ms Apr 20 18:54:11 gitea gitea[14667]: 2022/04/20 18:54:11 ...ers/web/repo/pull.go:1128:CompareAndPullRequestPost() [E] NewPullRequest: insert pull repo: pq: duplicate key value violates unique constraint "pull_request_pkey" ```
Owner

the problem is that some extra counter is 0 which means the first available PR number already exists. fallout of the upgrade because we jumped to many versions at once.

the problem is that some extra counter is 0 which means the first available PR number already exists. fallout of the upgrade because we jumped to many versions at once.
Owner

How to resolve?

How to resolve?
Owner

go into the database, find the project and increase the PR counter to the current number.

go into the database, find the project and increase the PR counter to the current number.
Author
Owner
Probably related issue: https://github.com/go-gitea/gitea/issues/14725
Author
Owner

Resolved Issues with @sand20

The pull request index was one to low for unkown reason which resulted in new prs having a primary id which was already in use.

We couldn't update the last_value in the id_seq table so we decided the last pull request belonging to this repository.

That broke the listing for closed pull requests. So we scanned all ids and deleted the entries which displayed a 500 error.

=> We lost 2 pull requests / issues, gitea is displaying them as 404 but at least we can create new prs now.

=> If we get the opportunity to recreate the database we should take it.
=> Someone should upgrade gitea.

Resolved Issues with @sand20 The pull request index was one to low for unkown reason which resulted in new prs having a primary id which was already in use. We couldn't update the last_value in the id_seq table so we decided the last pull request belonging to this repository. That broke the listing for closed pull requests. So we scanned all ids and deleted the entries which displayed a 500 error. => We lost 2 pull requests / issues, gitea is displaying them as 404 but at least we can create new prs now. => If we get the opportunity to recreate the database we should take it. => Someone should upgrade gitea.
Author
Owner

problem appears to be fixed closing.

problem appears to be fixed closing.
Sign in to join this conversation.
No Label
No Milestone
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: c3d2/nix-config#21
No description provided.