fix(routing): remove unsynchronized write in GetFuncInfo (#40409) (#40421)

Backport #40409 by @lazerg

`GetFuncInfo` wrote the friendly name into `funcInfoNameMap` once
without holding `funcInfoMapMu`, right before the same locked write.
Concurrent requests hitting that branch could then crash the process
with `fatal error: concurrent map writes`. This drops the unlocked
write.

Fixes: https://github.com/go-gitea/gitea/issues/40407

Assisted-by: Claude Code:claude-opus-5-5

Co-authored-by: Lazizbek Ergashev <lazerg2@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
authored and GitHub committed 2026-11-17 23:33:05 +00:00
1 parent f8c4012ab8
commit 93ae5fb35b
1 file changed
-1
-1
View File
@@ -62,7 +62,6 @@ func GetFuncInfo(fn any, friendlyName ...string) *FuncInfo {
info = copyFuncInfo(info)
info.shortName = name
funcInfoNameMap[name] = info
funcInfoMapMu.Lock()
funcInfoNameMap[name] = info
funcInfoMapMu.Unlock()