Internal server error when making several request to repoCreateFile endpoint #6345

Closed
opened 2025-11-02 06:53:14 -06:00 by GiteaMirror · 0 comments
Owner

Originally created by @AbdulrhmnGhanem on GitHub (Nov 19, 2020).

Description

  • Making a several request (Close though not concurrent) to repoCreateFile API endpoint result in internal server error. Probably it's a race condition at the API level as demonstrated in the log.

  • What made do this(making several request to repoCreateFile) from first place is that I want to create multiple files through the API. Is there's a better way to do so?

  • I am willing to work on both the bug and a API endpoint for creating multiple files(unless it already exits). Though I need the guidance to do so. My thought process till this point is:

    • For the race condition, instead of committing the files directly from the API endpoint, it will be split into two parts one of them will populate a queue with the files and the other will consume this queue and commit the files.
    • For creating multiple files, it will use the a similar logic to the one used for GUI file upload.
Originally created by @AbdulrhmnGhanem on GitHub (Nov 19, 2020). - Gitea version (or commit ref): ee04731 - Git version: 2.26.2 - Operating system: official docker image - Database: - [x] PostgreSQL - [ ] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [x] No - Log gist: https://gist.github.com/AbdulrhmnGhanem/350a694778cd8cc34d7b93277179001f ## Description - Making a several request (Close though not concurrent) to [repoCreateFile](https://try.gitea.io/api/swagger#/repository/repoCreateFile) API endpoint result in internal server error. Probably it's a race condition at the API level as demonstrated in the log. - What made do this(making several request to `repoCreateFile`) from first place is that I want to create multiple files through the API. Is there's a better way to do so? - I am willing to work on both the bug and a API endpoint for creating multiple files(unless it already exits). Though I need the guidance to do so. My thought process till this point is: - For the race condition, instead of committing the files directly from the API endpoint, it will be split into two parts one of them will populate a queue with the files and the other will consume this queue and commit the files. - For creating multiple files, it will use the a similar logic to the one used for GUI file [upload](https://github.com/go-gitea/gitea/blob/6626a048df511b3833658db8215089b2ed323c64/routers/repo/editor.go#L559).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#6345