go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
44.1k stars 5.41k forks source link

reloading the pull request creation page creates duplicate pull requests #20906

Open earl-warren opened 2 years ago

earl-warren commented 2 years ago

Description

See https://gitea.com/gitea/go-sdk/pulls: there are two identical pull requests:

image

It happened while trying to submit a pull request while the gitea.com gateway was timeout (504 Gateway Time-out). Multiple requests were sent (reloading the URL creating the pull request with POST at https://gitea.com/gitea/go-sdk/compare/master...earl-warren/go-sdk:wip-issue-delete).

The final attempt showed a page explaining the pull request already exists:

image

But despite this safeguard two of the attempts raced against each other and created a duplicate. There is a race condition somewhere. An integration test trying to repeat these conditions would eventually run into this problem.

Gitea Version

dev

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

a

Screenshots

a

Git Version

a

Operating System

a

How are you running Gitea?

a

Database

No response

zeripath commented 2 years ago

I don't think it's likely that this is due to reloading the page - I think it's more likely to be due to a double click on create pull request button - we need to add a disable after click on these.

earl-warren commented 2 years ago