Skip to content
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

Fatal concurrent map read and map write error when using the inject option #878

Closed
aehrenthal opened this issue Feb 24, 2021 · 4 comments
Closed

Comments

@aehrenthal
Copy link

aehrenthal commented Feb 24, 2021

Hello! I have a Lerna monorepo in which each package runs its own esbuild process (version 0.8.51) to compile the React TypeScript code to CJS. I use the JavaScript API from esbuild with the following options:

esbuild.build({
    bundle: true,
    entryPoints: ['src/index.ts'],
    inject: [path.join(__dirname, 'react-shim.js')],
    jsxFactory: 'jsx',
    minify: false,
    platform: 'node',
    sourcemap: true,
    target: 'es6',
    tsconfig: tsConfigPath,     
    define: {NODE_ENV: 'production'},
    external: [...Object.keys(packageJson.dependencies), ...Object.keys(packageJson.peerDependencies || {})],
    format: 'cjs',
    outfile: 'dist/index.cjs.js'
});

Since I started using the inject option, I keep receiving the error which I included at the end of the ticket. However, this error appears very randomly, as it does not repeat in the same package within my monorepo, but rather keep showing up in a random one. When I turn off the inject option, it works just fine.

The content of my inject file look like this:
export {jsx} from '@emotion/react';

The same issue appears in #556, however this fix seems to be unrelated as without the inject option everything works well.

The error:

my-org/my-package: fatal error: concurrent map read and map write
my-org/my-package: goroutine 37 [running]:
my-org/my-package: runtime.throw(0x149ed97, 0x21)
my-org/my-package:    /usr/local/go/src/runtime/panic.go:1117 +0x72 fp=0xc000295020 sp=0xc000294ff0 pc=0x1037eb2
my-org/my-package: runtime.mapaccess2_faststr(0x14251e0, 0xc00009e1e0, 0xc00012a000, 0x65, 0x0, 0x730100c000280000)
my-org/my-package:    /usr/local/go/src/runtime/map_faststr.go:116 +0x4a5 fp=0xc000295090 sp=0xc000295020 pc=0x1015745
my-org/my-package: github.com/evanw/esbuild/internal/fs.(*realFS).ReadDirectory(0xc000090080, 0xc00012a000, 0x65, 0x0, 0x0, 0x0, 0x0, 0x0)
my-org/my-package:    /Users/evan/dev/esbuild/internal/fs/fs_real.go:120 +0x6b3 fp=0xc000295220 sp=0xc000295090 pc=0x13240d3
my-org/my-package: github.com/evanw/esbuild/internal/bundler.(*scanner).addEntryPoints(0xc0000c62c0, 0xc0000a41a0, 0x1, 0x1, 0x1d47f00, 0x0, 0xc000205728)
my-org/my-package:    /Users/evan/dev/esbuild/internal/bundler/bundler.go:1137 +0xa62 fp=0xc0002956b0 sp=0xc000295220 pc=0x136ffc2
my-org/my-package: github.com/evanw/esbuild/internal/bundler.ScanBundle(0xc0000b8000, 0xc0000b0060, 0xc0000b8080, 0x1520a60, 0xc000090080, 0x151e038, 0xc0000fe280, 0xc000092060, 0xc0000a41a0, 0x1, ...)
my-org/my-package:    /Users/evan/dev/esbuild/internal/bundler/bundler.go:892 +0x37f fp=0xc000295a20 sp=0xc0002956b0 pc=0x136d6bf
my-org/my-package: github.com/evanw/esbuild/pkg/api.rebuildImpl(0x0, 0x0, 0x2000201, 0x0, 0x0, 0x0, 0x0, 0xc0000a800e, 0x3, 0x0, ...)
my-org/my-package:    /Users/evan/dev/esbuild/pkg/api/api_impl.go:706 +0x1c45 fp=0xc0002965c0 sp=0xc000295a20 pc=0x13a7e65
my-org/my-package: github.com/evanw/esbuild/pkg/api.buildImpl(0x0, 0x0, 0x2000201, 0x0, 0x0, 0x0, 0x0, 0xc0000a800e, 0x3, 0x0, ...)
my-org/my-package:    /Users/evan/dev/esbuild/pkg/api/api_impl.go:552 +0x365 fp=0xc000296d80 sp=0xc0002965c0 pc=0x13a5fa5
my-org/my-package: github.com/evanw/esbuild/pkg/api.Build(...)
my-org/my-package:    /Users/evan/dev/esbuild/pkg/api/api.go:306
my-org/my-package: main.(*serviceType).handleBuildRequest(0xc000148140, 0xc000000000, 0xc00009e000, 0x7, 0xc0000a0198, 0xc00009e000, 0x1)
my-org/my-package:    /Users/evan/dev/esbuild/cmd/esbuild/service.go:435 +0x7d8 fp=0xc000297dc0 sp=0xc000296d80 pc=0x13d0518
my-org/my-package: main.(*serviceType).handleIncomingPacket(0xc000148140, 0xc00017a700, 0x336, 0x380, 0x0, 0x0, 0x0, 0x0)
my-org/my-package:    /Users/evan/dev/esbuild/cmd/esbuild/service.go:190 +0x605 fp=0xc000297f48 sp=0xc000297dc0 pc=0x13cf165
my-org/my-package: main.runService.func3(0xc000148140, 0xc00017a700, 0x336, 0x380, 0xc000126c60)
my-org/my-package:    /Users/evan/dev/esbuild/cmd/esbuild/service.go:121 +0x53 fp=0xc000297fb8 sp=0xc000297f48 pc=0x13d6b13
my-org/my-package: runtime.goexit()
my-org/my-package:    /usr/local/go/src/runtime/asm_amd64.s:1371 +0x1 fp=0xc000297fc0 sp=0xc000297fb8 pc=0x10705c1
my-org/my-package: created by main.runService
my-org/my-package:    /Users/evan/dev/esbuild/cmd/esbuild/service.go:120 +0x346
my-org/my-package: goroutine 1 [syscall]:
my-org/my-package: syscall.syscall(0x10ac760, 0x0, 0xc0001abd48, 0x4000, 0x0, 0x0, 0x0)
my-org/my-package:    /usr/local/go/src/runtime/sys_darwin.go:19 +0x2e
my-org/my-package: syscall.read(0x0, 0xc0001abd48, 0x4000, 0x4000, 0x0, 0x100000000000000, 0x1f627f0)
my-org/my-package:    /usr/local/go/src/syscall/zsyscall_darwin_amd64.go:1242 +0x66
my-org/my-package: syscall.Read(...)
my-org/my-package:    /usr/local/go/src/syscall/syscall_unix.go:187
my-org/my-package: internal/poll.ignoringEINTRIO(...)
my-org/my-package:    /usr/local/go/src/internal/poll/fd_unix.go:581
my-org/my-package: internal/poll.(*FD).Read(0xc00012e000, 0xc0001abd48, 0x4000, 0x4000, 0x0, 0x0, 0x0)
my-org/my-package:    /usr/local/go/src/internal/poll/fd_unix.go:162 +0x145
my-org/my-package: os.(*File).read(...)
my-org/my-package:    /usr/local/go/src/os/file_posix.go:31
my-org/my-package: os.(*File).Read(0xc00012c000, 0xc0001abd48, 0x4000, 0x4000, 0x0, 0x0, 0xc0001b8674)
my-org/my-package:    /usr/local/go/src/os/file.go:117 +0x77
my-org/my-package: main.runService(0x7ffeefbfe401)
my-org/my-package:    /Users/evan/dev/esbuild/cmd/esbuild/service.go:99 +0x4c5
my-org/my-package: main.main()
my-org/my-package:    /Users/evan/dev/esbuild/cmd/esbuild/main.go:169 +0x3ce
my-org/my-package: goroutine 35 [chan receive]:
my-org/my-package: main.runService.func1(0xc000148140, 0xc000126c60)
my-org/my-package:    /Users/evan/dev/esbuild/cmd/esbuild/service.go:64 +0x4a
my-org/my-package: created by main.runService
my-org/my-package:    /Users/evan/dev/esbuild/cmd/esbuild/service.go:62 +0x1ea
my-org/my-package: goroutine 36 [sleep]:
my-org/my-package: time.Sleep(0x3b9aca00)
my-org/my-package:    /usr/local/go/src/runtime/time.go:193 +0xd2
my-org/my-package: main.runService.func2(0xc000148140)
my-org/my-package:    /Users/evan/dev/esbuild/cmd/esbuild/service.go:89 +0x54
my-org/my-package: created by main.runService
my-org/my-package:    /Users/evan/dev/esbuild/cmd/esbuild/service.go:87 +0x6c5
my-org/my-package: goroutine 38 [semacquire]:
my-org/my-package: sync.runtime_Semacquire(0xc000311c28)
my-org/my-package:    /usr/local/go/src/runtime/sema.go:56 +0x45
my-org/my-package: sync.(*WaitGroup).Wait(0xc000311c20)
my-org/my-package:    /usr/local/go/src/sync/waitgroup.go:130 +0x65
my-org/my-package: github.com/evanw/esbuild/internal/bundler.(*scanner).addEntryPoints(0xc0002182c0, 0xc0000601b0, 0x1, 0x1, 0x1d52d00, 0x0, 0xc000209728)
my-org/my-package:    /Users/evan/dev/esbuild/internal/bundler/bundler.go:1184 +0x4ba
my-org/my-package: github.com/evanw/esbuild/internal/bundler.ScanBundle(0xc000212000, 0xc00000e078, 0xc000212080, 0x1520a60, 0xc000030080, 0x151e038, 0xc00025a280, 0xc00007c060, 0xc0000601b0, 0x1, ...)
my-org/my-package:    /Users/evan/dev/esbuild/internal/bundler/bundler.go:892 +0x37f
my-org/my-package: github.com/evanw/esbuild/pkg/api.rebuildImpl(0x0, 0x0, 0x2000201, 0x0, 0x0, 0x0, 0x0, 0xc00001c12e, 0x3, 0x0, ...)
my-org/my-package:    /Users/evan/dev/esbuild/pkg/api/api_impl.go:706 +0x1c45
my-org/my-package: github.com/evanw/esbuild/pkg/api.buildImpl(0x0, 0x0, 0x2000201, 0x0, 0x0, 0x0, 0x0, 0xc00001c12e, 0x3, 0x0, ...)
my-org/my-package:    /Users/evan/dev/esbuild/pkg/api/api_impl.go:552 +0x365
my-org/my-package: github.com/evanw/esbuild/pkg/api.Build(...)
my-org/my-package:    /Users/evan/dev/esbuild/pkg/api/api.go:306
my-org/my-package: main.(*serviceType).handleBuildRequest(0xc000148140, 0xc000000001, 0xc000012030, 0x7, 0xc000200088, 0xc000012030, 0x1)
my-org/my-package:    /Users/evan/dev/esbuild/cmd/esbuild/service.go:435 +0x7d8
my-org/my-package: main.(*serviceType).handleIncomingPacket(0xc000148140, 0xc00017aa80, 0x336, 0x380, 0x0, 0x0, 0x0, 0x0)
my-org/my-package:    /Users/evan/dev/esbuild/cmd/esbuild/service.go:190 +0x605
my-org/my-package: main.runService.func3(0xc000148140, 0xc00017aa80, 0x336, 0x380, 0xc000126c60)
my-org/my-package:    /Users/evan/dev/esbuild/cmd/esbuild/service.go:121 +0x53
my-org/my-package: created by main.runService
my-org/my-package:    /Users/evan/dev/esbuild/cmd/esbuild/service.go:120 +0x346
my-org/my-package: goroutine 3 [chan send]:
my-org/my-package: github.com/evanw/esbuild/internal/bundler.ScanBundle.func1(0xc000200480, 0xc0002182c0)
my-org/my-package:    /Users/evan/dev/esbuild/internal/bundler/bundler.go:888 +0x22b
my-org/my-package: created by github.com/evanw/esbuild/internal/bundler.ScanBundle
my-org/my-package:    /Users/evan/dev/esbuild/internal/bundler/bundler.go:886 +0x33c
my-org/my-package: goroutine 20 [chan send]:
my-org/my-package: github.com/evanw/esbuild/internal/bundler.ScanBundle.func1(0xc0000a0480, 0xc0000c62c0)
my-org/my-package:    /Users/evan/dev/esbuild/internal/bundler/bundler.go:888 +0x22b
my-org/my-package: created by github.com/evanw/esbuild/internal/bundler.ScanBundle
my-org/my-package:    /Users/evan/dev/esbuild/internal/bundler/bundler.go:886 +0x33c
my-org/my-package: goroutine 4 [runnable]:
my-org/my-package: syscall.syscall(0x10ac780, 0x7b040a0, 0xc00015db00, 0xc000372000, 0x0, 0x0, 0x0)
my-org/my-package:    /usr/local/go/src/runtime/sys_darwin.go:19 +0x2e
my-org/my-package: syscall.readdir_r(0x7b040a0, 0xc00015db00, 0xc000372000, 0x0)
my-org/my-package:    /usr/local/go/src/syscall/zsyscall_darwin_amd64.go:1258 +0x65
my-org/my-package: os.(*File).readdir(0xc000010008, 0xffffffffffffffff, 0x0, 0x0, 0x0, 0xc00058c020, 0x10c5aa5, 0xc000160900, 0x64, 0x0, ...)
my-org/my-package:    /usr/local/go/src/os/dir_darwin.go:48 +0x1c5
my-org/my-package: os.(*File).Readdirnames(0xc000010008, 0xffffffffffffffff, 0x0, 0x1a0000c000000000, 0xc000010008, 0x0, 0x0)
my-org/my-package:    /usr/local/go/src/os/dir.go:70 +0x51
my-org/my-package: github.com/evanw/esbuild/internal/fs.readdir(0xc000160900, 0x64, 0x0, 0x0, 0x0, 0x0, 0x0)
my-org/my-package:    /Users/evan/dev/esbuild/internal/fs/fs_real.go:300 +0x126
my-org/my-package: github.com/evanw/esbuild/internal/fs.(*realFS).ReadDirectory(0xc000030080, 0xc000160900, 0x64, 0x0, 0x0, 0x0, 0x0, 0x0)
my-org/my-package:    /Users/evan/dev/esbuild/internal/fs/fs_real.go:127 +0x91
my-org/my-package: github.com/evanw/esbuild/internal/resolver.(*resolver).loadAsFile(0xc00025a280, 0xc000160900, 0x79, 0xc000212100, 0x8, 0x8, 0x79, 0x79, 0x0, 0xc00058c440)
my-org/my-package:    /Users/evan/dev/esbuild/internal/resolver/resolver.go:1070 +0x9f
my-org/my-package: github.com/evanw/esbuild/internal/resolver.(*resolver).parsePackageJSON.func1(0xc000160900, 0x79, 0x1b0000003f, 0x2)
my-org/my-package:    /Users/evan/dev/esbuild/internal/resolver/resolver.go:896 +0xad
my-org/my-package: github.com/evanw/esbuild/internal/resolver.(*resolver).parsePackageJSON(0xc00025a280, 0xc0000c3bc0, 0x5f, 0x1494302)
my-org/my-package:    /Users/evan/dev/esbuild/internal/resolver/resolver.go:927 +0x13e7
my-org/my-package: github.com/evanw/esbuild/internal/resolver.(*resolver).dirInfoUncached(0xc00025a280, 0xc0000c3bc0, 0x5f, 0x5f)
my-org/my-package:    /Users/evan/dev/esbuild/internal/resolver/resolver.go:822 +0xe50
my-org/my-package: github.com/evanw/esbuild/internal/resolver.(*resolver).dirInfoCached(0xc00025a280, 0xc0000c3bc0, 0x5f, 0xc000212100)
my-org/my-package:    /Users/evan/dev/esbuild/internal/resolver/resolver.go:638 +0x8b
my-org/my-package: github.com/evanw/esbuild/internal/resolver.(*resolver).loadAsFileOrDirectory(0xc00025a280, 0xc0000c3bc0, 0x5f, 0xc0002a4300, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
my-org/my-package:    /Users/evan/dev/esbuild/internal/resolver/resolver.go:1178 +0x111
my-org/my-package: github.com/evanw/esbuild/internal/resolver.(*resolver).loadNodeModules(0xc00025a280, 0xc000582660, 0xe, 0x0, 0xc0002782a0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
my-org/my-package:    /Users/evan/dev/esbuild/internal/resolver/resolver.go:1355 +0x28a
my-org/my-package: github.com/evanw/esbuild/internal/resolver.(*resolver).resolveWithoutRemapping(0xc00025a280, 0xc000278620, 0xc000582660, 0xe, 0x1743200, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
my-org/my-package:    /Users/evan/dev/esbuild/internal/resolver/resolver.go:532 +0x110
my-org/my-package: github.com/evanw/esbuild/internal/resolver.(*resolver).resolveWithoutSymlinks(0xc00025a280, 0xc00002e0a9, 0x87, 0xc000582660, 0xe, 0xc00007ca00, 0x0)
my-org/my-package:    /Users/evan/dev/esbuild/internal/resolver/resolver.go:497 +0x1df
my-org/my-package: github.com/evanw/esbuild/internal/resolver.(*resolver).Resolve(0xc00025a280, 0xc00002e0a9, 0x87, 0xc000582660, 0xe, 0x0, 0x0)
my-org/my-package:    /Users/evan/dev/esbuild/internal/resolver/resolver.go:228 +0x1a5
my-org/my-package: github.com/evanw/esbuild/internal/bundler.runOnResolvePlugins(0x0, 0x0, 0x0, 0x151e038, 0xc00025a280, 0xc000212000, 0xc00000e078, 0xc000212080, 0x1520a60, 0xc000030080, ...)
my-org/my-package:    /Users/evan/dev/esbuild/internal/bundler/bundler.go:708 +0x20b
my-org/my-package: github.com/evanw/esbuild/internal/bundler.parseFile(0x1520a60, 0xc000030080, 0xc000212000, 0xc00000e078, 0xc000212080, 0x151e038, 0xc00025a280, 0xc00007c060, 0xc00002e0a9, 0x95, ...)
my-org/my-package:    /Users/evan/dev/esbuild/internal/bundler/bundler.go:412 +0xabd
my-org/my-package: created by github.com/evanw/esbuild/internal/bundler.(*scanner).maybeParseFile
my-org/my-package:    /Users/evan/dev/esbuild/internal/bundler/bundler.go:972 +0x578
my-org/my-package: goroutine 53 [semacquire]:
my-org/my-package: sync.runtime_SemacquireMutex(0xc00025a4cc, 0x0, 0x1)
my-org/my-package:    /usr/local/go/src/runtime/sema.go:71 +0x47
my-org/my-package: sync.(*Mutex).lockSlow(0xc00025a4c8)
my-org/my-package:    /usr/local/go/src/sync/mutex.go:138 +0x105
my-org/my-package: sync.(*Mutex).Lock(...)
my-org/my-package:    /usr/local/go/src/sync/mutex.go:81
my-org/my-package: github.com/evanw/esbuild/internal/resolver.(*resolver).Resolve(0xc00025a280, 0xc00002a310, 0x61, 0xc000311c10, 0xe, 0x6, 0x0)
my-org/my-package:    /Users/evan/dev/esbuild/internal/resolver/resolver.go:225 +0x375
my-org/my-package: github.com/evanw/esbuild/internal/bundler.runOnResolvePlugins(0x0, 0x0, 0x0, 0x151e038, 0xc00025a280, 0xc000212000, 0xc00000e078, 0xc000212080, 0x1520a60, 0xc000030080, ...)
my-org/my-package:    /Users/evan/dev/esbuild/internal/bundler/bundler.go:708 +0x20b
my-org/my-package: github.com/evanw/esbuild/internal/bundler.(*scanner).addEntryPoints.func1(0xc0002182c0, 0xc00002a310, 0x61, 0xc0003722c8, 0x1, 0x1, 0xc000311c20, 0x0, 0xc000311c10, 0xe)
my-org/my-package:    /Users/evan/dev/esbuild/internal/bundler/bundler.go:1154 +0xec
my-org/my-package: created by github.com/evanw/esbuild/internal/bundler.(*scanner).addEntryPoints
my-org/my-package:    /Users/evan/dev/esbuild/internal/bundler/bundler.go:1152 +0x488
my-org/my-package: goroutine 39 [runnable]:
my-org/my-package: syscall.syscall(0x10ac600, 0x7, 0x43, 0x0, 0x9, 0x0, 0x0)
my-org/my-package:    /usr/local/go/src/runtime/sys_darwin.go:19 +0x2e
my-org/my-package: syscall.fcntl(0x7, 0x43, 0x0, 0xc0000d82e0, 0x0, 0x0)
my-org/my-package:    /usr/local/go/src/syscall/zsyscall_darwin_amd64.go:338 +0x58
my-org/my-package: internal/poll.DupCloseOnExec(0x7, 0xc0000d8298, 0x106b748, 0xc000104a80, 0x200000003, 0xc000104a80)
my-org/my-package:    /usr/local/go/src/internal/poll/fd_unix.go:485 +0x96
my-org/my-package: internal/poll.(*FD).Dup(0xc0000922a0, 0x0, 0x0, 0x0, 0x0, 0x0)
my-org/my-package:    /usr/local/go/src/internal/poll/fd_unix.go:521 +0xda
my-org/my-package: internal/poll.(*FD).OpenDir(0xc0000922a0, 0x10c6890, 0x14214c0, 0xc0000922a0, 0x1415920, 0x14b2938)
my-org/my-package:    /usr/local/go/src/internal/poll/fd_opendir_darwin.go:18 +0x2f
my-org/my-package: os.(*File).readdir(0xc000298018, 0xffffffffffffffff, 0x0, 0x0, 0x0, 0xc0000d84a0, 0x10c5aa5, 0xc0002ba240, 0x7c, 0x0, ...)
my-org/my-package:    /usr/local/go/src/os/dir_darwin.go:29 +0xcf8
my-org/my-package: os.(*File).Readdirnames(0xc000298018, 0xffffffffffffffff, 0x0, 0x1500000000000000, 0xc000298018, 0x0, 0x0)
my-org/my-package:    /usr/local/go/src/os/dir.go:70 +0x51
my-org/my-package: github.com/evanw/esbuild/internal/fs.readdir(0xc0002ba240, 0x7c, 0x0, 0x0, 0x0, 0x0, 0x0)
my-org/my-package:    /Users/evan/dev/esbuild/internal/fs/fs_real.go:300 +0x126
my-org/my-package: github.com/evanw/esbuild/internal/fs.(*realFS).ReadDirectory(0xc000090080, 0xc0002ba240, 0x7c, 0x0, 0x0, 0x0, 0x0, 0x0)
my-org/my-package:    /Users/evan/dev/esbuild/internal/fs/fs_real.go:127 +0x91
my-org/my-package: github.com/evanw/esbuild/internal/resolver.(*resolver).dirInfoUncached(0xc0000fe280, 0xc0002ba240, 0x7c, 0x7c)
my-org/my-package:    /Users/evan/dev/esbuild/internal/resolver/resolver.go:774 +0xee
my-org/my-package: github.com/evanw/esbuild/internal/resolver.(*resolver).dirInfoCached(0xc0000fe280, 0xc0002ba240, 0x7c, 0xc0002ba240)
my-org/my-package:    /Users/evan/dev/esbuild/internal/resolver/resolver.go:638 +0x8b
my-org/my-package: github.com/evanw/esbuild/internal/resolver.(*resolver).dirInfoUncached(0xc0000fe280, 0xc0002ba240, 0x85, 0x85)
my-org/my-package:    /Users/evan/dev/esbuild/internal/resolver/resolver.go:765 +0xa5
my-org/my-package: github.com/evanw/esbuild/internal/resolver.(*resolver).dirInfoCached(0xc0000fe280, 0xc0002ba240, 0x85, 0xc0002ba240)
my-org/my-package:    /Users/evan/dev/esbuild/internal/resolver/resolver.go:638 +0x8b
my-org/my-package: github.com/evanw/esbuild/internal/resolver.(*resolver).loadNodeModules(0xc0000fe280, 0xc0002d3770, 0xe, 0x0, 0xc000180a10, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
my-org/my-package:    /Users/evan/dev/esbuild/internal/resolver/resolver.go:1342 +0x205
my-org/my-package: github.com/evanw/esbuild/internal/resolver.(*resolver).resolveWithoutRemapping(0xc0000fe280, 0xc000180bd0, 0xc0002d3770, 0xe, 0x1743200, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
my-org/my-package:    /Users/evan/dev/esbuild/internal/resolver/resolver.go:532 +0x110
my-org/my-package: github.com/evanw/esbuild/internal/resolver.(*resolver).resolveWithoutSymlinks(0xc0000fe280, 0xc0000ae009, 0x87, 0xc0002d3770, 0xe, 0xc000092100, 0x0)
my-org/my-package:    /Users/evan/dev/esbuild/internal/resolver/resolver.go:497 +0x1df
my-org/my-package: github.com/evanw/esbuild/internal/resolver.(*resolver).Resolve(0xc0000fe280, 0xc0000ae009, 0x87, 0xc0002d3770, 0xe, 0x0, 0x0)
my-org/my-package:    /Users/evan/dev/esbuild/internal/resolver/resolver.go:228 +0x1a5
my-org/my-package: github.com/evanw/esbuild/internal/bundler.runOnResolvePlugins(0x0, 0x0, 0x0, 0x151e038, 0xc0000fe280, 0xc0000b8000, 0xc0000b0060, 0xc0000b8080, 0x1520a60, 0xc000090080, ...)
my-org/my-package:    /Users/evan/dev/esbuild/internal/bundler/bundler.go:708 +0x20b
my-org/my-package: github.com/evanw/esbuild/internal/bundler.parseFile(0x1520a60, 0xc000090080, 0xc0000b8000, 0xc0000b0060, 0xc0000b8080, 0x151e038, 0xc0000fe280, 0xc000092060, 0xc0000ae009, 0x95, ...)
my-org/my-package:    /Users/evan/dev/esbuild/internal/bundler/bundler.go:412 +0xabd
my-org/my-package: created by github.com/evanw/esbuild/internal/bundler.(*scanner).maybeParseFile
my-org/my-package:    /Users/evan/dev/esbuild/internal/bundler/bundler.go:972 +0x578
my-org/my-package: /Users/myuser/Desktop/Coding/node_modules/my-org/library-scripts/scripts/build.js:17
my-org/my-package:   throw error;
my-org/my-package:   ^
my-org/my-package: Error: The service was stopped
my-org/my-package:     at /Users/myuser/Desktop/Coding/node_modules/esbuild/lib/main.js:980:31
my-org/my-package:     at /Users/myuser/Desktop/Coding/node_modules/esbuild/lib/main.js:553:9
my-org/my-package:     at Socket.afterClose (/Users/myuser/Desktop/Coding/node_modules/esbuild/lib/main.js:531:7)
my-org/my-package:     at Socket.emit (events.js:327:22)
my-org/my-package:     at endReadableNT (internal/streams/readable.js:1327:12)
my-org/my-package:     at processTicksAndRejections (internal/process/task_queues.js:80:21)
my-org/my-package: error Command failed with exit code 1.
my-org/my-package: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.```
@evanw
Copy link
Owner

evanw commented Feb 24, 2021

Thanks for the report. It looks like this regression may have been introduced all the way back in 0.8.21. The issue is that this was the first time the cached readdir API from the internal file system interface was used outside of the path resolver, and was not behind a mutex (the path resolver has its own mutex). This should be easy to fix.

@aehrenthal
Copy link
Author

Thank you so much for the quick reply @evanw. Please let me know if I can be of any further help, such as testing the fix before releasing it or helping to reproduce it.

@evanw evanw closed this as completed in 5660fcd Feb 24, 2021
@evanw
Copy link
Owner

evanw commented Feb 24, 2021

I was able to reproduce it with the information you gave me. The fix will be out in the next release.

I believe a workaround in the meantime is to specify entry points with either an absolute path (starting with / or C:\ for Windows) or a relative path (starting with ./ or ../) since this code is only triggered when that's not the case.

@aehrenthal
Copy link
Author

Thanks a lot for the fast fix, this is fantastic! I also really appreciate the temporary workaround until then.

Esbuild is a great project and in the hands of an amazing maintainer! 🥇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants