facebook / flow

Adds static typing to JavaScript to improve developer productivity and code quality.
https://flow.org/
MIT License
22.08k stars 1.86k forks source link

Closing connection 'server #1' due to uncaught exception in command loop: Unix.Unix_error(Unix.EPIPE, "write", "") #8736

Closed christianvuerings closed 1 year ago

christianvuerings commented 3 years ago

We upgraded Flow from 0.152.0 to 0.158.0 and now we regularly see the server shutting down (every 10 to 15 minutes).

Flow version: 0.158.0 Node.js version: v14.15.4

Expected behavior

No regular shut down of the Flow server

Actual behavior

Flow occasionally shuts down, we see the following exception in the monitor_log:

Aug 24 14:47:45.353 [info] File watcher reported 7 files changed
Aug 24 14:51:14.121 [error] Closing connection 'server #1' due to uncaught exception in command loop: Unix.Unix_error(Unix.EPIPE, "write", "")
Aug 24 14:51:14.121 [error] backtrace:
Aug 24 14:51:14.121 [error] Raised by primitive operation at file "src/unix/lwt_unix.cppo.ml", line 710, characters 39-67
Aug 24 14:51:14.121 [error] Called from file "src/unix/lwt_unix.cppo.ml", line 562, characters 17-28
Aug 24 14:51:14.121 [error] 
Aug 24 14:51:14.186 [error] Flow server (pid 20710) was killed with sigsegv signal
Aug 24 14:51:14.186 [info] Monitor is exiting code -6 (Dying along with signaled server)
Aug 24 14:51:14.186 [info] Broadcasting to threads and waiting 1 second for them to exit
dsainati1 commented 3 years ago

We have fixed a number of segfaults in version 158, but it's possible there are still a few around. If possible do you think you could isolate a repro that you would be able to link in the form of a Github repo?

christianvuerings commented 3 years ago

@dsainati1 is there a way to figure out what the root cause is when a segfault happens? Our codebase is +2 million lines of JS so it's tricky to know which file / import is causing the issue. Definitely willing to share a few files if we can pinpoint which ones cause the issue.

Also know that we ended up disabling experimental.refactor which fixed the following issues:

Screen Shot 2021-08-24 at 9 04 43 AM

image

dsainati1 commented 3 years ago

Does disabling refactor also fix the segfault?

christianvuerings commented 3 years ago

Does disabling refactor also fix the segfault?

@dsainati1 So far, yes, we are no longer seeing the segfault after setting experimental.refactor=false in our flow config.

We will update this issue if we would end up seeing it again.

mroch commented 1 year ago

please reopen or file a new issue if this happens again!