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

Application fail to respawn after file modification has been detected #243

Open
bobbui opened this issue Jan 10, 2021 · 21 comments
Open

Application fail to respawn after file modification has been detected #243

bobbui opened this issue Jan 10, 2021 · 21 comments

Comments

@bobbui
Copy link

bobbui commented Jan 10, 2021

Issue description

The application fails to respawn after a few restarts:
command :

cross-env NODE_ENV=development ts-node-dev --debug --files --respawn --project tsconfig.json --transpile-only --inspect --watch .env,../common/src, -- src/devIndex.ts

INFO] 17:58:00 Restarting: ../app/src/langConsts.ts has been modified
[DEBUG] 17:58:00 ../snip_common/src/langConsts.ts compiled in 184 ms
[DEBUG] 17:58:00 Removing all watchers from files
[DEBUG] 17:58:00 Child is still running, restart upon exit
[DEBUG] 17:58:00 Disconnecting from child
[DEBUG] 17:58:00 Sending SIGTERM kill to child pid 79198
[2021-01-09T17:58:00.471] [INFO] expressApp.ts - Shutting down...
About to exit with code: 143
Assertion failed: (napi_create_string_utf8(env, events->events[idx].path, NAPI_AUTO_LENGTH, &args[0]) == napi_ok), function fse_dispatch_event, file ../src/fsevents.c, line 147.
npm ERR! code 1
npm ERR! path /Users/bobbui/Documents/app/packages/backend
npm ERR! command failed
npm ERR! command sh -c cross-env NODE_ENV=development ts-node-dev --debug --files --respawn --project tsconfig.json --transpile-only --inspect --watch .env,../common/src,  -- src/devIndex.ts

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/bobbui/.npm/_logs/2021-01-10T01_58_00_658Z-debug.log

I think the most relevant part is Assertion failed: (napi_create_string_utf8(env, events->events[idx].path, NAPI_AUTO_LENGTH, &args[0]) == napi_ok), function fse_dispatch_event, file ../src/fsevents.c, line 147.

but a quick Google search returns absolutely nothing 😢

Context

OS version (is it docker or host?), ts-node-dev version
Mac OS 10.15.7
ts-node-dev@1.1.1
node v15.4.0
Did you try to run with ts-node?
yes
Did you try to run with --files option enabled?
yes
Did you try to run with --debug option enabled?
yes
Do you have a repro example (git repo) with simple steps to reproduce your problem?
no

@brent-williams
Copy link

@bobbui I feel your pain. As temporary workaround I rolled back from 1.1.1 to 1.1.0, problem gone.

@bobbui
Copy link
Author

bobbui commented Jan 10, 2021

@bobbui I feel your pain. As temporary workaround I rolled back from 1.1.1 to 1.1.0, problem gone.

Revert to 1.1.0 does not work for me.

@wclr
Copy link
Owner

wclr commented Jan 11, 2021

There were reports on this #241 not sure what it may be caused by. This also probably affects MacOs users. Try to use --poll option.

@monolithed
Copy link

Assertion failed: (napi_create_string_utf8(env, events->events[idx].path, NAPI_AUTO_LENGTH, &args[0]) == napi_ok), function fse_dispatch_event, file ../src/fsevents.c, line 147.

I caught that error after upgrading my storybook (npx sb upgrade). It's weird, because there is no ts-node in my dependency tree.

@paulmax-os
Copy link

Same here within a nuxt(https://nuxtjs.org/) project. I had to upgrade a few dependencies, but nothing really crucial and since today it's randomly throwing those errors while being in watch mode for compilation. Upon some changes everything's compiling just fine, sometimes it pops up out of the blue. Haven't noticed any pattern.

Assertion failed: (napi_create_string_utf8(env, events->events[idx].path, NAPI_AUTO_LENGTH, &args[0]) == napi_ok), function fse_dispatch_event, file ../src/fsevents.c, line 147.

@briancodes
Copy link

briancodes commented Jan 14, 2021

@bobbui I feel your pain. As temporary workaround I rolled back from 1.1.1 to 1.1.0, problem gone.

Revert to 1.1.0 does not work for me.

Reverting also didn't work for me. After the error my CPU usage remains high (can see a 100% node instance in Activity Monitor)

@maxwellsmart84
Copy link

maxwellsmart84 commented Jan 15, 2021

Same issue for me. I want to mention this that the port continues to stay open on my server and I have to look up the PID and kill it manually every time this happens (pretty awful DX)

Using Node 14.15.4
Big Sur 11.1

"NODE_ENV=local ts-node-dev --debug --transpile-only --respawn ./src/index.ts",

info: App > 🚀 Server ready at http://localhost:7765/graphql {"label":"common-express.cjs.development.js","system":"local-idp-profile-service","pid":19784,"host":"maxwellsmacbook.lan","timestamp":"2021-01-15T19:47:21.259Z"} [INFO] 14:47:28 Restarting: /Users/maxwell.krause/dev/local-idp-profile-service/src/gql/typeDefs/Address.ts has been modified [DEBUG] 14:47:28 /Users/maxwell.krause/dev/local-idp-profile-service/src/gql/typeDefs/Address.ts compiled in 7 ms [DEBUG] 14:47:28 Removing all watchers from files [DEBUG] 14:47:28 Child is still running, restart upon exit [DEBUG] 14:47:28 Disconnecting from child [DEBUG] 14:47:28 Sending SIGTERM kill to child pid 19784 [DEBUG] 14:47:28 Child exited with code 0 [DEBUG] 14:47:28 Starting child process -r /var/folders/x2/q8lst3254ygffgj503cxfjjw0000gr/T/ts-node-dev-hook-9205511574690581.js /Users/maxwell.krause/dev/local-idp-profile-service/node_modules/ts-node-dev/lib/wrap.js ./src/index.ts Assertion failed: (napi_create_string_utf8(env, events->events[idx].path, NAPI_AUTO_LENGTH, &args[0]) == napi_ok), function fse_dispatch_event, file ../src/fsevents.c, line 147. [1] 19471 abort npm run dev

I also see this which I haven't before, granted I am using this in conjuction with a graphql code generator named "nexus"

Error: write EPIPE at process.target._send (internal/child_process.js:832:20) at process.target.send (internal/child_process.js:703:19) at Object.exports.send (/Users/maxwell.krause/dev/local-idp-profile-service/node_modules/ts-node-dev/lib/ipc.js:17:14) at /Users/maxwell.krause/dev/local-idp-profile-service/node_modules/ts-node-dev/lib/wrap.js:88:9 at Object.nodeDevHook [as .ts] (/Users/maxwell.krause/dev/local-idp-profile-service/node_modules/ts-node-dev/lib/hook.js:61:17) at Module.load (internal/modules/cjs/loader.js:928:32) at Function.Module._load (internal/modules/cjs/loader.js:769:14) at Module.require (internal/modules/cjs/loader.js:952:19) at require (internal/modules/cjs/helpers.js:88:18) at Object.<anonymous> (/Users/maxwell.krause/dev/local-idp-profile-service/node_modules/ts-node-dev/lib/wrap.js:104:1)

@RodolfoSilva
Copy link

There were reports on this #241 not sure what it may be caused by. This also probably affects MacOs users. Try to use --poll option.

This works well. Thanks @wclr

@rista404
Copy link

Any progress on this one? --poll works but is quite CPU intensive

@taylorlapeyre
Copy link

This bug basically completely breaks this tool — is there anything we can do to help?

@paulmax-os
Copy link

On the nuxt side of things it seems that this issue was solved through this: fsevents/fsevents#356

@alexanderMontague
Copy link

Having this problem still. --poll flag and reverting to 1.1.0 did not work. Using: ts-node-dev ver. 1.1.0 (ts-node ver. 9.1.1, typescript ver. 3.9.7) 😢

@lhermann
Copy link

I can confirm that. Even with --poll flag the problem persists. However, it does happen less frequently.

@wclr
Copy link
Owner

wclr commented Feb 25, 2021

Try to upgrade.

@rista404
Copy link

Still having the same issue on v1.1.6.

@sliptype
Copy link

sliptype commented Mar 1, 2021

Can confirm, still an issue:

[0] Assertion failed: (napi_create_string_utf8(env, events->events[idx].path, NAPI_AUTO_LENGTH, &args[0]) == napi_ok), function fse_dispatch_event, file ../src/fsevents.c, line 147.
[0] error Command failed with signal "SIGABRT".
[0] info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
[0] yarn start:dev exited with code 1
interrupt: 2
~/w/u/api:develop* λ yarn list ts-node-dev chokidar
yarn list v1.22.10
warning Filtering by arguments is deprecated. Please use the pattern option instead.
├─ chokidar@3.5.1
└─ ts-node-dev@1.1.6

@qqilihq
Copy link

qqilihq commented Mar 20, 2021

Same trouble here on 1.1.6. I was (as usual) suspecting the Docker file watches. But even when running this outside Docker (on macOS) the issue happens.

Any observations yet, if Is this issue introduced from node-dev or is it specific to ts-node-dev?

@lhermann
Copy link

If you still have this issue on macOS it is likely related to fsevents

Version 2.3.2 or newer should fix it, see here: fsevents/fsevents#356

Fix:

npm update fsevents

(I can confirm it works on my environment)

@qqilihq
Copy link

qqilihq commented Apr 11, 2021

I have been trying version 2.3.2 of fsevents this afternoon, but for me the original issue still occurs. (macOS 10.15.7)

@namkai
Copy link

namkai commented Apr 22, 2021

Still getting this issue
Assertion failed: (napi_create_string_utf8(env, events->events[idx].path, NAPI_AUTO_LENGTH, &args[0]) == napi_ok), function fse_dispatch_event, file ../src/fsevents.c, line 147.

@mauriciosoares
Copy link

For the people that are still having this problem, the alternative solution suggested here worked for me: #258

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

No branches or pull requests