Skip to content

Fatal error: concurrent map read and map write #414

@albulescu

Description

@albulescu

Describe the bug
fatal error: concurrent map read and map write

goroutine 115 [running]:
go.uber.org/dig.(*constructorNode).CopyOrder(0x140002e3200, 0x14000168dc0, 0x14000800500)
/Users/cosmin/go/pkg/mod/go.uber.org/[email protected]/constructor.go:134 +0x40
go.uber.org/dig.(*Scope).Scope(0x14000168dc0, {0x102fc3dfb, 0x7}, {0x0, 0x0, 0x0})
/Users/cosmin/go/pkg/mod/go.uber.org/[email protected]/scope.go:127 +0x2b8
go.uber.org/dig.(*Container).Scope(0x140000807f8, {0x102fc3dfb, 0x7}, {0x0, 0x0, 0x0})
/Users/cosmin/go/pkg/mod/go.uber.org/[email protected]/container.go:259 +0x5c

To Reproduce

scope := di.Container().Scope("request")

		if err := scope.Provide(func() Context { return &EchoContext{c} }); err != nil {
			return err
		}

		if err := scope.Invoke(handler); err != nil {
			return err
		}

Expected behavior
A clear and concise description of what you expected to happen.

Additional context

// CopyOrder copies the order for the given parent scope to the given child scope.
func (n *constructorNode) CopyOrder(parent, child *Scope) {
	n.orders[child] = n.orders[parent]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions