[PR #5224] [MERGED] Fix data race on migrate repository #17708

Closed
opened 2025-11-02 15:10:08 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/go-gitea/gitea/pull/5224
Author: @lunny
Created: 10/30/2018
Status: Merged
Merged: 10/30/2018
Merged by: @techknowlogick

Base: masterHead: lunny/fix_migrate_data_race


📝 Commits (3)

  • 16cbaac fix data race on migrate repository
  • f44e93a Merge branch 'master' into lunny/fix_migrate_data_race
  • 5c3dfa8 Merge branch 'master' into lunny/fix_migrate_data_race

📊 Changes

1 file changed (+8 additions, -3 deletions)

View changed files

📝 models/repo.go (+8 -3)

📄 Description

The data race occupied when both two go routines run repo.getOwner and it will set repo.Owner. Since UpdateRepoIndexer(repo) will send the repo pointer to another goroutine, this PR lets it runs after all other operations finished to resolve the data race. A complete solution to resolve this like problem is to change UpdateRepoIndexer(neededRepoInfo) to only copy needed information from repo.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/go-gitea/gitea/pull/5224 **Author:** [@lunny](https://github.com/lunny) **Created:** 10/30/2018 **Status:** ✅ Merged **Merged:** 10/30/2018 **Merged by:** [@techknowlogick](https://github.com/techknowlogick) **Base:** `master` ← **Head:** `lunny/fix_migrate_data_race` --- ### 📝 Commits (3) - [`16cbaac`](https://github.com/go-gitea/gitea/commit/16cbaaca1e70de2ccc3791bfe41b43ccd0eb5ed5) fix data race on migrate repository - [`f44e93a`](https://github.com/go-gitea/gitea/commit/f44e93a4f1edd9fc11a93439abc92d549056bae4) Merge branch 'master' into lunny/fix_migrate_data_race - [`5c3dfa8`](https://github.com/go-gitea/gitea/commit/5c3dfa879c866f37ad45768342a9ffe78f73467d) Merge branch 'master' into lunny/fix_migrate_data_race ### 📊 Changes **1 file changed** (+8 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `models/repo.go` (+8 -3) </details> ### 📄 Description The data race occupied when both two go routines run `repo.getOwner` and it will set `repo.Owner`. Since `UpdateRepoIndexer(repo)` will send the `repo` pointer to another goroutine, this PR lets it runs after all other operations finished to resolve the data race. A complete solution to resolve this like problem is to change `UpdateRepoIndexer(neededRepoInfo)` to only copy needed information from repo. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2025-11-02 15:10:08 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#17708