Closed
Description
Describe the problem
Occasional error: concurrent map iteration and map write
when updating all outdated libraries with IDE2 (from this build: arduino/arduino-ide#2281).
2023-12-06T16:35:24.756Z daemon INFO fatal error: concurrent map iteration and map write
2023-12-06T16:35:24.759Z daemon INFO goroutine 812 [running]:
github.com/arduino/arduino-cli/commands/lib.listLibraries
2023-12-06T16:35:24.759Z daemon INFO (0xc000acf100, 0x0, 0x1)
/home/build/commands/lib/list.go:123 +0x8c
github.com/arduino/arduino-cli/commands/lib.LibraryList({0x40e23a?, 0xe8ac00?}, 0xc0028822a0)
/home/build/commands/lib/list.go:54 +0x165
github.com/arduino/arduino-cli/commands/daemon.(*ArduinoCoreServerImpl).LibraryList(0xe506c0?, {0x11ea778?, 0xc005f09230?}, 0x0?)
/home/build/commands/daemon/daemon.go:401 +0x26
github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1._ArduinoCoreService_LibraryList_Handler({0xea0f00?, 0xc000241e20}, {0x11ea778, 0xc005f09230}, 0xc007ff0480, 0x0)
/home/build/rpc/cc/arduino/cli/commands/v1/commands_grpc.pb.go:1999 +0x16c
google.golang.org/grpc.(*Server).processUnaryRPC(0xc00025e1e0, {0x11ea778, 0xc003ee4360}, {0x11ef920, 0xc00040e1a0}, 0xc0000e0120, 0xc0003a6c00,
2023-12-06T16:35:24.759Z daemon INFO 0x18afab8, 0x0)
/go/pkg/mod/google.golang.org/grpc@v1.59.0/server.go:1343 +0xe03
google.golang.org/grpc.(*Server).handleStream(0xc00025e1e0, {0x11ef920, 0xc00040e1a0}, 0xc0000e0120)
/go/pkg/mod/google.golang.org/grpc@v1.59.0/server.go:1737 +0xc4c
google.golang.org/grpc.(*Server).serveStreams.func1.1()
/go/pkg/mod/google.golang.org/grpc@v1.59.0/server.go:986 +0x86
created by google.golang.org/grpc.(*Server).serveStreams.func1 in goroutine 20
/go/pkg/mod/google.golang.org/grpc@v1.59.0/server.go:997 +0x145
I see that the board discovery (board list -w
) stopped/started for each lib installation in IDE2. It’s a good question why, and I found this five times in the logs. Maybe it’s unrelated:
2023-12-06T16:34:52.820Z daemon INFO time="2023-12-06T17:34:52+01:00" level=warning msg="Error loading library" error="rpc error: code = Internal desc = loading library from /home/xxx/Work/Sketchbook/hardware/arduino-git/esp32/libraries/I2S: invalid library: no header files found"
To reproduce
It's probably a race condition. Therefore, there is no clear way to reproduce it. Try updating all outdated libraries in IDE2.
Expected behavior
There is no concurrency error when installing libraries with the CLI daemon.
Arduino CLI version
arduino-cli version 0.35.0-rc.7
Operating system
N/A
Operating system version
n/a
Additional context
Maybe related: #1828.
Related in IDE2: arduino/arduino-ide#1389.
It's causing a daemon process crash in IDE2, and the app becomes non-functional.
Issue checklist
- I searched for previous reports in the issue tracker
- I verified the problem still occurs when using the nightly build
- My report contains all necessary details