Closed J-env closed 1 year ago
I ran into this too, in a GitHub Actions workflow that runs astro check
. Surprisingly, despite all the error messages, it wasn't considered a failed job.
Doing a little bisecting on @J-env's StackBlitz setup, it seems like this bug appeared in Astro 2.0.7. Unfortunately that wasn't a small release, so it doesn't narrow it down much.
I thought maybe it was the upgrade of @astrojs/compiler
from 1.0.1 to 1.1.1, because I assume astro check
uses the compiler. But I made Yarn mash up Astro 2.0.7 with @astrojs/compiler
1.0.1 and I still get the error, so I doubt that's it.
That's as far as I know how to go – I hope it saves someone else a little time.
excerpt of rg --no-ignore --hidden @astrojs/compiler
in my project that caught the same bug 🧐
curious what is pulling in old astro versions
Seems like there must be some problem w/ goroutine synchronization? i dunno 🤷
I also ran into this bug as well. I was using Astro 2.0.17 with Vite 4.1.4. I noticed that there seemed to be a bug with Vite 4.1.4 and Astro generating vite:dep-scan
errors like this:
Step #1: ✘ [ERROR] [plugin vite:dep-scan] ENOENT: no such file or directory, open '@components/tabs/Tabs.svelte'
Step #1:
Step #1: node_modules/vite/node_modules/esbuild/lib/main.js:1426:27:
Step #1: 1426 │ let result = await callback({
Step #1: ╵ ^
Step #1:
Step #1: at Object.openSync (node:fs:601:3)
Step #1: at Object.readFileSync (node:fs:469:35)
Step #1: at file:///app/node_modules/vite/dist/node/chunks/dep-ca21228b.js:41913:32
Step #1: at requestCallbacks.on-load (/app/node_modules/vite/node_modules/esbuild/lib/main.js:1426:28)
Step #1: at handleRequest (/app/node_modules/vite/node_modules/esbuild/lib/main.js:727:19)
Step #1: at handleIncomingPacket (/app/node_modules/vite/node_modules/esbuild/lib/main.js:749:7)
Step #1: at Socket.readFromStdout (/app/node_modules/vite/node_modules/esbuild/lib/main.js:677:7)
Step #1: at Socket.emit (node:events:513:28)
Step #1: at addChunk (node:internal/streams/readable:324:12)
Step #1: at readableAddChunk (node:internal/streams/readable:297:9)
Step #1:
Step #1: This error came from the "onLoad" callback registered here:
Step #1:
Step #1: node_modules/vite/node_modules/esbuild/lib/main.js:1287:20:
Step #1: 1287 │ let promise = setup({
Step #1: ╵ ^
Step #1:
Step #1: at setup (file:///app/node_modules/vite/dist/node/chunks/dep-ca21228b.js:41912:19)
Step #1: at handlePlugins (/app/node_modules/vite/node_modules/esbuild/lib/main.js:1287:21)
Step #1: at buildOrServeImpl (/app/node_modules/vite/node_modules/esbuild/lib/main.js:974:5)
Step #1: at Object.buildOrServe (/app/node_modules/vite/node_modules/esbuild/lib/main.js:780:5)
Step #1: at /app/node_modules/vite/node_modules/esbuild/lib/main.js:2132:17
Step #1: at new Promise (<anonymous>)
Step #1: at Object.build (/app/node_modules/vite/node_modules/esbuild/lib/main.js:2131:14)
Step #1: at build (/app/node_modules/vite/node_modules/esbuild/lib/main.js:1978:51)
Step #1: at scanImports (file:///app/node_modules/vite/dist/node/chunks/dep-ca21228b.js:41785:11)
I decided to try upgrading Vite to 4.2.0 to see if it would fix the issue. After upgrading to Vite 4.2.0, I started seeing this error:
fatal error: all goroutines are asleep - deadlock!
goroutine 1 [chan receive]:
github.com/evanw/esbuild/internal/helpers.(*ThreadSafeWaitGroup).Wait(...)
github.com/evanw/esbuild/internal/helpers/waitgroup.go:36
main.runService.func2()
github.com/evanw/esbuild/cmd/esbuild/service.go:114 +0x59
main.runService(0x1)
github.com/evanw/esbuild/cmd/esbuild/service.go:160 +0x4ed
main.main()
github.com/evanw/esbuild/cmd/esbuild/main.go:236 +0xa29
goroutine 6 [chan receive]:
main.runService.func1()
github.com/evanw/esbuild/cmd/esbuild/service.go:98 +0x4a
created by main.runService
github.com/evanw/esbuild/cmd/esbuild/service.go:97 +0x1e5
goroutine 7 [chan receive]:
main.(*serviceType).sendRequest(0xc000023da0, {0x14e91c0, 0xc000170150})
github.com/evanw/esbuild/cmd/esbuild/service.go:192 +0xfa
main.runService.func3()
github.com/evanw/esbuild/cmd/esbuild/service.go:125 +0x39
created by main.runService
github.com/evanw/esbuild/cmd/esbuild/service.go:122 +0x31c
(node:34251) ExperimentalWarning: stream/web is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
This new error doesn't always show up, only once in a while for some reason.
Crossposting into a more appropriate ticket:
I can recreate a deadlock very similar to this with astro check
on Ubuntu (but not MacOS on same node version 😢), but only when React is installed. Here are my reproduction steps:
npm create astro@latest
$ cd project
$ npm run astro check
// Works as intended$ npm run astro add react
// Accept all defaults$ npm run astro check
// breaks with following error trace:Crossposting into a more appropriate ticket:
I can recreate a deadlock very similar to this with
astro check
on Ubuntu (but not MacOS on same node version 😢), but only when React is installed. Here are my reproduction steps:
Create new project with
npm create astro@latest
- Empty template
- TypeScript (strict)
$ cd project
$ npm run astro check
// Works as intended$ npm run astro add react
// Accept all defaults$ npm run astro check
// breaks with following error trace:error trace system details
same here, but with vue
instead of react
Fixed a bug specific to the check CLI today: https://github.com/withastro/astro/pull/6811. Maybe it would fix the problem since I can't trigger it reliably.
FWIW, astro check
does not use the compiler, it's still on the old @astrojs/language-server
that didn't use the compiler
I cannot reproduce this anymore using the latest versions of Astro. Still very weird, as astro check
would output this error in versions where it didn't even use the compiler. I suspect something else was calling to esbuild at that moment and the new, improved, CLI workflows @bluwy made fixed the issue.
This reproduces consistently for me:
All I have done is take the Astro Minimal Example, switched to using yarn
, then installed the svelte integration.
Running yarn astro check
seems to reproduce the problem every time.
Weird, still no idea what's that about. This command does not run ESBuild at all. Can you reproduce that locally?
Oops, looks like I pasted wrong URL there. This should be the correct one:
https://stackblitz.com/edit/github-vb5hvk?file=README.md
Today when I run astro check
in that StackBlitz on a different machine, however, I get a slightly different error. I'm not sure if that helps illuminate the problem:
❯ yarn astro check
yarn run v1.22.19
$ astro check
10:08:18 [check] Checking files
10:08:19 [content] No content directory found. Skipping type generation.
✔ Getting diagnostics for Astro files in /home/projects/github-vb5hvk/…
10:08:20 [diagnostics] Result (1 file):
- 0 errors
- 0 warnings
- 0 hints
✨ Done in 4.02s.
~/projects/github-vb5hvk 4s
❯ fatal error: too many writes on closed pipe
goroutine 6 [running]:
runtime.throw({0x9deaa, 0x1e})
runtime/panic.go:1047 +0x3 fp=0x83aed8 sp=0x83aeb0 pc=0x12250003
os.sigpipe()
runtime/os_js.go:144 +0x2 fp=0x83aef0 sp=0x83aed8 pc=0x13b70002
os.epipecheck(...)
os/file_unix.go:224
os.(*File).Write(0x80c020, {0x814500, 0x21, 0x40})
os/file.go:183 +0x2d fp=0x83af78 sp=0x83aef0 pc=0x1607002d
main.runService.func1()
github.com/evanw/esbuild/cmd/esbuild/service.go:99 +0x7 fp=0x83afe0 sp=0x83af78 pc=0x1f630007
runtime.goexit()
runtime/asm_wasm.s:399 +0x1 fp=0x83afe8 sp=0x83afe0 pc=0x14070001
created by main.runService
github.com/evanw/esbuild/cmd/esbuild/service.go:97 +0x1e
goroutine 1 [chan receive]:
runtime.gopark(0xb66b0, 0x834178, 0xe, 0x17, 0x2)
runtime/proc.go:381 +0x28 fp=0x895bc8 sp=0x895ba0 pc=0x124c0028
runtime.chanrecv(0x834120, 0x0, 0x1)
runtime/chan.go:583 +0x7f fp=0x895c50 sp=0x895bc8 pc=0x106d007f
runtime.chanrecv1(0x834120, 0x0)
runtime/chan.go:442 +0x2 fp=0x895c78 sp=0x895c50 pc=0x106b0002
github.com/evanw/esbuild/internal/helpers.(*ThreadSafeWaitGroup).Wait(...)
github.com/evanw/esbuild/internal/helpers/waitgroup.go:36
main.runService.func2()
github.com/evanw/esbuild/cmd/esbuild/service.go:114 +0x8 fp=0x895c98 sp=0x895c78 pc=0x1f620008
main.runService(0x1)
github.com/evanw/esbuild/cmd/esbuild/service.go:160 +0x5c fp=0x895de0 sp=0x895c98 pc=0x1f60005c
main.main()
github.com/evanw/esbuild/cmd/esbuild/main.go:240 +0x9e fp=0x895f88 sp=0x895de0 pc=0x1f59009e
runtime.main()
runtime/proc.go:250 +0x32 fp=0x895fe0 sp=0x895f88 pc=0x12460032
runtime.goexit()
runtime/asm_wasm.s:399 +0x1 fp=0x895fe8 sp=0x895fe0 pc=0x14070001
goroutine 2 [force gc (idle)]:
runtime.gopark(0xb6848, 0x3c65d0, 0x11, 0x14, 0x1)
runtime/proc.go:381 +0x28 fp=0x828fb8 sp=0x828f90 pc=0x124c0028
runtime.goparkunlock(...)
runtime/proc.go:387
runtime.forcegchelper()
runtime/proc.go:305 +0x1f fp=0x828fe0 sp=0x828fb8 pc=0x1249001f
runtime.goexit()
runtime/asm_wasm.s:399 +0x1 fp=0x828fe8 sp=0x828fe0 pc=0x14070001
created by runtime.init.5
runtime/proc.go:293 +0x2
goroutine 3 [GC sweep wait]:
runtime.gopark(0xb6848, 0x3c6960, 0xc, 0x14, 0x1)
runtime/proc.go:381 +0x28 fp=0x829798 sp=0x829770 pc=0x124c0028
runtime.goparkunlock(...)
runtime/proc.go:387
runtime.bgsweep(0x82e000)
runtime/mgcsweep.go:278 +0xf fp=0x8297d0 sp=0x829798 pc=0x1179000f
runtime.gcenable.func1()
runtime/mgc.go:178 +0x2 fp=0x8297e0 sp=0x8297d0 pc=0x110d0002
runtime.goexit()
runtime/asm_wasm.s:399 +0x1 fp=0x8297e8 sp=0x8297e0 pc=0x14070001
created by runtime.gcenable
runtime/mgc.go:178 +0x8
goroutine 4 [GC scavenge wait]:
runtime.gopark(0xb6848, 0x3c6ba0, 0xd, 0x14, 0x2)
runtime/proc.go:381 +0x28 fp=0x829f80 sp=0x829f58 pc=0x124c0028
runtime.goparkunlock(...)
runtime/proc.go:387
runtime.(*scavengerState).park(0x3c6ba0)
runtime/mgcscavenge.go:400 +0xd fp=0x829fa8 sp=0x829f80 pc=0x1160000d
runtime.bgscavenge(0x82e000)
runtime/mgcscavenge.go:628 +0x4 fp=0x829fd0 sp=0x829fa8 pc=0x11650004
runtime.gcenable.func2()
runtime/mgc.go:179 +0x2 fp=0x829fe0 sp=0x829fd0 pc=0x110c0002
runtime.goexit()
runtime/asm_wasm.s:399 +0x1 fp=0x829fe8 sp=0x829fe0 pc=0x14070001
created by runtime.gcenable
runtime/mgc.go:179 +0xe
goroutine 5 [finalizer wait]:
runtime.gopark(0xb66e8, 0x3e3850, 0x10, 0x14, 0x1)
runtime/proc.go:381 +0x28 fp=0x828738 sp=0x828710 pc=0x124c0028
runtime.runfinq()
runtime/mfinal.go:193 +0x1f fp=0x8287e0 sp=0x828738 pc=0x1104001f
runtime.goexit()
runtime/asm_wasm.s:399 +0x1 fp=0x8287e8 sp=0x8287e0 pc=0x14070001
created by runtime.createfing
runtime/mfinal.go:163 +0xd
goroutine 7 [waiting]:
runtime.gopark(0x0, 0x0, 0x0, 0x0, 0x1)
runtime/proc.go:381 +0x28 fp=0x82af90 sp=0x82af68 pc=0x124c0028
runtime.handleEvent()
runtime/lock_js.go:257 +0x1b fp=0x82afe0 sp=0x82af90 pc=0x10a3001b
runtime.goexit()
runtime/asm_wasm.s:399 +0x1 fp=0x82afe8 sp=0x82afe0 pc=0x14070001
created by runtime.beforeIdle
runtime/lock_js.go:207 +0x1a
goroutine 8 [chan receive]:
runtime.gopark(0xb66b0, 0x8341d8, 0xe, 0x17, 0x2)
runtime/proc.go:381 +0x28 fp=0x83bea0 sp=0x83be78 pc=0x124c0028
runtime.chanrecv(0x834180, 0x83bf88, 0x1)
runtime/chan.go:583 +0x7f fp=0x83bf28 sp=0x83bea0 pc=0x106d007f
runtime.chanrecv1(0x834180, 0x83bf88)
runtime/chan.go:442 +0x2 fp=0x83bf50 sp=0x83bf28 pc=0x106b0002
main.(*serviceType).sendRequest(0x80ff50, {0x465a0, 0x8f0780})
github.com/evanw/esbuild/cmd/esbuild/service.go:192 +0xb fp=0x83bfa0 sp=0x83bf50 pc=0x1f65000b
main.runService.func3()
github.com/evanw/esbuild/cmd/esbuild/service.go:125 +0x3 fp=0x83bfe0 sp=0x83bfa0 pc=0x1f610003
runtime.goexit()
runtime/asm_wasm.s:399 +0x1 fp=0x83bfe8 sp=0x83bfe0 pc=0x14070001
created by main.runService
github.com/evanw/esbuild/cmd/esbuild/service.go:122 +0x41
Last night (on a different machine) I was definitely getting the deadlock error, however.
If I download that StackBlitz and run it locally under WSL I don't get any error.
On a completely different project, I reproduced this locally after introducing the Svelte integration:
❯ yarn astro check
yarn run v1.22.19
$ astro check
10:26:02 AM [check] Checking files
10:26:02 AM [content] No content directory found. Skipping type generation.
✔ Getting diagnostics for Astro files in /home/birtles/project/…
10:26:04 AM [diagnostics]
/home/birtles/project/src/components/PostSummary.astro:19:35 Error: Parameter 'tag' implicitly has an 'any' type.
18 >{readableDate(post.data.date)}</time>{
19 (post.data.tags || []).map((tag) => (
~~~
20 <>
10:26:04 AM [diagnostics] Result (16 files):
- 1 error
- 0 warnings
- 0 hints
fatal error: all goroutines are asleep - deadlock!
goroutine 1 [chan receive]:
github.com/evanw/esbuild/internal/helpers.(*ThreadSafeWaitGroup).Wait(...)
github.com/evanw/esbuild/internal/helpers/waitgroup.go:36
main.runService.func2()
github.com/evanw/esbuild/cmd/esbuild/service.go:114 +0x59
main.runService(0x1)
github.com/evanw/esbuild/cmd/esbuild/service.go:160 +0x4ed
main.main()
github.com/evanw/esbuild/cmd/esbuild/main.go:240 +0xa29
goroutine 18 [chan receive]:
main.runService.func1()
github.com/evanw/esbuild/cmd/esbuild/service.go:98 +0x4a
created by main.runService
github.com/evanw/esbuild/cmd/esbuild/service.go:97 +0x1e5
goroutine 19 [chan receive]:
main.(*serviceType).sendRequest(0xc00018fec0, {0x915100, 0xc000e90090})
github.com/evanw/esbuild/cmd/esbuild/service.go:192 +0xfa
main.runService.func3()
github.com/evanw/esbuild/cmd/esbuild/service.go:125 +0x39
created by main.runService
github.com/evanw/esbuild/cmd/esbuild/service.go:122 +0x31c
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
If I comment out svelte()
from astro.config.js
the problem goes away.
It unfortunately does not give me more info, I really have no idea what's going on. In Astro 3.0 check
was completely rewritten from scratch, is there any chance you could test the latest 3.0 RC? npm install astro@rc
Thank you so much for your patience with this.
The short version is I think that works? Running:
yarn create astro
yarn add astro@rc
yarn astro add svelte
yarn add @astrojs/svelte@rc
yarn astro check
Doesn't produce an error on this machine (different machine to my previous comment, though).
I tried with the StackBlitz container and on Firefox I got:
~/projects/github-vb5hvk
❯ yarn astro check
yarn run v1.22.19
$ astro check
To continue, Astro requires the following dependency to be installed: @astrojs/check.
Astro will run the following command:
If you skip this step, you can always run it yourself later
╭─────────────────────────────────────╮
│ yarn add @astrojs/check typescript │
╰─────────────────────────────────────╯
✔ Continue? … yes
error Intl.Segmenter is not a constructor
File:
stringWidth@file:///home/projects/github-vb5hvk/node_modules/ora/node_modules/string-width/index.js:42:37
Stacktrace:
stringWidth@file:///home/projects/github-vb5hvk/node_modules/ora/node_modules/string-width/index.js:42:37
#updateLineCount@file:///home/projects/github-vb5hvk/node_modules/ora/index.js:214:59
set text@file:///home/projects/github-vb5hvk/node_modules/ora/index.js:157:24
Ora@file:///home/projects/github-vb5hvk/node_modules/ora/index.js:76:3
ora@file:///home/projects/github-vb5hvk/node_modules/ora/index.js:394:9
installPackage@file:///home/projects/github-vb5hvk/node_modules/astro/dist/cli/install-package.js:95:26
Presumably because Firefox doesn't support the Segmenter API yet (bug 1423593).
On Chrome, I get:
~/projects/github-vb5hvk 19s
❯ yarn astro check
yarn run v1.22.19
$ astro check
To continue, Astro requires the following dependency to be installed: @astrojs/check.
Astro will run the following command:
If you skip this step, you can always run it yourself later
╭─────────────────────────────────────╮
│ yarn add @astrojs/check typescript │
╰─────────────────────────────────────╯
✔ Continue? … yes
✔ Installing dependencies...
To continue, Astro requires the following dependency to be installed: typescript.
Astro will run the following command:
If you skip this step, you can always run it yourself later
╭──────────────────────╮
│ yarn add typescript │
╰──────────────────────╯
✔ Continue? … yes
✔ Installing dependencies...
error Response is not defined
Error: Response is not defined
at file:///home/projects/github-vb5hvk/node_modules/astro/dist/core/endpoint/index.js
at async ModuleJob.run (https://githubvb5hvk-jne1.w-credentialless.staticblitz.com/blitz.33975f1d.js:149:2330)
at async Promise.all (index 0)
at async ESMLoader.import (https://githubvb5hvk-jne1.w-credentialless.staticblitz.com/blitz.33975f1d.js:213:4862)
I also tried updating my main project to the RC version.
Firstly, I noticed that with astro check
:
@astrojs/check
and typescript
on each run but this appears to be fixed in https://github.com/withastro/astro/pull/8237--minimumSeverity warning
or else it fills up the screen with "hints" from scanning third-party libraries.--minimumSeverity warning
set, it still appears to produce a newline for each "hint" so I get screens full of blank space.tsconfig.json
in order to get it to skip some directoriesAfter adding in Svelte (the reason I ended up here in the first place) I get the errors that I originally set out to fix:
✘ [ERROR] The build was canceled
09:29:26 PM [content] Types generated 0.81s
✘ [ERROR] Invalid command: on-resolve [plugin JavaScript plugins]
node_modules/vite/node_modules/esbuild/lib/main.js:734:12:
734 │ throw new Error(`Invalid command: ` + request.command);
So, not the same error as this issue, so I guess that's good?
(I still have no idea how to fix the above error though 😅)
I'll try on the my office machine again tomorrow but I think that the new @astrojs/check
might have fixed this.
What version of
astro
are you using?2.0.14
Are you using an SSR adapter? If so, which one?
None
What package manager are you using?
npm,pnpm
What operating system are you using?
Mac
Describe the Bug
The following error occurs when
npm run check
is executed:fatal error: all goroutines are asleep - deadlock! #6204
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-sdeict-4fhgo1?file=src%2Fcomponents%2FCounter.tsx
Participation