Skip to content

[BUG] fatal error: concurrent map iteration and map write during compose command #13866

Description

@bovy89

Description

Description

We are using docker/docker-compose in a docker-in-docker context, but the problem should exists regardless of this type of usage.

Locally (linux or MacOS ARM) a docker-in-docker image is executed and then docker compose up will be executed inside it.

We are experiencing this problem on MacOS ARM but not on linux systems, but it is not clear if it depends on the base version of docker (see versions below).

docker compose up returns

fatal error: concurrent map iteration and map write

The complete stacktrace: fatal error: concurrent map iteration and map write

goroutine 1 [running]:
internal/runtime/maps.fatal({0x143b03a?, 0x2025a98?})
runtime/panic.go:1181 +0x18
internal/runtime/maps.(*Iter).Next(0x2299cf325610?)
internal/runtime/maps/table.go:819 +0x86
github.com/santhosh-tekuri/jsonschema/v6.(*roots)._collectResources(0x2299cefc4480, 0x2299cf225980, {0x1257380, 0x2299cf23d860}, {0x2299cf1b6ae0, 0x1e}, {0x2299cf0a2d20, 0x21}, {0x200eb00, {0x0, ...}})
github.com/santhosh-tekuri/jsonschema/v6@v6.0.1/roots.go:173 +0xb45
github.com/santhosh-tekuri/jsonschema/v6.(*roots).collectResources(0x2299cefc4480, 0x2299cf225980, {0x1257380, 0x2299cf23d860}, {0x2299cf1b6ae0, 0x1e}, {0x2299cf0a2d20, 0x21}, {0x200eb00, {0x0, ...}})
github.com/santhosh-tekuri/jsonschema/v6@v6.0.1/roots.go:74 +0xe5
github.com/santhosh-tekuri/jsonschema/v6.(*roots)._collectResources(0x2299cefc4480, 0x2299cf225980, {0x1257380, 0x2299cf23c240}, {0x2299cf1b6ae0, 0x1e}, {0x2299cf168b80, 0xe}, {0x200eb00, {0x0, ...}})
github.com/santhosh-tekuri/jsonschema/v6@v6.0.1/roots.go:188 +0xd45
github.com/santhosh-tekuri/jsonschema/v6.(*roots).collectResources(0x2299cefc4480, 0x2299cf225980, {0x1257380, 0x2299cf23c240}, {0x2299cf1b6ae0, 0x1e}, {0x2299cf168b80, 0xe}, {0x200eb00, {0x0, ...}})
github.com/santhosh-tekuri/jsonschema/v6@v6.0.1/roots.go:74 +0xe5
github.com/santhosh-tekuri/jsonschema/v6.(*roots)._collectResources(0x2299cefc4480, 0x2299cf225980, {0x1257380, 0x2299cf235c20}, {0x2299cf36cc00, 0x1e}, {0x0, 0x0}, {0x200eb00, {0x0, ...}})
github.com/santhosh-tekuri/jsonschema/v6@v6.0.1/roots.go:188 +0xd45
github.com/santhosh-tekuri/jsonschema/v6.(*roots).collectResources(0x2299cefc4480, 0x2299cf225980, {0x1257380, 0x2299cf235c20}, {0x2299cf36cc00, 0x1e}, {0x0, 0x0}, {0x200eb00, {0x0, ...}})
github.com/santhosh-tekuri/jsonschema/v6@v6.0.1/roots.go:74 +0xe5
github.com/santhosh-tekuri/jsonschema/v6.(*roots).addRoot(0x2299cefc4480, {0x2299cf36cc00, 0x1e}, {0x1257380, 0x2299cf235c20})
github.com/santhosh-tekuri/jsonschema/v6@v6.0.1/roots.go:48 +0x145
github.com/santhosh-tekuri/jsonschema/v6.(*roots).orLoad(0x2299cefc4480, {0x2299cf36cc00, 0x1e})
github.com/santhosh-tekuri/jsonschema/v6@v6.0.1/roots.go:38 +0x85
github.com/santhosh-tekuri/jsonschema/v6.(*roots).resolveFragment(0x141b9d7?, {{0x2299cf36cc00?, 0x4047497500?}, {0x0?, 0x18?}})
github.com/santhosh-tekuri/jsonschema/v6@v6.0.1/roots.go:63 +0x27
github.com/santhosh-tekuri/jsonschema/v6.(*Compiler).Compile(0x2299cf235b30, {0x141b9d7?, 0x18?})
github.com/santhosh-tekuri/jsonschema/v6@v6.0.1/compiler.go:183 +0x4a
github.com/santhosh-tekuri/jsonschema/v6.(*Compiler).MustCompile(0x125f360?, {0x141b9d7, 0x11})
github.com/santhosh-tekuri/jsonschema/v6@v6.0.1/compiler.go:170 +0x25
github.com/compose-spec/compose-go/v2/schema.Validate(0x2299cf0b3320)
github.com/compose-spec/compose-go/v2@v2.11.0/schema/schema.go:64 +0x325
github.com/compose-spec/compose-go/v2/loader.loadYamlFile.func1({0x1257380?, 0x2299cf1ab230?}, {0x14b7c80, 0x2299cf2a5bd0})
github.com/compose-spec/compose-go/v2@v2.11.0/loader/loader.go:485 +0x37f
github.com/compose-spec/compose-go/v2/loader.loadYamlFile({0x14c5f78, 0x2299cf1ce9b0}, {{0x4000800b12, 0x22}, {0x2299cef38c00, 0x58e, 0x58f}, 0x0}, 0x2299cf24fe60, {0x4000800ae3, ...}, ...)
github.com/compose-spec/compose-go/v2@v2.11.0/loader/loader.go:521 +0x603
github.com/compose-spec/compose-go/v2/loader.loadYamlModel({0x14c5f78, 0x2299cf1ce9b0}, {{0x0, 0x0}, {0x4000800ae3, 0x18}, {0x2299cee50f00, 0x4, 0x4}, 0x2299cf0b30b0}, ...)
github.com/compose-spec/compose-go/v2@v2.11.0/loader/loader.go:381 +0x1b7
github.com/compose-spec/compose-go/v2/loader.load({0x14c5f78, 0x2299cf1ce9b0}, {{0x0, 0x0}, {0x4000800ae3, 0x18}, {0x2299cee50f00, 0x4, 0x4}, 0x2299cf0b30b0}, ...)
github.com/compose-spec/compose-go/v2@v2.11.0/loader/loader.go:542 +0x34d
github.com/compose-spec/compose-go/v2/loader.loadModelWithContext({0x14c5f78, 0x2299cf1ce9b0}, 0x2299cee8db40, 0x2299cf24fe60)
github.com/compose-spec/compose-go/v2@v2.11.0/loader/loader.go:353 +0xfb
github.com/compose-spec/compose-go/v2/loader.LoadWithContext({0x14c5f78, 0x2299cf1ce9b0}, {{0x0, 0x0}, {0x4000800ae3, 0x18}, {0x2299cee50f00, 0x4, 0x4}, 0x2299cf0b30b0}, ...)
github.com/compose-spec/compose-go/v2@v2.11.0/loader/loader.go:329 +0xd7
github.com/compose-spec/compose-go/v2/cli.(*ProjectOptions).LoadProject(0x2299cf077a40, {0x14c5f78, 0x2299cf1ce9b0})
github.com/compose-spec/compose-go/v2@v2.11.0/cli/options.go:455 +0x106
github.com/docker/compose/v5/pkg/compose.(*composeService).LoadProject(0x2299cee4b290, {0x14c5f78, 0x2299cf1ce9b0}, {{0x4000800ac9, 0x16}, {0x2299cf0e0880, 0x4, 0x4}, {0x0, 0x0}, ...})
github.com/docker/compose/v5/pkg/compose/loader.go:56 +0x4b5
github.com/docker/compose/v5/cmd/compose.(*ProjectOptions).ToProject(0x2299cee94000, {0x14c5f78, 0x2299cf1ce9b0}, {0x14d6a30, 0x2299cef18280}, {0x14defa0, 0x2299cee4b290}, {0x2046840, 0x0, 0x0}, ...)
github.com/docker/compose/v5/cmd/compose/compose.go:355 +0x4dd
github.com/docker/compose/v5/cmd/compose.upCommand.(*ProjectOptions).WithServices.func5({0x14c5f78, 0x2299cf1ce9b0}, {0x2046840, 0x0, 0x0})
github.com/docker/compose/v5/cmd/compose/compose.go:175 +0x12e
github.com/docker/compose/v5/cmd/compose.upCommand.(*ProjectOptions).WithServices.Adapt.func7({0x14c5f78?, 0x2299cf1ce9b0?}, 0x2?, {0x2046840?, 0x2299cee50e40?, 0x2299cee8aa80?})
github.com/docker/compose/v5/cmd/compose/compose.go:136 +0x30
github.com/docker/compose/v5/cmd/compose.upCommand.(*ProjectOptions).WithServices.Adapt.AdaptCmd.func8(0x2299cee96308, {0x2046840, 0x0, 0x0})
github.com/docker/compose/v5/cmd/compose/compose.go:120 +0x13d
github.com/docker/cli/cli-plugins/plugin.RunPlugin.func1.1.2(0x2299cee96308, {0x2046840, 0x0, 0x0})
github.com/docker/cli@v29.5.1+incompatible/cli-plugins/plugin/plugin.go:65 +0x64
github.com/docker/compose/v5/cmd/cmdtrace.Setup.wrapRunE.func2(0x2299cee96308?, {0x2046840?, 0x0?, 0x0?})
github.com/docker/compose/v5/cmd/cmdtrace/cmd_span.go:88 +0x63
github.com/spf13/cobra.(*Command).execute(0x2299cee96308, {0x2299cefce010, 0x0, 0x0})
github.com/spf13/cobra@v1.10.2/command.go:1015 +0xb14
github.com/spf13/cobra.(*Command).ExecuteC(0x2299cef94f08)
github.com/spf13/cobra@v1.10.2/command.go:1148 +0x465
github.com/spf13/cobra.(*Command).Execute(...)
github.com/spf13/cobra@v1.10.2/command.go:1071
github.com/docker/cli/cli-plugins/plugin.RunPlugin(0x2299cef18280, 0x2299cee96008, {{0x140c0d7, 0x5}, {0x1413df0, 0xb}, {0x14aefe0, 0x6}, {0x0, 0x0}, ...})
github.com/docker/cli@v29.5.1+incompatible/cli-plugins/plugin/plugin.go:80 +0x158
github.com/docker/cli/cli-plugins/plugin.Run(0x14a71b0, {{0x140c0d7, 0x5}, {0x1413df0, 0xb}, {0x14aefe0, 0x6}, {0x0, 0x0}, {0x0, ...}, ...}, ...)
github.com/docker/cli@v29.5.1+incompatible/cli-plugins/plugin/plugin.go:99 +0x15a
main.pluginMain()
github.com/docker/compose/v5/cmd/main.go:38 +0x168
main.main()
github.com/docker/compose/v5/cmd/main.go:85 +0x19e

Steps To Reproduce

Nothing special, just docker compose up. Regardless docker-in-docker usage:

  1. locally (linux or macos) docker run --rm <docker-in-docker-image>
  2. docker-in-docker-image (linux arch) exec docker compose up

Compose Version

docker-compose-plugin inside docker-in-docker-image:
- 5.1.3 --> works
- 5.1.4 --> do not work

Docker Environment

Docker version (Linux): 28.5.2
Docker version (ARM): 29.5.1

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions