coze-dev / coze-dev/coze-studio

服务 panic:"fatal error: concurrent map iteration and map write"

Open
#2,607 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
21.6k
Forks
3.1k
PR merge metrics
No merged PRs in 30d

Description

fatal error: concurrent map iteration and map write
goroutine 1704 [running]:
internal/runtime/maps.fatal({0x69a1cd7?, 0xc001700530?})
/home/opt/deck/2.0/go-1.24.2/src/runtime/panic.go:1058 +0x18
internal/runtime/maps.(*Iter).Next(0xc002e3a300?)
/home/opt/deck/2.0/go-1.24.2/src/internal/runtime/maps/table.go:683 +0x86
github.com/bytedance/sonic/internal/encoder/alg.IteratorStart(0x5f84100, 0xc00130be60, 0x27)
/root/go/pkg/mod/github.com/bytedance/sonic@v1.14.0/internal/encoder/alg/mapiter.go:171 +0x3f
encode_map[...]interface {}()
?:0 +0x15f
github.com/bytedance/sonic/internal/encoder/x86.EncodeTypedPointer(0xc002b7c0d8, 0x5f84100, 0xc0012ab198, 0xc001f02000, 0x27)
/root/go/pkg/mod/github.com/bytedance/sonic@v1.14.0/internal/encoder/x86/stbus.go:48 +0x125
github.com/bytedance/sonic/internal/encoder.encodeInto(0xc002b7c0d8, {0x5f84100, 0xc00130be60}, 0x27)
/root/go/pkg/mod/github.com/bytedance/sonic@v1.14.0/internal/encoder/encoder.go:221 +0xd7
github.com/bytedance/sonic/internal/encoder.encodeIntoCheckRace(...)
/root/go/pkg/mod/github.com/bytedance/sonic@v1.14.0/internal/encoder/encode_norace.go:23
github.com/bytedance/sonic/internal/encoder.Encode({0x5f84100, 0xc00130be60}, 0x27)
/root/go/pkg/mod/github.com/bytedance/sonic@v1.14.0/internal/encoder/encoder.go:174 +0x45
github.com/bytedance/sonic.frozenConfig.MarshalToString({{0x1, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, ...}, ...}, ...)
/root/go/pkg/mod/github.com/bytedance/sonic@v1.14.0/sonic.go:106 +0x29
icode.baidu.com/baidu/health/coze-server/domain/workflow/internal/execute.mustMarshalToString[...](0x73b7068?)
/root/ONLINE_SERVICE/other/ferry/task_workspace/baidu/health/coze-server/domain/workflow/internal/execute/event_handle.go:835 +0x51
icode.baidu.com/baidu/health/coze-server/domain/workflow/internal/execute.handleEvent({0x73b7068, 0xc0028e6510}, 0xc000bbdd90, {0x7454a30, 0xc000ea2210}, 0xc001f8ee98)
/root/ONLINE_SERVICE/other/ferry/task_workspace/baidu/health/coze-server/domain/workflow/internal/execute/event_handle.go:176 +0x1f56
icode.baidu.com/baidu/health/coze-server/domain/workflow/internal/execute.HandleExecuteEvent.func1(0xc000bbdd90)
/root/ONLINE_SERVICE/other/ferry/task_workspace/baidu/health/coze-server/domain/workflow/internal/execute/event_handle.go:732 +0x245
icode.baidu.com/baidu/health/coze-server/domain/workflow/internal/execute.HandleExecuteEvent({_, _}, _, _, _, _, {_, _}, _, {0x0, ...})
/root/ONLINE_SERVICE/other/ferry/task_workspace/baidu/health/coze-server/domain/workflow/internal/execute/event_handle.go:821 +0x52f
icode.baidu.com/baidu/health/coze-server/domain/workflow/internal/compose.(*WorkflowRunner).Prepare.func2()
/root/ONLINE_SERVICE/other/ferry/task_workspace/baidu/health/coze-server/domain/workflow/internal/compose/workflow_run.go:309 +0xfe
created by icode.baidu.com/baidu/health/coze-server/domain/workflow/internal/compose.(*WorkflowRunner).Prepare in goroutine 1700

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with domain/workflow/internal/execute/event_handle.go, especially mustMarshalToString at line 835 and its callers in handleEvent, then trace the goroutine started from workflow_run.go:309. Reproduce or isolate the concurrent map iteration and write during workflow event handling; done means the panic no longer occurs under concurrent execution and the relevant behavior is covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.