YetAnotherSpieskowcy / Carcassonne-Engine

Other
0 stars 1 forks source link

Sending requests form multiple threads fails #133

Open bstrzelecki opened 1 month ago

bstrzelecki commented 1 month ago

Sending requests form multiple threads (e.g.) fails with folllowing error:

fatal error: concurrent map read and map write

goroutine 230 [running, locked to thread]:
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.(*GameEngine).prepareWorkerInput(0xc000122120, 0xc029122058, 0xc021dcb7a0, {0x7f99d7c47590, 0xc0ec771440})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:410 +0xa5
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.(*requestBatch).Process(0xc029122000)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:509 +0x1a5
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.(*GameEngine).sendBatch(0xc000122120, {0xc05a6ceb60, 0x1, 0x1})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:392 +0x198
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.(*GameEngine).SendPlayTurnBatch(0xc000122120, {0xc0494ae018, 0x1, 0x7f99d7c3d180?})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:276 +0x91
main.engine_GameEngine_SendPlayTurnBatch(0x1, 0x3ea413)
    /home/mabat/Repos/zpb/Carcassonne-Engine/python_bindings/carcassonne_engine/_bindings/engine.go:3091 +0x18d

goroutine 17 [syscall, locked to thread]:
runtime.goexit({})
    /nix/store/mzg3cka0bbr5jq96ysymwziw74fnk22m-go-1.22.1/share/go/src/runtime/asm_amd64.s:1695 +0x1

goroutine 56 [runnable]:
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game/elements.NewScoreReport(...)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/elements/score_report.go:33
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game/city.(*Manager).ScoreCities(0xc041640168, 0x0)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/city/city_manager.go:182 +0x3e
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.(*board).checkCompleted(0xc041640100, {{0xc07aeedb20?, 0x7f9921bd2c58?, 0x30?}, {0x1?, 0x0?}})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/board.go:394 +0xbe
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.(*board).PlaceTile(0xc041640100, {{0xc04fccfe00?, 0x7f9921bd2c58?, 0xc0396cb880?}, {0x5a3e?, 0xd7ab?}})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/board.go:322 +0xe7
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/player.(*player).PlaceTile(0xc039d03a10, {0x7f99d7c48118?, 0xc041640100?}, {{0xc04fccfe00?, 0x7f99d7a7447b?, 0x7f99d7f72f08?}, {0x7?, 0x0?}})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/player/player.go:89 +0xe7
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.(*Game).PlayTurn(0xc040211260, {{0xc04fccfe00?, 0xc0599e83c0?, 0xc00010e6c0?}, {0x4?, 0x0?}})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:245 +0x31a
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.(*GetLegalMovesRequest).execute(0xc0f9971a70, 0xc089c68af0)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/requests.go:297 +0x332
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.processWorkerInput(0xc022adc058?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:62 +0x72
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.worker(0x0?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:69 +0x125
created by github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.StartGameEngine in goroutine 17
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:141 +0x1f4

goroutine 57 [runnable]:
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.board.DeepClone({{{{0xc00010e6c0, 0x4, 0x4}}, {0xc00012e708, 0x47, 0x4a}}, {0xc02280d508, 0x48, 0x48}, 0xc035d58810, ...})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/board.go:76 +0xa7
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.Game.DeepClone({{0x7f99d7c48118, 0xc07452fc00}, {0xc073fee280, {{0xc00010e6c0, 0x4, 0x4}}}, {0xc0e7d0c080, 0x2, 0x2}, 0x1, ...})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:83 +0xa3
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.(*Game).DeepCloneWithSwappableTiles(...)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:99
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.(*GetLegalMovesRequest).execute(0xc035d58f90, 0xc0767387e0)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/requests.go:292 +0x285
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.processWorkerInput(0xc076342058?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:62 +0x72
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.worker(0x0?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:69 +0x125
created by github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.StartGameEngine in goroutine 17
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:141 +0x1f4

goroutine 58 [runnable]:
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.board.DeepClone({{{{0xc00010e6c0, 0x4, 0x4}}, {0xc00012e708, 0x47, 0x4a}}, {0xc025e69508, 0x48, 0x48}, 0xc11ee70990, ...})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/board.go:76 +0xa7
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.Game.DeepClone({{0x7f99d7c48118, 0xc08785f880}, {0xc08bbe0e80, {{0xc00010e6c0, 0x4, 0x4}}}, {0xc0c0bcb100, 0x2, 0x2}, 0x1, ...})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:83 +0xa3
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.(*Game).DeepCloneWithSwappableTiles(...)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:99
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.(*GetLegalMovesRequest).execute(0xc0f99719e0, 0xc089c68af0)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/requests.go:292 +0x285
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.processWorkerInput(0xc030e92318?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:62 +0x72
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.worker(0x0?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:69 +0x125
created by github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.StartGameEngine in goroutine 17
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:141 +0x1f4

goroutine 59 [runnable]:
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.board.DeepClone({{{{0xc00010e6c0, 0x4, 0x4}}, {0xc00012e708, 0x47, 0x4a}}, {0xc02280d508, 0x48, 0x48}, 0xc035d58810, ...})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/board.go:76 +0xa7
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.Game.DeepClone({{0x7f99d7c48118, 0xc07452fc00}, {0xc073fee280, {{0xc00010e6c0, 0x4, 0x4}}}, {0xc0e7d0c080, 0x2, 0x2}, 0x1, ...})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:83 +0xa3
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.(*Game).DeepCloneWithSwappableTiles(...)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:99
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.(*GetLegalMovesRequest).execute(0xc035d58e70, 0xc0767387e0)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/requests.go:292 +0x285
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.processWorkerInput(0xc0546d0478?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:62 +0x72
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.worker(0x0?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:69 +0x125
created by github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.StartGameEngine in goroutine 17
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:141 +0x1f4

goroutine 60 [runnable]:
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.board.DeepClone({{{{0xc00010e6c0, 0x4, 0x4}}, {0xc00012e708, 0x47, 0x4a}}, {0xc02280d508, 0x48, 0x48}, 0xc035d58810, ...})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/board.go:76 +0xa7
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.Game.DeepClone({{0x7f99d7c48118, 0xc07452fc00}, {0xc073fee280, {{0xc00010e6c0, 0x4, 0x4}}}, {0xc0e7d0c080, 0x2, 0x2}, 0x1, ...})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:83 +0xa3
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.(*Game).DeepCloneWithSwappableTiles(...)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:99
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.(*GetLegalMovesRequest).execute(0xc035d591d0, 0xc0767387e0)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/requests.go:292 +0x285
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.processWorkerInput(0xc02ffec318?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:62 +0x72
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.worker(0x0?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:69 +0x125
created by github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.StartGameEngine in goroutine 17
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:141 +0x1f4

goroutine 61 [chan receive]:
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.worker(0x0?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:68 +0x17d
created by github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.StartGameEngine in goroutine 17
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:141 +0x1f4

goroutine 62 [runnable]:
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.board.DeepClone({{{{0xc00010e6c0, 0x4, 0x4}}, {0xc00012e708, 0x47, 0x4a}}, {0xc02280d508, 0x48, 0x48}, 0xc035d58810, ...})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/board.go:76 +0xa7
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.Game.DeepClone({{0x7f99d7c48118, 0xc07452fc00}, {0xc073fee280, {{0xc00010e6c0, 0x4, 0x4}}}, {0xc0e7d0c080, 0x2, 0x2}, 0x1, ...})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:83 +0xa3
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.(*Game).DeepCloneWithSwappableTiles(...)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:99
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.(*GetLegalMovesRequest).execute(0xc035d59020, 0xc0767387e0)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/requests.go:292 +0x285
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.processWorkerInput(0xc04cf5a318?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:62 +0x72
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.worker(0x0?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:69 +0x125
created by github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.StartGameEngine in goroutine 17
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:141 +0x1f4

goroutine 63 [runnable]:
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.board.DeepClone({{{{0xc00010e6c0, 0x4, 0x4}}, {0xc00012e708, 0x47, 0x4a}}, {0xc025e69508, 0x48, 0x48}, 0xc11ee70990, ...})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/board.go:76 +0xa7
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.Game.DeepClone({{0x7f99d7c48118, 0xc08785f880}, {0xc08bbe0e80, {{0xc00010e6c0, 0x4, 0x4}}}, {0xc0c0bcb100, 0x2, 0x2}, 0x1, ...})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:83 +0xa3
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.(*Game).DeepCloneWithSwappableTiles(...)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:99
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.(*GetLegalMovesRequest).execute(0xc0f99716b0, 0xc089c68af0)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/requests.go:292 +0x285
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.processWorkerInput(0xc066e8e1b8?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:62 +0x72
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.worker(0x0?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:69 +0x125
created by github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.StartGameEngine in goroutine 17
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:141 +0x1f4

goroutine 64 [runnable]:
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/tiles.Tile.Rotate(...)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/tiles/tile.go:91
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/tiles.Tile.Equals({{0xc00017a2d0?, 0x7f99d7ab5a3e?, 0x60?}}, {{0xc15cc0cea0?, 0x17faadeca92f3c00?, 0x3?}})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/tiles/tile.go:21 +0x185
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/stack.(*Stack[...]).MoveToTop(0x7f99d7c48200, {{0xc15cc0cea0, 0xc00010e6c0?, 0x4?}})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/stack/tile_stack.go:110 +0x12f
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.(*Game).SwapCurrentTile(...)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:226
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.(*GetLegalMovesRequest).execute(0xc0f99718f0, 0xc089c68af0)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/requests.go:293 +0x2ea
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.processWorkerInput(0xc022adc1b8?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:62 +0x72
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.worker(0x0?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:69 +0x125
created by github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.StartGameEngine in goroutine 17
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:141 +0x1f4

goroutine 65 [chan receive]:
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.worker(0x0?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:68 +0x17d
created by github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.StartGameEngine in goroutine 17
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:141 +0x1f4

goroutine 66 [runnable]:
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.board.DeepClone({{{{0xc00010e6c0, 0x4, 0x4}}, {0xc00012e708, 0x47, 0x4a}}, {0xc025e69508, 0x48, 0x48}, 0xc11ee70990, ...})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/board.go:76 +0xa7
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.Game.DeepClone({{0x7f99d7c48118, 0xc08785f880}, {0xc08bbe0e80, {{0xc00010e6c0, 0x4, 0x4}}}, {0xc0c0bcb100, 0x2, 0x2}, 0x1, ...})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:83 +0xa3
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.(*Game).DeepCloneWithSwappableTiles(...)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:99
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.(*GetLegalMovesRequest).execute(0xc0f9971a10, 0xc089c68af0)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/requests.go:292 +0x285
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.processWorkerInput(0xc04bdec528?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:62 +0x72
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.worker(0x0?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:69 +0x125
created by github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.StartGameEngine in goroutine 17
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:141 +0x1f4

goroutine 67 [runnable]:
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.board.DeepClone({{{{0xc00010e6c0, 0x4, 0x4}}, {0xc00012e708, 0x47, 0x4a}}, {0xc025e69508, 0x48, 0x48}, 0xc11ee70990, ...})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/board.go:76 +0xa7
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.Game.DeepClone({{0x7f99d7c48118, 0xc08785f880}, {0xc08bbe0e80, {{0xc00010e6c0, 0x4, 0x4}}}, {0xc0c0bcb100, 0x2, 0x2}, 0x1, ...})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:83 +0xa3
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.(*Game).DeepCloneWithSwappableTiles(...)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:99
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.(*GetLegalMovesRequest).execute(0xc0f9971800, 0xc089c68af0)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/requests.go:292 +0x285
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.processWorkerInput(0xc02d832108?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:62 +0x72
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.worker(0x0?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:69 +0x125
created by github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.StartGameEngine in goroutine 17
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:141 +0x1f4

goroutine 68 [runnable]:
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.board.DeepClone({{{{0xc00010e6c0, 0x4, 0x4}}, {0xc00012e708, 0x47, 0x4a}}, {0xc02280d508, 0x48, 0x48}, 0xc035d58810, ...})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/board.go:76 +0xa7
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.Game.DeepClone({{0x7f99d7c48118, 0xc07452fc00}, {0xc073fee280, {{0xc00010e6c0, 0x4, 0x4}}}, {0xc0e7d0c080, 0x2, 0x2}, 0x1, ...})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:83 +0xa3
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.(*Game).DeepCloneWithSwappableTiles(...)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:99
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.(*GetLegalMovesRequest).execute(0xc035d590e0, 0xc0767387e0)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/requests.go:292 +0x285
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.processWorkerInput(0xc04bdec3c8?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:62 +0x72
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.worker(0x0?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:69 +0x125
created by github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.StartGameEngine in goroutine 17
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:141 +0x1f4

goroutine 69 [runnable]:
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.board.DeepClone({{{{0xc00010e6c0, 0x4, 0x4}}, {0xc00012e708, 0x47, 0x4a}}, {0xc02280d508, 0x48, 0x48}, 0xc035d58810, ...})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/board.go:76 +0xa7
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.Game.DeepClone({{0x7f99d7c48118, 0xc07452fc00}, {0xc073fee280, {{0xc00010e6c0, 0x4, 0x4}}}, {0xc0e7d0c080, 0x2, 0x2}, 0x1, ...})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:83 +0xa3
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.(*Game).DeepCloneWithSwappableTiles(...)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:99
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.(*GetLegalMovesRequest).execute(0xc035d590b0, 0xc0767387e0)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/requests.go:292 +0x285
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.processWorkerInput(0xc02ffec3c8?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:62 +0x72
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.worker(0x0?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:69 +0x125
created by github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.StartGameEngine in goroutine 17
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:141 +0x1f4

goroutine 70 [runnable]:
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.board.DeepClone({{{{0xc00010e6c0, 0x4, 0x4}}, {0xc00012e708, 0x47, 0x4a}}, {0xc025e69508, 0x48, 0x48}, 0xc11ee70990, ...})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/board.go:76 +0xa7
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.Game.DeepClone({{0x7f99d7c48118, 0xc08785f880}, {0xc08bbe0e80, {{0xc00010e6c0, 0x4, 0x4}}}, {0xc0c0bcb100, 0x2, 0x2}, 0x1, ...})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:83 +0xa3
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.(*Game).DeepCloneWithSwappableTiles(...)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:99
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.(*GetLegalMovesRequest).execute(0xc0f9971950, 0xc089c68af0)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/requests.go:292 +0x285
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.processWorkerInput(0xc06e6401b8?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:62 +0x72
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.worker(0x0?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:69 +0x125
created by github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.StartGameEngine in goroutine 17
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:141 +0x1f4

goroutine 71 [runnable]:
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.board.DeepClone({{{{0xc00010e6c0, 0x4, 0x4}}, {0xc00012e708, 0x47, 0x4a}}, {0xc025e69508, 0x48, 0x48}, 0xc11ee70990, ...})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/board.go:76 +0xa7
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.Game.DeepClone({{0x7f99d7c48118, 0xc08785f880}, {0xc08bbe0e80, {{0xc00010e6c0, 0x4, 0x4}}}, {0xc0c0bcb100, 0x2, 0x2}, 0x1, ...})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:83 +0xa3
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.(*Game).DeepCloneWithSwappableTiles(...)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:99
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.(*GetLegalMovesRequest).execute(0xc0f9971aa0, 0xc089c68af0)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/requests.go:292 +0x285
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.processWorkerInput(0xc04bdec318?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:62 +0x72
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.worker(0x0?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:69 +0x125
created by github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.StartGameEngine in goroutine 17
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:141 +0x1f4

goroutine 72 [runnable]:
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.board.DeepClone({{{{0xc00010e6c0, 0x4, 0x4}}, {0xc00012e708, 0x47, 0x4a}}, {0xc025e69508, 0x48, 0x48}, 0xc11ee70990, ...})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/board.go:76 +0xa7
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.Game.DeepClone({{0x7f99d7c48118, 0xc08785f880}, {0xc08bbe0e80, {{0xc00010e6c0, 0x4, 0x4}}}, {0xc0c0bcb100, 0x2, 0x2}, 0x1, ...})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:83 +0xa3
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.(*Game).DeepCloneWithSwappableTiles(...)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:99
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.(*GetLegalMovesRequest).execute(0xc0f99716e0, 0xc089c68af0)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/requests.go:292 +0x285
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.processWorkerInput(0xc06e640058?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:62 +0x72
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.worker(0x0?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:69 +0x125
created by github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.StartGameEngine in goroutine 17
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:141 +0x1f4

goroutine 73 [runnable]:
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.board.DeepClone({{{{0xc00010e6c0, 0x4, 0x4}}, {0xc00012e708, 0x47, 0x4a}}, {0xc02280d508, 0x48, 0x48}, 0xc035d58810, ...})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/board.go:76 +0xa7
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.Game.DeepClone({{0x7f99d7c48118, 0xc07452fc00}, {0xc073fee280, {{0xc00010e6c0, 0x4, 0x4}}}, {0xc0e7d0c080, 0x2, 0x2}, 0x1, ...})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:83 +0xa3
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.(*Game).DeepCloneWithSwappableTiles(...)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:99
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.(*GetLegalMovesRequest).execute(0xc035d58e40, 0xc0767387e0)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/requests.go:292 +0x285
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.processWorkerInput(0xc02d8323c8?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:62 +0x72
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.worker(0x0?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:69 +0x125
created by github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.StartGameEngine in goroutine 17
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:141 +0x1f4

goroutine 74 [runnable]:
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.board.DeepClone({{{{0xc00010e6c0, 0x4, 0x4}}, {0xc00012e708, 0x47, 0x4a}}, {0xc025e69508, 0x48, 0x48}, 0xc11ee70990, ...})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/board.go:76 +0xa7
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.Game.DeepClone({{0x7f99d7c48118, 0xc08785f880}, {0xc08bbe0e80, {{0xc00010e6c0, 0x4, 0x4}}}, {0xc0c0bcb100, 0x2, 0x2}, 0x1, ...})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:83 +0xa3
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.(*Game).DeepCloneWithSwappableTiles(...)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:99
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.(*GetLegalMovesRequest).execute(0xc0f99717d0, 0xc089c68af0)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/requests.go:292 +0x285
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.processWorkerInput(0xc022db8108?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:62 +0x72
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.worker(0x0?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:69 +0x125
created by github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.StartGameEngine in goroutine 17
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:141 +0x1f4

goroutine 75 [runnable]:
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.board.DeepClone({{{{0xc00010e6c0, 0x4, 0x4}}, {0xc00012e708, 0x47, 0x4a}}, {0xc02280d508, 0x48, 0x48}, 0xc035d58810, ...})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/board.go:76 +0xa7
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.Game.DeepClone({{0x7f99d7c48118, 0xc07452fc00}, {0xc073fee280, {{0xc00010e6c0, 0x4, 0x4}}}, {0xc0e7d0c080, 0x2, 0x2}, 0x1, ...})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:83 +0xa3
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.(*Game).DeepCloneWithSwappableTiles(...)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:99
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.(*GetLegalMovesRequest).execute(0xc035d59170, 0xc0767387e0)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/requests.go:292 +0x285
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.processWorkerInput(0xc053ed8108?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:62 +0x72
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.worker(0x0?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:69 +0x125
created by github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.StartGameEngine in goroutine 17
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:141 +0x1f4

goroutine 76 [runnable]:
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.board.DeepClone({{{{0xc00010e6c0, 0x4, 0x4}}, {0xc00012e708, 0x47, 0x4a}}, {0xc02280d508, 0x48, 0x48}, 0xc035d58810, ...})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/board.go:76 +0xa7
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.Game.DeepClone({{0x7f99d7c48118, 0xc07452fc00}, {0xc073fee280, {{0xc00010e6c0, 0x4, 0x4}}}, {0xc0e7d0c080, 0x2, 0x2}, 0x1, ...})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:83 +0xa3
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.(*Game).DeepCloneWithSwappableTiles(...)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:99
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.(*GetLegalMovesRequest).execute(0xc035d58ed0, 0xc0767387e0)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/requests.go:292 +0x285
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.processWorkerInput(0xc02d832058?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:62 +0x72
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.worker(0x0?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:69 +0x125
created by github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.StartGameEngine in goroutine 17
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:141 +0x1f4

goroutine 77 [runnable]:
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.board.DeepClone({{{{0xc00010e6c0, 0x4, 0x4}}, {0xc00012e708, 0x47, 0x4a}}, {0xc02280d508, 0x48, 0x48}, 0xc035d58810, ...})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/board.go:76 +0xa7
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.Game.DeepClone({{0x7f99d7c48118, 0xc07452fc00}, {0xc073fee280, {{0xc00010e6c0, 0x4, 0x4}}}, {0xc0e7d0c080, 0x2, 0x2}, 0x1, ...})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:83 +0xa3
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.(*Game).DeepCloneWithSwappableTiles(...)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:99
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.(*GetLegalMovesRequest).execute(0xc035d59110, 0xc0767387e0)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/requests.go:292 +0x285
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.processWorkerInput(0xc0546d0268?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:62 +0x72
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.worker(0x0?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:69 +0x125
created by github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.StartGameEngine in goroutine 17
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:141 +0x1f4

goroutine 78 [runnable]:
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.board.DeepClone({{{{0xc00010e6c0, 0x4, 0x4}}, {0xc00012e708, 0x47, 0x4a}}, {0xc02280d508, 0x48, 0x48}, 0xc035d58810, ...})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/board.go:76 +0xa7
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.Game.DeepClone({{0x7f99d7c48118, 0xc07452fc00}, {0xc073fee280, {{0xc00010e6c0, 0x4, 0x4}}}, {0xc0e7d0c080, 0x2, 0x2}, 0x1, ...})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:83 +0xa3
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.(*Game).DeepCloneWithSwappableTiles(...)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:99
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.(*GetLegalMovesRequest).execute(0xc035d58f00, 0xc0767387e0)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/requests.go:292 +0x285
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.processWorkerInput(0xc0546d0058?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:62 +0x72
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.worker(0x0?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:69 +0x125
created by github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.StartGameEngine in goroutine 17
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:141 +0x1f4

goroutine 79 [runnable]:
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.board.DeepClone({{{{0xc00010e6c0, 0x4, 0x4}}, {0xc00012e708, 0x47, 0x4a}}, {0xc025e69508, 0x48, 0x48}, 0xc11ee70990, ...})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/board.go:76 +0xa7
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.Game.DeepClone({{0x7f99d7c48118, 0xc08785f880}, {0xc08bbe0e80, {{0xc00010e6c0, 0x4, 0x4}}}, {0xc0c0bcb100, 0x2, 0x2}, 0x1, ...})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:83 +0xa3
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.(*Game).DeepCloneWithSwappableTiles(...)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:99
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.(*GetLegalMovesRequest).execute(0xc0f9971a40, 0xc089c68af0)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/requests.go:292 +0x285
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.processWorkerInput(0xc076342108?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:62 +0x72
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.worker(0x0?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:69 +0x125
created by github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.StartGameEngine in goroutine 17
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:141 +0x1f4

goroutine 80 [runnable]:
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.board.DeepClone({{{{0xc00010e6c0, 0x4, 0x4}}, {0xc00012e708, 0x47, 0x4a}}, {0xc02280d508, 0x48, 0x48}, 0xc035d58810, ...})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/board.go:76 +0xa7
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.Game.DeepClone({{0x7f99d7c48118, 0xc07452fc00}, {0xc073fee280, {{0xc00010e6c0, 0x4, 0x4}}}, {0xc0e7d0c080, 0x2, 0x2}, 0x1, ...})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:83 +0xa3
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.(*Game).DeepCloneWithSwappableTiles(...)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:99
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.(*GetLegalMovesRequest).execute(0xc035d59140, 0xc0767387e0)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/requests.go:292 +0x285
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.processWorkerInput(0xc021c56318?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:62 +0x72
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.worker(0x0?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:69 +0x125
created by github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.StartGameEngine in goroutine 17
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:141 +0x1f4

goroutine 81 [runnable]:
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.board.DeepClone({{{{0xc00010e6c0, 0x4, 0x4}}, {0xc00012e708, 0x47, 0x4a}}, {0xc02280d508, 0x48, 0x48}, 0xc035d58810, ...})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/board.go:76 +0xa7
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.Game.DeepClone({{0x7f99d7c48118, 0xc07452fc00}, {0xc073fee280, {{0xc00010e6c0, 0x4, 0x4}}}, {0xc0e7d0c080, 0x2, 0x2}, 0x1, ...})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:83 +0xa3
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.(*Game).DeepCloneWithSwappableTiles(...)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:99
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.(*GetLegalMovesRequest).execute(0xc035d59200, 0xc0767387e0)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/requests.go:292 +0x285
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.processWorkerInput(0xc041a50268?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:62 +0x72
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.worker(0x0?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:69 +0x125
created by github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.StartGameEngine in goroutine 17
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:141 +0x1f4

goroutine 82 [runnable]:
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.worker(0x0?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:68 +0x17d
created by github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.StartGameEngine in goroutine 17
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:141 +0x1f4

goroutine 83 [runnable]:
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.board.DeepClone({{{{0xc00010e6c0, 0x4, 0x4}}, {0xc00012e708, 0x47, 0x4a}}, {0xc025e69508, 0x48, 0x48}, 0xc11ee70990, ...})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/board.go:76 +0xa7
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.Game.DeepClone({{0x7f99d7c48118, 0xc08785f880}, {0xc08bbe0e80, {{0xc00010e6c0, 0x4, 0x4}}}, {0xc0c0bcb100, 0x2, 0x2}, 0x1, ...})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:83 +0xa3
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.(*Game).DeepCloneWithSwappableTiles(...)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:99
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.(*GetLegalMovesRequest).execute(0xc0f9971860, 0xc089c68af0)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/requests.go:292 +0x285
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.processWorkerInput(0xc057480268?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:62 +0x72
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.worker(0x0?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:69 +0x125
created by github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.StartGameEngine in goroutine 17
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:141 +0x1f4

goroutine 84 [runnable]:
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.board.DeepClone({{{{0xc00010e6c0, 0x4, 0x4}}, {0xc00012e708, 0x47, 0x4a}}, {0xc02280d508, 0x48, 0x48}, 0xc035d58810, ...})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/board.go:76 +0xa7
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.Game.DeepClone({{0x7f99d7c48118, 0xc07452fc00}, {0xc073fee280, {{0xc00010e6c0, 0x4, 0x4}}}, {0xc0e7d0c080, 0x2, 0x2}, 0x1, ...})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:83 +0xa3
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.(*Game).DeepCloneWithSwappableTiles(...)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:99
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.(*GetLegalMovesRequest).execute(0xc035d591a0, 0xc0767387e0)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/requests.go:292 +0x285
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.processWorkerInput(0xc0546d03c8?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:62 +0x72
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.worker(0x0?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:69 +0x125
created by github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.StartGameEngine in goroutine 17
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:141 +0x1f4

goroutine 85 [runnable]:
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/tiles.Tile.Rotate(...)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/tiles/tile.go:91
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/tiles.Tile.Equals({{0xc15c8c32c0?, 0x0?, 0x0?}}, {{0xc00017a280?, 0x0?, 0x0?}})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/tiles/tile.go:21 +0x185
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.(*board).addTileToBoard.func1({{0xc00017a280?, 0xc0f1733780?, 0x3?}})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/board.go:340 +0x10f
slices.IndexFunc[...](...)
    /nix/store/mzg3cka0bbr5jq96ysymwziw74fnk22m-go-1.22.1/share/go/src/slices/slices.go:107
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.(*board).addTileToBoard(0xc0cdcf9080, {{0xc0f1733780?, 0x48?, 0x4?}, {0x30?, 0x0?}})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/board.go:339 +0x399
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.(*board).PlaceTile(0xc0cdcf9080, {{0xc0f1732980?, 0x7f993aa43d18?, 0xc113bcf880?}, {0x5a3e?, 0xd7ab?}})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/board.go:318 +0xae
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/player.(*player).PlaceTile(0xc0532540c0, {0x7f99d7c48118?, 0xc0cdcf9080?}, {{0xc0f1732980?, 0x7f99d7a7447b?, 0x7f99d7f720f8?}, {0xb?, 0x0?}})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/player/player.go:89 +0xe7
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.(*Game).PlayTurn(0xc089cdbb20, {{0xc0f1732980?, 0xc15c43e660?, 0xc00010e6c0?}, {0x4?, 0x0?}})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:245 +0x31a
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.(*GetLegalMovesRequest).execute(0xc0f9971920, 0xc089c68af0)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/requests.go:297 +0x332
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.processWorkerInput(0xc04197e478?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:62 +0x72
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.worker(0x0?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:69 +0x125
created by github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.StartGameEngine in goroutine 17
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:141 +0x1f4

goroutine 86 [runnable]:
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.board.DeepClone({{{{0xc00010e6c0, 0x4, 0x4}}, {0xc00012e708, 0x47, 0x4a}}, {0xc025e69508, 0x48, 0x48}, 0xc11ee70990, ...})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/board.go:78 +0x105
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.Game.DeepClone({{0x7f99d7c48118, 0xc08785f880}, {0xc08bbe0e80, {{0xc00010e6c0, 0x4, 0x4}}}, {0xc0c0bcb100, 0x2, 0x2}, 0x1, ...})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:83 +0xa3
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.(*Game).DeepCloneWithSwappableTiles(...)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:99
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.(*GetLegalMovesRequest).execute(0xc0f99719b0, 0xc089c68af0)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/requests.go:292 +0x285
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.processWorkerInput(0xc022552058?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:62 +0x72
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.worker(0x0?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:69 +0x125
created by github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.StartGameEngine in goroutine 17
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:141 +0x1f4

goroutine 87 [runnable]:
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.board.DeepClone({{{{0xc00010e6c0, 0x4, 0x4}}, {0xc00012e708, 0x47, 0x4a}}, {0xc025e69508, 0x48, 0x48}, 0xc11ee70990, ...})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/board.go:76 +0xa7
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.Game.DeepClone({{0x7f99d7c48118, 0xc08785f880}, {0xc08bbe0e80, {{0xc00010e6c0, 0x4, 0x4}}}, {0xc0c0bcb100, 0x2, 0x2}, 0x1, ...})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:83 +0xa3
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/game.(*Game).DeepCloneWithSwappableTiles(...)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/game/game.go:99
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.(*GetLegalMovesRequest).execute(0xc0f99717a0, 0xc089c68af0)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/requests.go:292 +0x285
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.processWorkerInput(0xc022db8058?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:62 +0x72
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.worker(0x0?)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:69 +0x125
created by github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.StartGameEngine in goroutine 17
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:141 +0x1f4

goroutine 3827 [runnable]:
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.(*requestBatch).Process.func1()
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:473
created by github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.(*requestBatch).Process in goroutine 230
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:473 +0x116

goroutine 3287 [semacquire, locked to thread]:
sync.runtime_Semacquire(0x7f998a1a31d8?)
    /nix/store/mzg3cka0bbr5jq96ysymwziw74fnk22m-go-1.22.1/share/go/src/runtime/sema.go:62 +0x25
sync.(*WaitGroup).Wait(0x7f99d7a7979c?)
    /nix/store/mzg3cka0bbr5jq96ysymwziw74fnk22m-go-1.22.1/share/go/src/sync/waitgroup.go:116 +0x48
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.(*requestBatch).recoverWithCleanup(0xc025906000)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:553 +0x30
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.(*requestBatch).Process(0xc025906000)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:522 +0x429
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.(*GameEngine).sendBatch(0xc000122120, {0xc025900000, 0x17, 0x17})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:392 +0x198
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.(*GameEngine).SendGetLegalMovesBatch(0xc000122120, {0xc07f864100, 0x17, 0x7f99d7c3d180?})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:330 +0x91
main.engine_GameEngine_SendGetLegalMovesBatch(0x1, 0x3e9d29)
    /home/mabat/Repos/zpb/Carcassonne-Engine/python_bindings/carcassonne_engine/_bindings/engine.go:3117 +0x18d

goroutine 3288 [runnable, locked to thread]:
runtime.goexit({})
    /nix/store/mzg3cka0bbr5jq96ysymwziw74fnk22m-go-1.22.1/share/go/src/runtime/asm_amd64.s:1695 +0x1

goroutine 3289 [semacquire, locked to thread]:
sync.runtime_Semacquire(0x7f992f17bf78?)
    /nix/store/mzg3cka0bbr5jq96ysymwziw74fnk22m-go-1.22.1/share/go/src/runtime/sema.go:62 +0x25
sync.(*WaitGroup).Wait(0xc0000dddc0?)
    /nix/store/mzg3cka0bbr5jq96ysymwziw74fnk22m-go-1.22.1/share/go/src/sync/waitgroup.go:116 +0x48
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.(*requestBatch).recoverWithCleanup(0xc022adc210)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:553 +0x30
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.(*requestBatch).Process(0xc022adc210)
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:522 +0x429
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.(*GameEngine).sendBatch(0xc000122120, {0xc082a08480, 0x17, 0x17})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:392 +0x198
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.(*GameEngine).SendGetLegalMovesBatch(0xc000122120, {0xc0830b1700, 0x17, 0x7f99d7c3d180?})
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:330 +0x91
main.engine_GameEngine_SendGetLegalMovesBatch(0x1, 0x3e99db)
    /home/mabat/Repos/zpb/Carcassonne-Engine/python_bindings/carcassonne_engine/_bindings/engine.go:3117 +0x18d

goroutine 4069 [runnable]:
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.(*requestBatch).Process.func1()
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:481 +0x99
created by github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.(*requestBatch).Process in goroutine 3287
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:473 +0x116

goroutine 4315 [runnable]:
github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.(*requestBatch).Process.func1()
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:481 +0x99
created by github.com/YetAnotherSpieskowcy/Carcassonne-Engine/pkg/engine.(*requestBatch).Process in goroutine 3289
    /home/mabat/Repos/zpb/Carcassonne-Engine/pkg/engine/engine.go:473 +0x116
[1]    13237 abort (core dumped)  python game.py
Jackenmen commented 1 month ago

I believe the current design assumes that threading is only done on Go's side - i.e. the batches are spread across multiple threads (workers) but you can't do concurrent calls to Send*Batch functions.

I don't think this is consistent with the code comments (which probably reflect my original intentions) I see in GameEngine's code though - it does mention the possibility of concurrently calling Send*Batch for different game IDs. I don't think that's what you're doing here (you seem to be trying to do concurrent calls for same game ID) but I imagine we'd get the same/similar failures, if we were to test with different game IDs as well since we don't hold a lock over some of the engine's structures when, for example, we delete games at the end of the request.

Considering that we were planning on playing a lot of games at the same time, the assumption that only one Python thread can operate on a single game ID still seems reasonable to me but we will almost for sure need to allow concurrent calls to Send*Batch for different game IDs.