Description
Description
We believe that we've found a concurrency bug when doing maven deploys. Depending on network latency or some other factors, mvn deploy
may succeed or fail (500 internal server error, see log below). Our project consists of three files:
- module-our-project.jar
- module-our-project-sources.jar
- module-our-project.pom
It seems to us that these files are uploaded in parallel which causes a unique constraint violation in our Postgres database when working with the package_versions
table. We couldn't find any maven configuration where we could manipulate maven's upload/deploy behavior, so we currently are in a position where we can't circumvent the problem. We also tried to change Postgres' default isolation level from read_commited to serializable, but doing so causes a different 500 internal server error.
journalctl:
Mar 29 07:25:35 repo-debug gitea[175]: 2024/03/29 07:25:35 ...eb/routing/logger.go:102:func1() [I] router: completed PUT /api/packages/OurCompany/maven/io/our-company/our-project/module/module-our-project/1.3.0/module-our-project-1.3.0.jar for 10.10.10.1:40002, 201 Created in 9.9ms @ maven/maven.go:230(maven.UploadPackageFile)
Mar 29 07:25:35 repo-debug gitea[175]: 2024/03/29 07:25:35 ...packages/packages.go:170:createPackageAndVersion() [E] Error inserting package: pq: duplicate key value violates unique constraint "UQE_package_version_s"
Mar 29 07:25:35 repo-debug gitea[175]: 2024/03/29 07:25:35 ...kages/maven/maven.go:51:apiError() [E] pq: duplicate key value violates unique constraint "UQE_package_version_s"
Mar 29 07:25:35 repo-debug gitea[175]: 2024/03/29 07:25:35 ...kages/maven/maven.go:54:func17() [E] pq: duplicate key value violates unique constraint "UQE_package_version_s"
After the failed upload, opening the artifact page throws another 500 which is caused by a nil pointer error (see screenshot).
Gitea Version
1.21.10
Can you reproduce the bug on the Gitea demo site?
No
Log Gist
No response
Screenshots
Git Version
No response
Operating System
Debian GNU/Linux 12 (bookworm)
How are you running Gitea?
We are using the official binary (manually downloaded) on a self hosted Debian server using systemd
Database
PostgreSQL