Skip to content
This repository has been archived by the owner on Nov 18, 2021. It is now read-only.

panic with "fatal error: concurrent map read and map write" #382

Closed
shykes opened this issue May 8, 2020 · 4 comments
Closed

panic with "fatal error: concurrent map read and map write" #382

shykes opened this issue May 8, 2020 · 4 comments
Labels
concurrency The API is generally not concurrent, but track features anyway for reference. FeatureRequest New feature or request

Comments

@shykes
Copy link
Contributor

shykes commented May 8, 2020

What version of CUE are you using (cue version)?

Built with cuelang.org/go version:

cuelang.org/go v0.1.3-0.20200422190755-9c9cdba45dba h1:c+k1EF+tkhBRDgwR0+IICAbOC4QOT5MMR51r4ZpBz+w=
cuelang.org/go v0.1.3-0.20200422190755-9c9cdba45dba/go.mod h1:fqiLgsri/9JYLk6Us2l8W6jeWlvpHVaH3qfnYdobhSQ=

Does this issue reproduce with the latest release?

Yes.

What did you do?

Run custom evaluator built against cuelang.org/go

What did you expect to see?

Successful evaluation.

What did you see instead?

A panic with the following stack trace.

11:49AM INF running task task=TestRequest.testJSON
fatal error: concurrent map read and map write

goroutine 14 [running]:
runtime.throw(0x1cb77ff, 0x21)
	/usr/local/Cellar/go/1.13.8/libexec/src/runtime/panic.go:774 +0x72 fp=0xc000657290 sp=0xc000657260 pc=0x102fd82
runtime.mapaccess2_faststr(0x1b3eae0, 0xc0001d39e0, 0x1c9a826, 0x3, 0x1e3b3c0, 0xc000330140)
	/usr/local/Cellar/go/1.13.8/libexec/src/runtime/map_faststr.go:116 +0x48f fp=0xc000657300 sp=0xc000657290 pc=0x1014bff
cuelang.org/go/cue.(*index).findLabel(0xc000117380, 0x1c9a826, 0x3, 0xc000657390)
	$HOME/go/pkg/mod/cuelang.org/go@v0.1.3-0.20200422190755-9c9cdba45dba/cue/build.go:284 +0x70 fp=0xc000657348 sp=0xc000657300 pc=0x1535dc0
cuelang.org/go/cue.(*index).label(0xc000117380, 0x1c9a826, 0x3, 0x203000, 0x590)
	$HOME/go/pkg/mod/cuelang.org/go@v0.1.3-0.20200422190755-9c9cdba45dba/cue/build.go:293 +0x43 fp=0xc0006573a0 sp=0xc000657348 pc=0x1535e33
cuelang.org/go/cue.(*index).strLabel(...)
	$HOME/go/pkg/mod/cuelang.org/go@v0.1.3-0.20200422190755-9c9cdba45dba/cue/build.go:267
cuelang.org/go/cue.(*structValue).Lookup(0xc0006574a0, 0x1c9a826, 0x3, 0x10101000000, 0x0)
	$HOME/go/pkg/mod/cuelang.org/go@v0.1.3-0.20200422190755-9c9cdba45dba/cue/types.go:162 +0x4f fp=0xc000657408 sp=0xc0006573a0 pc=0x15768df
cuelang.org/go/cue.Value.Lookup(0xc000117380, 0xc0005145a0, 0xc000657600, 0x1, 0x1, 0xc000117380, 0xc000514ff0)
	$HOME/go/pkg/mod/cuelang.org/go@v0.1.3-0.20200422190755-9c9cdba45dba/cue/types.go:1463 +0x191 fp=0xc000657510 sp=0xc000657408 pc=0x1580c51
github.com/blocklayerhq/blocklayer/blr/runtime.directoryToLLB(0xc000117380, 0xc0005145a0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	$HOME/Documents/blocklayer/blocklayer/bl/runtime/runtime/util.go:101 +0x294 fp=0xc000657730 sp=0xc000657510 pc=0x195f5d4
github.com/blocklayerhq/blocklayer/blr/runtime.(*runHandler).getImage(0xc0005ae3e0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	$HOME/Documents/blocklayer/blocklayer/bl/runtime/runtime/run.go:164 +0xc7 fp=0xc000657908 sp=0xc000657730 pc=0x19574c7
github.com/blocklayerhq/blocklayer/blr/runtime.(*runHandler).Run(0xc0005ae3e0, 0x1e2fa40, 0xc00054efc0, 0xc00012ee00, 0x1e11720, 0xc0005ae3e0, 0x5eb5a9a7, 0x7fd9bc8, 0x8e25c8a344b9)
	$HOME/Documents/blocklayer/blocklayer/bl/runtime/runtime/run.go:52 +0xc7 fp=0xc000657ca8 sp=0xc000657908 pc=0x1955ff7
github.com/blocklayerhq/blocklayer/blr/runtime.(*Task).Run(0xc000590740, 0x1e2fa40, 0xc00054efc0, 0xc000117380, 0xc000375180, 0xc00012ee00, 0xf, 0x0, 0x0, 0x0, ...)
	$HOME/Documents/blocklayer/blocklayer/bl/runtime/runtime/task.go:65 +0xbb fp=0xc000657d00 sp=0xc000657ca8 pc=0x195e6fb
github.com/blocklayerhq/blocklayer/blr/runtime.Run.func1(0x0, 0x0)
	$HOME/Documents/blocklayer/blocklayer/bl/runtime/runtime/runtime.go:166 +0x43c fp=0xc000657f58 sp=0xc000657d00 pc=0x1960e9c
golang.org/x/sync/errgroup.(*Group).Go.func1(0xc00054ef30, 0xc0004ab770)
	$HOME/go/pkg/mod/golang.org/x/sync@v0.0.0-20200317015054-43a5402ce75a/errgroup/errgroup.go:57 +0x64 fp=0xc000657fd0 sp=0xc000657f58 pc=0x13b4134
runtime.goexit()
	/usr/local/Cellar/go/1.13.8/libexec/src/runtime/asm_amd64.s:1357 +0x1 fp=0xc000657fd8 sp=0xc000657fd0 pc=0x105d111
created by golang.org/x/sync/errgroup.(*Group).Go
	$HOME/go/pkg/mod/golang.org/x/sync@v0.0.0-20200317015054-43a5402ce75a/errgroup/errgroup.go:54 +0x66

goroutine 1 [semacquire]:
sync.runtime_Semacquire(0xc00054ef40)
	/usr/local/Cellar/go/1.13.8/libexec/src/runtime/sema.go:56 +0x42
sync.(*WaitGroup).Wait(0xc00054ef38)
	/usr/local/Cellar/go/1.13.8/libexec/src/sync/waitgroup.go:130 +0x64
golang.org/x/sync/errgroup.(*Group).Wait(0xc00054ef30, 0xc0004ab860, 0xc0002ad3c0)
	$HOME/go/pkg/mod/golang.org/x/sync@v0.0.0-20200317015054-43a5402ce75a/errgroup/errgroup.go:40 +0x31
github.com/blocklayerhq/blocklayer/blr/runtime.Run(0x1e2fa40, 0xc00015fa40, 0xc00012ee00, 0xc0001d5dd0, 0xe, 0x10, 0xc0001d5dd0, 0x0, 0x0, 0x2, ...)
	$HOME/Documents/blocklayer/blocklayer/bl/runtime/runtime/runtime.go:215 +0x96a
github.com/blocklayerhq/blocklayer/blr/cmd.glob..func8(0x25774a0, 0xc00012ed00, 0x0, 0x4)
	$HOME/Documents/blocklayer/blocklayer/bl/runtime/cmd/test.go:79 +0x4a5
github.com/spf13/cobra.(*Command).execute(0x25774a0, 0xc00012ecc0, 0x4, 0x4, 0x25774a0, 0xc00012ecc0)
	$HOME/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:846 +0x2aa
github.com/spf13/cobra.(*Command).ExecuteC(0x2576f60, 0x103d9ea, 0x2516900, 0xc000000180)
	$HOME/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:950 +0x349
github.com/spf13/cobra.(*Command).Execute(...)
	$HOME/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:887
github.com/blocklayerhq/blocklayer/blr/cmd.Execute()
	$HOME/Documents/blocklayer/blocklayer/bl/runtime/cmd/root.go:114 +0x31
main.main()
	$HOME/Documents/blocklayer/blocklayer/bl/runtime/main.go:6 +0x20

goroutine 6 [syscall]:
os/signal.signal_recv(0x0)
	/usr/local/Cellar/go/1.13.8/libexec/src/runtime/sigqueue.go:144 +0x96
os/signal.loop()
	/usr/local/Cellar/go/1.13.8/libexec/src/os/signal/signal_unix.go:23 +0x22
created by os/signal.init.0
	/usr/local/Cellar/go/1.13.8/libexec/src/os/signal/signal_unix.go:29 +0x41

goroutine 8 [chan receive]:
github.com/moby/buildkit/util/appcontext.Context.func1.1(0xc0000d19e0, 0xc00016d9f0, 0xc000153148)
	$HOME/go/pkg/mod/github.com/moby/buildkit@v0.7.1-0.20200429212254-99b2abfb7660/util/appcontext/appcontext.go:30 +0x38
created by github.com/moby/buildkit/util/appcontext.Context.func1
	$HOME/go/pkg/mod/github.com/moby/buildkit@v0.7.1-0.20200429212254-99b2abfb7660/util/appcontext/appcontext.go:28 +0xfe

goroutine 9 [select]:
google.golang.org/grpc.(*ccBalancerWrapper).watcher(0xc00012ef80)
	$HOME/go/pkg/mod/google.golang.org/grpc@v1.27.1/balancer_conn_wrappers.go:69 +0xc2
created by google.golang.org/grpc.newCCBalancerWrapper
	$HOME/go/pkg/mod/google.golang.org/grpc@v1.27.1/balancer_conn_wrappers.go:60 +0x16d

goroutine 10 [chan receive]:
google.golang.org/grpc.(*addrConn).resetTransport(0xc00016b340)
	$HOME/go/pkg/mod/google.golang.org/grpc@v1.27.1/clientconn.go:1179 +0x6ea
created by google.golang.org/grpc.(*addrConn).connect
	$HOME/go/pkg/mod/google.golang.org/grpc@v1.27.1/clientconn.go:815 +0x128

goroutine 38 [IO wait]:
internal/poll.runtime_pollWait(0x6c51b68, 0x72, 0xffffffffffffffff)
	/usr/local/Cellar/go/1.13.8/libexec/src/runtime/netpoll.go:184 +0x55
internal/poll.(*pollDesc).wait(0xc00023c378, 0x72, 0x8001, 0x8000, 0xffffffffffffffff)
	/usr/local/Cellar/go/1.13.8/libexec/src/internal/poll/fd_poll_runtime.go:87 +0x45
internal/poll.(*pollDesc).waitRead(...)
	/usr/local/Cellar/go/1.13.8/libexec/src/internal/poll/fd_poll_runtime.go:92
internal/poll.(*FD).Read(0xc00023c360, 0xc000224000, 0x8000, 0x8000, 0x0, 0x0, 0x0)
	/usr/local/Cellar/go/1.13.8/libexec/src/internal/poll/fd_unix.go:169 +0x22b
os.(*File).read(...)
	/usr/local/Cellar/go/1.13.8/libexec/src/os/file_unix.go:259
os.(*File).Read(0xc0001de028, 0xc000224000, 0x8000, 0x8000, 0x0, 0x0, 0x0)
	/usr/local/Cellar/go/1.13.8/libexec/src/os/file.go:116 +0x71
io.copyBuffer(0x1e11780, 0xc0003ce0a0, 0x1e12920, 0xc0001de028, 0xc000224000, 0x8000, 0x8000, 0x0, 0x0, 0x12)
	/usr/local/Cellar/go/1.13.8/libexec/src/io/io.go:402 +0x122
io.Copy(...)
	/usr/local/Cellar/go/1.13.8/libexec/src/io/io.go:364
os/exec.(*Cmd).writerDescriptor.func1(0x0, 0x0)
	/usr/local/Cellar/go/1.13.8/libexec/src/os/exec/exec.go:311 +0x63
os/exec.(*Cmd).Start.func1(0xc000442000, 0xc0003ce180)
	/usr/local/Cellar/go/1.13.8/libexec/src/os/exec/exec.go:435 +0x27
created by os/exec.(*Cmd).Start
	/usr/local/Cellar/go/1.13.8/libexec/src/os/exec/exec.go:434 +0x608

goroutine 39 [select]:
os/exec.(*Cmd).Start.func2(0xc000442000)
	/usr/local/Cellar/go/1.13.8/libexec/src/os/exec/exec.go:443 +0xc4
created by os/exec.(*Cmd).Start
	/usr/local/Cellar/go/1.13.8/libexec/src/os/exec/exec.go:442 +0x6a6

goroutine 40 [IO wait]:
internal/poll.runtime_pollWait(0x6c51d08, 0x72, 0xffffffffffffffff)
	/usr/local/Cellar/go/1.13.8/libexec/src/runtime/netpoll.go:184 +0x55
internal/poll.(*pollDesc).wait(0xc00023c2b8, 0x72, 0x8001, 0x8000, 0xffffffffffffffff)
	/usr/local/Cellar/go/1.13.8/libexec/src/internal/poll/fd_poll_runtime.go:87 +0x45
internal/poll.(*pollDesc).waitRead(...)
	/usr/local/Cellar/go/1.13.8/libexec/src/internal/poll/fd_poll_runtime.go:92
internal/poll.(*FD).Read(0xc00023c2a0, 0xc00023e000, 0x8000, 0x8000, 0x0, 0x0, 0x0)
	/usr/local/Cellar/go/1.13.8/libexec/src/internal/poll/fd_unix.go:169 +0x22b
os.(*File).read(...)
	/usr/local/Cellar/go/1.13.8/libexec/src/os/file_unix.go:259
os.(*File).Read(0xc0001de018, 0xc00023e000, 0x8000, 0x8000, 0xc000201cf0, 0x102f381, 0x1ce7848)
	/usr/local/Cellar/go/1.13.8/libexec/src/os/file.go:116 +0x71
github.com/docker/cli/cli/connhelper/commandconn.(*commandConn).Read(0xc0001e2000, 0xc00023e000, 0x8000, 0x8000, 0xc000201d42, 0xc00062a390, 0xc000119900)
	$HOME/go/pkg/mod/github.com/docker/cli@v0.0.0-20200227165822-2298e6a3fe24/cli/connhelper/commandconn/commandconn.go:196 +0x56
bufio.(*Reader).Read(0xc00023c480, 0xc000238038, 0x9, 0x9, 0x20, 0xc000201d00, 0x169366c)
	/usr/local/Cellar/go/1.13.8/libexec/src/bufio/bufio.go:226 +0x26a
io.ReadAtLeast(0x1e111a0, 0xc00023c480, 0xc000238038, 0x9, 0x9, 0x9, 0xd64e85618c327301, 0x0, 0x0)
	/usr/local/Cellar/go/1.13.8/libexec/src/io/io.go:310 +0x87
io.ReadFull(...)
	/usr/local/Cellar/go/1.13.8/libexec/src/io/io.go:329
golang.org/x/net/http2.readFrameHeader(0xc000238038, 0x9, 0x9, 0x1e111a0, 0xc00023c480, 0x0, 0x0, 0x0, 0x0)
	$HOME/go/pkg/mod/golang.org/x/net@v0.0.0-20200421231249-e086a090c8fd/http2/frame.go:237 +0x87
golang.org/x/net/http2.(*Framer).ReadFrame(0xc000238000, 0xc00062a390, 0xc00062a390, 0x0, 0x0)
	$HOME/go/pkg/mod/golang.org/x/net@v0.0.0-20200421231249-e086a090c8fd/http2/frame.go:492 +0xa1
google.golang.org/grpc/internal/transport.(*http2Client).reader(0xc00025e000)
	$HOME/go/pkg/mod/google.golang.org/grpc@v1.27.1/internal/transport/http2_client.go:1265 +0x183
created by google.golang.org/grpc/internal/transport.newHTTP2Client
	$HOME/go/pkg/mod/google.golang.org/grpc@v1.27.1/internal/transport/http2_client.go:300 +0xd23

goroutine 41 [select]:
google.golang.org/grpc/internal/transport.(*controlBuffer).get(0xc000440230, 0x1, 0x0, 0x0, 0x0, 0x0)
	$HOME/go/pkg/mod/google.golang.org/grpc@v1.27.1/internal/transport/controlbuf.go:395 +0x122
google.golang.org/grpc/internal/transport.(*loopyWriter).run(0xc00023c660, 0x0, 0x0)
	$HOME/go/pkg/mod/google.golang.org/grpc@v1.27.1/internal/transport/controlbuf.go:513 +0x1e3
google.golang.org/grpc/internal/transport.newHTTP2Client.func3(0xc00025e000)
	$HOME/go/pkg/mod/google.golang.org/grpc@v1.27.1/internal/transport/http2_client.go:346 +0x7b
created by google.golang.org/grpc/internal/transport.newHTTP2Client
	$HOME/go/pkg/mod/google.golang.org/grpc@v1.27.1/internal/transport/http2_client.go:344 +0xedb

goroutine 138 [chan receive]:
github.com/moby/buildkit/client.(*Client).solve.func2.1.1(0xc0002a2a70)
	$HOME/go/pkg/mod/github.com/moby/buildkit@v0.7.1-0.20200429212254-99b2abfb7660/client/solve.go:181 +0x45
created by github.com/moby/buildkit/client.(*Client).solve.func2.1
	$HOME/go/pkg/mod/github.com/moby/buildkit@v0.7.1-0.20200429212254-99b2abfb7660/client/solve.go:180 +0x43

goroutine 16 [runnable]:
cuelang.org/go/cue/ast.IsValidIdent(0xc0001a97a1, 0x11, 0xc0001a97a1)
	$HOME/go/pkg/mod/cuelang.org/go@v0.1.3-0.20200422190755-9c9cdba45dba/cue/ast/ident.go:36 +0x186
cuelang.org/go/cue/ast.LabelName(0x1e392c0, 0xc0003362c0, 0xc00059a330, 0x0, 0x0, 0x0, 0x0)
	$HOME/go/pkg/mod/cuelang.org/go@v0.1.3-0.20200422190755-9c9cdba45dba/cue/ast/ident.go:194 +0x110
cuelang.org/go/cue.(*astVisitor).walk(0xc000336700, 0x1e35fc0, 0xc000294d90, 0x0, 0x0)
	$HOME/go/pkg/mod/cuelang.org/go@v0.1.3-0.20200422190755-9c9cdba45dba/cue/ast.go:483 +0x1649
cuelang.org/go/cue.(*astVisitor).walk(0xc0003366c0, 0x1e365c0, 0xc0002e2d20, 0x1e3bde0, 0xc000295030)
	$HOME/go/pkg/mod/cuelang.org/go@v0.1.3-0.20200422190755-9c9cdba45dba/cue/ast.go:294 +0x65b3
cuelang.org/go/cue.convertRec(0xc0005b0b00, 0x1e2fc00, 0xc00023d9e0, 0x6c12901, 0x1bfc420, 0xc0002e2d20, 0x6c12920, 0xc00020e000)
	$HOME/go/pkg/mod/cuelang.org/go@v0.1.3-0.20200422190755-9c9cdba45dba/cue/go.go:223 +0x4118
cuelang.org/go/cue.convert(0xc0005b0b00, 0x1e2fc00, 0xc00023d9e0, 0x1, 0x1bfc420, 0xc0002e2d20, 0xc0003db0a0, 0x0)
	$HOME/go/pkg/mod/cuelang.org/go@v0.1.3-0.20200422190755-9c9cdba45dba/cue/go.go:193 +0x72
cuelang.org/go/cue.(*builtin).call(0xc00023d9e0, 0xc0005b0b00, 0x1e2fc80, 0xc0002d6980, 0xc00059a0f0, 0x1, 0x1, 0x0, 0x0)
	$HOME/go/pkg/mod/cuelang.org/go@v0.1.3-0.20200422190755-9c9cdba45dba/cue/builtin.go:322 +0x29b
cuelang.org/go/cue.(*callExpr).evalPartial(0xc0002d6980, 0xc0005b0b00, 0x0, 0x0)
	$HOME/go/pkg/mod/cuelang.org/go@v0.1.3-0.20200422190755-9c9cdba45dba/cue/eval.go:341 +0x4ba
cuelang.org/go/cue.(*context).manifest(0xc0005b0b00, 0x1e3b600, 0xc0002d6980, 0x27abb28, 0x0)
	$HOME/go/pkg/mod/cuelang.org/go@v0.1.3-0.20200422190755-9c9cdba45dba/cue/evaluator.go:18 +0x3f
cuelang.org/go/cue.(*evaluator).eval(0xc0005f1380, 0x1e3b600, 0xc0002d6980, 0x600, 0x1cd1219, 0x40, 0xc00059a0d0, 0x1, 0x1, 0x203000, ...)
	$HOME/go/pkg/mod/cuelang.org/go@v0.1.3-0.20200422190755-9c9cdba45dba/cue/evaluator.go:83 +0x4f
cuelang.org/go/cue.(*selectorExpr).evalPartial(0xc000647410, 0xc0005b0b00, 0x0, 0x0)
	$HOME/go/pkg/mod/cuelang.org/go@v0.1.3-0.20200422190755-9c9cdba45dba/cue/eval.go:120 +0xfc
cuelang.org/go/cue.(*structLit).at(0xc0002cdea0, 0xc0005b0b00, 0x1, 0x0, 0xc0005f1598)
	$HOME/go/pkg/mod/cuelang.org/go@v0.1.3-0.20200422190755-9c9cdba45dba/cue/value.go:1072 +0x2ec
cuelang.org/go/cue.(*structLit).iterAt(0xc0002cdea0, 0xc0005b0b00, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
	$HOME/go/pkg/mod/cuelang.org/go@v0.1.3-0.20200422190755-9c9cdba45dba/cue/value.go:1036 +0x123
cuelang.org/go/cue.(*Iterator).Next(0xc000300460, 0x25a4be8)
	$HOME/go/pkg/mod/cuelang.org/go@v0.1.3-0.20200422190755-9c9cdba45dba/cue/types.go:266 +0xa1
github.com/blocklayerhq/blocklayer/blr/runtime.(*runHandler).getEnv(0xc000430920, 0xc0003038b0, 0xc000153301, 0x8, 0x0, 0x0)
	$HOME/Documents/blocklayer/blocklayer/bl/runtime/runtime/run.go:253 +0x103
github.com/blocklayerhq/blocklayer/blr/runtime.(*runHandler).getCommand(0xc000430920, 0xc000637c20, 0xc0005f1c38, 0xc000302780, 0x1afc100, 0xc00016d360)
	$HOME/Documents/blocklayer/blocklayer/bl/runtime/runtime/run.go:230 +0x54d
github.com/blocklayerhq/blocklayer/blr/runtime.(*runHandler).Run(0xc000430920, 0x1e2fa40, 0xc00054f020, 0xc00012ee00, 0x1e11720, 0xc000430920, 0x5eb5a9a7, 0x7fc8e40, 0x8e25c8a23846)
	$HOME/Documents/blocklayer/blocklayer/bl/runtime/runtime/run.go:72 +0x25d
github.com/blocklayerhq/blocklayer/blr/runtime.(*Task).Run(0xc0004c1400, 0x1e2fa40, 0xc00054f020, 0xc000117380, 0xc00058d540, 0xc00012ee00, 0x1a, 0x0, 0x0, 0x0, ...)
	$HOME/Documents/blocklayer/blocklayer/bl/runtime/runtime/task.go:65 +0xbb
github.com/blocklayerhq/blocklayer/blr/runtime.Run.func1(0x0, 0x0)
	$HOME/Documents/blocklayer/blocklayer/bl/runtime/runtime/runtime.go:166 +0x43c
golang.org/x/sync/errgroup.(*Group).Go.func1(0xc00054ef30, 0xc0004ab810)
	$HOME/go/pkg/mod/golang.org/x/sync@v0.0.0-20200317015054-43a5402ce75a/errgroup/errgroup.go:57 +0x64
created by golang.org/x/sync/errgroup.(*Group).Go
	$HOME/go/pkg/mod/golang.org/x/sync@v0.0.0-20200317015054-43a5402ce75a/errgroup/errgroup.go:54 +0x66

goroutine 72 [chan receive]:
github.com/moby/buildkit/client.(*Client).solve.func2.1.1(0xc00016d070)
	$HOME/go/pkg/mod/github.com/moby/buildkit@v0.7.1-0.20200429212254-99b2abfb7660/client/solve.go:181 +0x45
created by github.com/moby/buildkit/client.(*Client).solve.func2.1
	$HOME/go/pkg/mod/github.com/moby/buildkit@v0.7.1-0.20200429212254-99b2abfb7660/client/solve.go:180 +0x43

goroutine 162 [chan receive]:
github.com/moby/buildkit/client.(*Client).solve.func2.1.1(0xc00059a060)
	$HOME/go/pkg/mod/github.com/moby/buildkit@v0.7.1-0.20200429212254-99b2abfb7660/client/solve.go:181 +0x45
created by github.com/moby/buildkit/client.(*Client).solve.func2.1
	$HOME/go/pkg/mod/github.com/moby/buildkit@v0.7.1-0.20200429212254-99b2abfb7660/client/solve.go:180 +0x43

goroutine 24 [chan receive]:
github.com/moby/buildkit/client.(*Client).solve.func2.1.1(0xc0003f6650)
	$HOME/go/pkg/mod/github.com/moby/buildkit@v0.7.1-0.20200429212254-99b2abfb7660/client/solve.go:181 +0x45
created by github.com/moby/buildkit/client.(*Client).solve.func2.1
	$HOME/go/pkg/mod/github.com/moby/buildkit@v0.7.1-0.20200429212254-99b2abfb7660/client/solve.go:180 +0x43
make: *** [test] Error 2
@aluzzardi
Copy link

For context, we are doing a bunch of parallel value.Lookup and instance.Fill.

We briefly looked at the source code -- maybe It's caused by parallel read/write access to index.labelMap?

The problem seems to be triggered in structValue.Lookup():

f := o.ctx.strLabel(key)

@mpvl mpvl added FeatureRequest New feature or request and removed NeedsInvestigation labels May 11, 2020
@mpvl
Copy link
Contributor

mpvl commented May 11, 2020

Ah, the cue.Value interface is currently not thread-safe. The main reason for this is exactly where it fails: it uses a shared index for uniquing strings.

It may make sense to use sync.Map, for instance, but did not want to do so before we had a good way to measure the performance impact of that. You may want to try that, though.

@mpvl
Copy link
Contributor

mpvl commented Nov 24, 2020

This is now using sync.Map The API is not fully concurrent yet, but it may suffice for your specific use case.

@mpvl mpvl added the concurrency The API is generally not concurrent, but track features anyway for reference. label Jan 19, 2021
@cueckoo
Copy link

cueckoo commented Jul 3, 2021

This issue has been migrated to cue-lang/cue#382.

For more details about CUE's migration to a new home, please see cue-lang/cue#1078.

@cueckoo cueckoo closed this as completed Jul 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
concurrency The API is generally not concurrent, but track features anyway for reference. FeatureRequest New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants