Skip to content

[grpc]: error: concurrent map iteration and map write when executing lib list #2457

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
3 tasks done
kittaakos opened this issue Dec 11, 2023 · 0 comments · Fixed by #2480
Closed
3 tasks done

[grpc]: error: concurrent map iteration and map write when executing lib list #2457

kittaakos opened this issue Dec 11, 2023 · 0 comments · Fixed by #2480
Assignees
Labels
topic: code Related to content of the project itself topic: gRPC Related to the gRPC interface type: imperfection Perceived defect in any part of project

Comments

@kittaakos
Copy link
Contributor

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/[email protected]/server.go:1343 +0xe03
google.golang.org/grpc.(*Server).handleStream(0xc00025e1e0, {0x11ef920, 0xc00040e1a0}, 0xc0000e0120)
        /go/pkg/mod/google.golang.org/[email protected]/server.go:1737 +0xc4c
google.golang.org/grpc.(*Server).serveStreams.func1.1()
        /go/pkg/mod/google.golang.org/[email protected]/server.go:986 +0x86
created by google.golang.org/grpc.(*Server).serveStreams.func1 in goroutine 20
        /go/pkg/mod/google.golang.org/[email protected]/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"

lib_list.txt

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
@kittaakos kittaakos added topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project topic: gRPC Related to the gRPC interface labels Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself topic: gRPC Related to the gRPC interface type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants