Skip to content

fatal error: concurrent map read and map write with config set command on Windows #3103

@dankeboy36

Description

@dankeboy36

Describe the problem

Hello, I have updated from 1.2.2 to 1.4.1 CLI, and my integration tests started to fail on Windows

To reproduce

My CI code tries to set the config path, but fails with a go panic. I have this test set up for some time, and I have not hit this error before.

The error in Node.js:

_aborted: false,
    _options: { timeout: undefined, persist: false, throwOnError: true },
    _command: 'D:\\a\\trbr\\trbr\\.arduino-cli\\arduino-cli.exe',
    _args: [
      'config',
      'set',
      'directories.data',
      'D:\\a\\trbr\\trbr\\.test-resources\\envs\\cli\\Arduino15',
      '--config-file',
      'D:\\a\\trbr\\trbr\\.test-resources\\envs\\cli\\arduino-cli.yaml'
    ],
fatal error: concurrent map read and map write

goroutine 18 [running]:
internal/runtime/maps.fatal({0x1c415af?, 0x1a3d7e0?})
    /opt/hostedtoolcache/go/1.24.11/x64/src/runtime/panic.go:1058 +0x18

github.com/arduino/arduino-cli/internal/go-configmap.Map.get({0xc00015d7a0?, 0xc00015d7d0?}, {0xc00021dd40, 0x2, 0x2})
    /home/runner/work/arduino-cli/arduino-cli/internal/go-configmap/configuration.go:52 +0x52

github.com/arduino/arduino-cli/internal/go-configmap.Map.GetOk({0xc00015d7a0?, 0xc00015d7d0?}, {0x1c36b76?, 0xfcb75c?})
    /home/runner/work/arduino-cli/arduino-cli/internal/go-configmap/configuration.go:45 +0x65

github.com/arduino/arduino-cli/internal/go-configmap.Map.GetBoolOk({0xc00015d7a0?, 0xc00015d7d0?}, {0x1c36b76, 0x1b})
    /home/runner/work/arduino-cli/arduino-cli/internal/go-configmap/types.go:51 +0x2b

github.com/arduino/arduino-cli/internal/go-configmap.Map.GetBool({0xc00015d7a0?, 0xc00015d7d0?}, {0x1c36b76?, 0xc00023eaa0?})
    /home/runner/work/arduino-cli/arduino-cli/internal/go-configmap/types.go:62 +0x25

github.com/arduino/arduino-cli/commands.(*arduinoCoreServerImpl).shouldCheckForUpdate(0xc000114588, 0xc000218820)
    /home/runner/work/arduino-cli/arduino-cli/commands/service_check_for_updates.go:69 +0xb1

github.com/arduino/arduino-cli/commands.(*arduinoCoreServerImpl).CheckForArduinoCLIUpdates(
    0xc000114588,
    {0x201e3c8, 0xc00015d770},
    0xc000234ab0,
)
    /home/runner/work/arduino-cli/arduino-cli/commands/service_check_for_updates.go:36 +0x7b

github.com/arduino/arduino-cli/internal/cli.NewCommand.func1.2()
    /home/runner/work/arduino-cli/arduino-cli/internal/cli/cli.go:118 +0x76

created by github.com/arduino/arduino-cli/internal/cli.NewCommand.func1 in goroutine 1
    /home/runner/work/arduino-cli/arduino-cli/internal/cli/cli.go:117 +0x38a



goroutine 1 [runnable]:

gopkg.in/yaml.v3.keyList.Less({0xc0003abf50?, 0x2?, 0x2?}, 0x1?, 0x0?)
    /home/runner/go/pkg/mod/gopkg.in/yaml.v3@v3.0.1/sorter.go:27 +0x98f

sort.insertionSort({0x201c6f0, 0xc000114ea0}, 0x0, 0x2)
    /opt/hostedtoolcache/go/1.24.11/x64/src/sort/zsortinterface.go:12 +0xa7

sort.pdqsort({0x201c6f0, 0xc000114ea0}, 0x18?, 0x1a52b00?, 0x1ac5801?)
    /opt/hostedtoolcache/go/1.24.11/x64/src/sort/zsortinterface.go:73 +0x305

sort.Sort({0x201c6f0, 0xc000114ea0})
    /opt/hostedtoolcache/go/1.24.11/x64/src/sort/sort.go:54 +0x54

gopkg.in/yaml.v3.(*encoder).marshal.(*encoder).mapv.func1()
    /home/runner/go/pkg/mod/gopkg.in/yaml.v3@v3.0.1/encode.go:189 +0x65

gopkg.in/yaml.v3.(*encoder).mappingv(0xc0002e4808, {0x0?, 0x0}, 0xc0001db310)
    /home/runner/go/pkg/mod/gopkg.in/yaml.v3@v3.0.1/encode.go:265 +0x14a

gopkg.in/yaml.v3.(*encoder).marshal(0xc0002e4808, {0x0, 0x0}, {0x1ac5880?, 0xc00015d7a0?, 0x1?})
    /home/runner/go/pkg/mod/gopkg.in/yaml.v3@v3.0.1/encode.go:164 +0x7bf

gopkg.in/yaml.v3.(*encoder).marshal(0xc0002e4808, {0x0, 0x0}, {0x1c0c180?, 0xc00011a8b0?, 0xc0001db538?})
    /home/runner/go/pkg/mod/gopkg.in/yaml.v3@v3.0.1/encode.go:148 +0x8fa

gopkg.in/yaml.v3.(*encoder).marshalDoc(0xc0002e4808, {0x0, 0x0}, {0x1c0c180?, 0xc00011a8b0?, 0x1aefa20?})
    /home/runner/go/pkg/mod/gopkg.in/yaml.v3@v3.0.1/encode.go:105 +0x12e

gopkg.in/yaml.v3.Marshal({0x1c0c180, 0xc00011a8b0})
    /home/runner/go/pkg/mod/gopkg.in/yaml.v3@v3.0.1/yaml.go:222 +0x316

github.com/arduino/arduino-cli/commands.(*arduinoCoreServerImpl).ConfigurationSave(...)
    /home/runner/work/arduino-cli/arduino-cli/commands/service_settings.go:174 +0x5d

github.com/arduino/arduino-cli/internal/cli/config.saveConfiguration(...)
    /home/runner/work/arduino-cli/arduino-cli/internal/cli/config/config.go:83 +0x82

github.com/arduino/arduino-cli/internal/cli/config.runSetCommand(...)
    /home/runner/work/arduino-cli/arduino-cli/internal/cli/config/set.go:77 +0x2c5

github.com/arduino/arduino-cli/internal/cli/config.initSetCommand.func1(...)
    /home/runner/work/arduino-cli/arduino-cli/internal/cli/config/set.go:43 +0x45

github.com/spf13/cobra.(*Command).execute(...)
    /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.10.2/command.go:1019 +0xa91

github.com/spf13/cobra.(*Command).ExecuteC(...)
    /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.10.2/command.go:1148 +0x46f

main.main()
    /home/runner/work/arduino-cli/arduino-cli/main.go:92 +0x468

Raw error:

2026-02-13T15:44:12.6765026Z   output: {
2026-02-13T15:44:12.6765831Z     stderr: 'fatal error: concurrent map read and map write\n' +
2026-02-13T15:44:12.6766173Z       '\n' +
2026-02-13T15:44:12.6766375Z       'goroutine 18 [running]:\n' +
2026-02-13T15:44:12.6766755Z       'internal/runtime/maps.fatal({0x1c415af?, 0x1a3d7e0?})\n' +
2026-02-13T15:44:12.6767221Z       '\t/opt/hostedtoolcache/go/1.24.11/x64/src/runtime/panic.go:1058 +0x18\n' +
2026-02-13T15:44:12.6767935Z       'github.com/arduino/arduino-cli/internal/go-configmap.Map.get({0xc00015d7a0?, 0xc00015d7d0?}, {0xc00021dd40, 0x2, 0x2})\n' +
2026-02-13T15:44:12.6768728Z       '\t/home/runner/work/arduino-cli/arduino-cli/internal/go-configmap/configuration.go:52 +0x52\n' +
2026-02-13T15:44:12.6769515Z       'github.com/arduino/arduino-cli/internal/go-configmap.Map.GetOk({0xc00015d7a0?, 0xc00015d7d0?}, {0x1c36b76?, 0xfcb75c?})\n' +
2026-02-13T15:44:12.6770295Z       '\t/home/runner/work/arduino-cli/arduino-cli/internal/go-configmap/configuration.go:45 +0x65\n' +
2026-02-13T15:44:12.6771083Z       'github.com/arduino/arduino-cli/internal/go-configmap.Map.GetBoolOk({0xc00015d7a0?, 0xc00015d7d0?}, {0x1c36b76, 0x1b})\n' +
2026-02-13T15:44:12.6771818Z       '\t/home/runner/work/arduino-cli/arduino-cli/internal/go-configmap/types.go:51 +0x2b\n' +
2026-02-13T15:44:12.6772579Z       'github.com/arduino/arduino-cli/internal/go-configmap.Map.GetBool({0xc00015d7a0?, 0xc00015d7d0?}, {0x1c36b76?, 0xc00023eaa0?})\n' +
2026-02-13T15:44:12.6773336Z       '\t/home/runner/work/arduino-cli/arduino-cli/internal/go-configmap/types.go:62 +0x25\n' +
2026-02-13T15:44:12.6788115Z       'github.com/arduino/arduino-cli/commands.(*arduinoCoreServerImpl).shouldCheckForUpdate(0xc000114588, 0xc000218820)\n' +
2026-02-13T15:44:12.6789561Z       '\t/home/runner/work/arduino-cli/arduino-cli/commands/service_check_for_updates.go:69 +0xb1\n' +
2026-02-13T15:44:12.6790819Z       'github.com/arduino/arduino-cli/commands.(*arduinoCoreServerImpl).CheckForArduinoCLIUpdates(0xc000114588, {0x201e3c8, 0xc00015d770}, 0xc000234ab0)\n' +
2026-02-13T15:44:12.6792222Z       '\t/home/runner/work/arduino-cli/arduino-cli/commands/service_check_for_updates.go:36 +0x7b\n' +
2026-02-13T15:44:12.6793224Z       'github.com/arduino/arduino-cli/internal/cli.NewCommand.func1.2()\n' +
2026-02-13T15:44:12.6794096Z       '\t/home/runner/work/arduino-cli/arduino-cli/internal/cli/cli.go:118 +0x76\n' +
2026-02-13T15:44:12.6795075Z       'created by github.com/arduino/arduino-cli/internal/cli.NewCommand.func1 in goroutine 1\n' +
2026-02-13T15:44:12.6796086Z       '\t/home/runner/work/arduino-cli/arduino-cli/internal/cli/cli.go:117 +0x38a\n' +
2026-02-13T15:44:12.6796707Z       '\n' +
2026-02-13T15:44:12.6797012Z       'goroutine 1 [runnable]:\n' +
2026-02-13T15:44:12.6797679Z       'gopkg.in/yaml%2ev3.keyList.Less({0xc0003abf50?, 0x2?, 0x2?}, 0x1?, 0x0?)\n' +
2026-02-13T15:44:12.6798600Z       '\t/home/runner/go/pkg/mod/gopkg.in/yaml.v3@v3.0.1/sorter.go:27 +0x98f\n' +
2026-02-13T15:44:12.6799379Z       'sort.insertionSort({0x201c6f0, 0xc000114ea0}, 0x0, 0x2)\n' +
2026-02-13T15:44:12.6800142Z       '\t/opt/hostedtoolcache/go/1.24.11/x64/src/sort/zsortinterface.go:12 +0xa7\n' +
2026-02-13T15:44:12.6800673Z       'sort.pdqsort({0x201c6f0, 0xc000114ea0}, 0x18?, 0x1a52b00?, 0x1ac5801?)\n' +
2026-02-13T15:44:12.6801188Z       '\t/opt/hostedtoolcache/go/1.24.11/x64/src/sort/zsortinterface.go:73 +0x305\n' +
2026-02-13T15:44:12.6801594Z       'sort.Sort({0x201c6f0, 0xc000114ea0})\n' +
2026-02-13T15:44:12.6801976Z       '\t/opt/hostedtoolcache/go/1.24.11/x64/src/sort/sort.go:54 +0x54\n' +
2026-02-13T15:44:12.6802808Z       'gopkg.in/yaml%2ev3.(*encoder).marshal.(*encoder).mapv.func1()\n' +
2026-02-13T15:44:12.6803290Z       '\t/home/runner/go/pkg/mod/gopkg.in/yaml.v3@v3.0.1/encode.go:189 +0x65\n' +
2026-02-13T15:44:12.6804749Z       'gopkg.in/yaml%2ev3.(*encoder).mappingv(0xc0002e4808, {0x0?, 0x0}, 0xc0001db310)\n' +
2026-02-13T15:44:12.6805296Z       '\t/home/runner/go/pkg/mod/gopkg.in/yaml.v3@v3.0.1/encode.go:265 +0x14a\n' +
2026-02-13T15:44:12.6805831Z       'gopkg.in/yaml%2ev3.(*encoder).mapv(...)\n' +
2026-02-13T15:44:12.6806247Z       '\t/home/runner/go/pkg/mod/gopkg.in/yaml.v3@v3.0.1/encode.go:187\n' +
2026-02-13T15:44:12.6806825Z       'gopkg.in/yaml%2ev3.(*encoder).marshal(0xc0002e4808, {0x0, 0x0}, {0x1ac5880?, 0xc00015d7a0?, 0x1?})\n' +
2026-02-13T15:44:12.6807398Z       '\t/home/runner/go/pkg/mod/gopkg.in/yaml.v3@v3.0.1/encode.go:164 +0x7bf\n' +
2026-02-13T15:44:12.6808224Z       'gopkg.in/yaml%2ev3.(*encoder).marshal(0xc0002e4808, {0x0, 0x0}, {0x1c0c180?, 0xc00011a8b0?, 0xc0001db538?})\n' +
2026-02-13T15:44:12.6809225Z       '\t/home/runner/go/pkg/mod/gopkg.in/yaml.v3@v3.0.1/encode.go:148 +0x8fa\n' +
2026-02-13T15:44:12.6810282Z       'gopkg.in/yaml%2ev3.(*encoder).marshalDoc(0xc0002e4808, {0x0, 0x0}, {0x1c0c180?, 0xc00011a8b0?, 0x1aefa20?})\n' +
2026-02-13T15:44:12.6811361Z       '\t/home/runner/go/pkg/mod/gopkg.in/yaml.v3@v3.0.1/encode.go:105 +0x12e\n' +
2026-02-13T15:44:12.6812123Z       'gopkg.in/yaml%2ev3.Marshal({0x1c0c180, 0xc00011a8b0})\n' +
2026-02-13T15:44:12.6812871Z       '\t/home/runner/go/pkg/mod/gopkg.in/yaml.v3@v3.0.1/yaml.go:222 +0x316\n' +
2026-02-13T15:44:12.6814113Z       'github.com/arduino/arduino-cli/commands.(*arduinoCoreServerImpl).ConfigurationSave(0x10?, {0x31?, 0x40?}, 0xc000108720?)\n' +
2026-02-13T15:44:12.6815419Z       '\t/home/runner/work/arduino-cli/arduino-cli/commands/service_settings.go:174 +0x5d\n' +
2026-02-13T15:44:12.6816796Z       'github.com/arduino/arduino-cli/internal/cli/config.saveConfiguration({0x201e3c8, 0xc00015d770}, {0x20330a8, 0xc000114588})\n' +
2026-02-13T15:44:12.6818141Z       '\t/home/runner/work/arduino-cli/arduino-cli/internal/cli/config/config.go:83 +0x82\n' +
2026-02-13T15:44:12.6819748Z       'github.com/arduino/arduino-cli/internal/cli/config.runSetCommand({0x201e3c8, 0xc00015d770}, {0x20330a8, 0xc000114588}, {0xc000135640, 0x2, 0x4})\n' +
2026-02-13T15:44:12.6821172Z       '\t/home/runner/work/arduino-cli/arduino-cli/internal/cli/config/set.go:77 +0x2c5\n' +
2026-02-13T15:44:12.6822878Z       'github.com/arduino/arduino-cli/internal/cli/config.initSetCommand.func1(0xc0003a7b08?, {0xc000135640?, 0x4?, 0x1c159ac?})\n' +
2026-02-13T15:44:12.6824185Z       '\t/home/runner/work/arduino-cli/arduino-cli/internal/cli/config/set.go:43 +0x45\n' +
2026-02-13T15:44:12.6825126Z       'github.com/spf13/cobra.(*Command).execute(0xc0003a7b08, {0xc000135600, 0x4, 0x4})\n' +
2026-02-13T15:44:12.6826084Z       '\t/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.10.2/command.go:1019 +0xa91\n' +
2026-02-13T15:44:12.6826982Z       'github.com/spf13/cobra.(*Command).ExecuteC(0xc00029a308)\n' +
2026-02-13T15:44:12.6827836Z       '\t/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.10.2/command.go:1148 +0x46f\n' +
2026-02-13T15:44:12.6828619Z       'github.com/spf13/cobra.(*Command).Execute(...)\n' +
2026-02-13T15:44:12.6829361Z       '\t/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.10.2/command.go:1071\n' +
2026-02-13T15:44:12.6830163Z       'github.com/spf13/cobra.(*Command).ExecuteContext(...)\n' +
2026-02-13T15:44:12.6830954Z       '\t/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.10.2/command.go:1064\n' +
2026-02-13T15:44:12.6831577Z       'main.main()\n' +
2026-02-13T15:44:12.6832107Z       '\t/home/runner/work/arduino-cli/arduino-cli/main.go:92 +0x468\n',
2026-02-13T15:44:12.6832657Z     stdout: '',
2026-02-13T15:44:12.6832932Z     exitCode: 2
2026-02-13T15:44:12.6833192Z   }
2026-02-13T15:44:12.6833414Z }

Expected behavior

config set does not fail regardless of the OS.

Arduino CLI version

1.4.1

Operating system

Windows

Operating system version

Microsoft Windows Server 2025, 10.0.26100, GitHub Action Runner image windows-2025

Additional context

Update:

I have updated from 1.2.2 to 1.4.1 CLI

I am not saying the panic is OS or version update related.

Since then, I could not reproduce the failure. Perhaps it's a race condition when setting the config file and reading the auto-update value.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: imperfectionPerceived defect in any part of project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions