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

Uncaught exception (file "lwt_unix.cppo.ml", line 244, characters 14-31) #5583

Closed lll000111 closed 6 years ago

lll000111 commented 6 years ago

Found on Windows 10, Flow 0.62, run through WebStorm - also see WS ticket https://youtrack.jetbrains.com/issue/WEB-30395

C:\Tools\flow.exe server C:/Users/mha/OneDrive/Projects/one
[info] argv=C:\Users\mha\OneDrive\Tools\flow.exe server C:/Users/mha/OneDrive/Projects/one
[info] Creating a new Flow server
[error] Closing connection 'server #1' due to uncaught exception in read loop: Unix.Unix_error(Unix.EPIPE, "read", "")
[error] backtrace:
[error] Raised by primitive operation at file "lwt_unix.cppo.ml", line 244, characters 14-31
[error] 
[error] Flow server (pid 368) exited with code Dfind_died (99)
[info] Creating a new Flow server
[error] Closing connection 'server #2' due to uncaught exception in read loop: Unix.Unix_error(Unix.EPIPE, "read", "")
[error] backtrace:
[error] Raised by primitive operation at file "lwt_unix.cppo.ml", line 244, characters 14-31
[error] 
[error] Flow server (pid 660) exited with code Unknown_error (110)
[info] Monitor is exiting (Dying along with server)
[info] Broadcasting to threads and waiting 1 second for them to exit

Key lines:

...uncaught exception in read loop
...
Raised by primitive operation at file "lwt_unix.cppo.ml", line 244, characters 14-31
vedi commented 6 years ago

👍 got the same Windows 10, Flow 0.62, WS

lll000111 commented 6 years ago

Here is another error in another location:

...
[info] Creating a new Flow server
[error] Closing connection 'some ephemeral connection' due to uncaught exception in read loop: Unix.Unix_error(Unix.ECONNRESET, "write", "")
[error] backtrace:
[error] Raised by primitive operation at file "lwt_unix.cppo.ml", line 639, characters 38-65
[error] Called from file "lwt_unix.cppo.ml", line 492, characters 13-24
[error] 
[error] Flow server (pid 3036) exited with code Dfind_died (99)
seanippolito commented 6 years ago

Getting a similar Error using webstorm and windows 7

JCMais commented 6 years ago

Same error here, using WebStorm integration.

lll000111 commented 6 years ago

Still the same messages - Flow 0.65              (ping)

sibelius commented 6 years ago

same here

dcgudeman commented 6 years ago

similar with PhpStorm 2017.3.4 and Flow 0.65 and MacOS:

Feb 14 15:08:12.818 [info] argv=/usr/local/bin/flow server /project/directory
Feb 14 15:08:12.818 [info] Creating a new Flow server
Feb 14 15:08:42.908 [error] Closing connection 'some ephemeral connection' due to uncaught exception in read loop: End_of_file
Feb 14 15:08:42.908 [error] backtrace:
Feb 14 15:08:42.908 [error] Raised at file "src/core/lwt_pqueue.ml", line 78, characters 15-30
Feb 14 15:08:42.908 [error] Called from file "src/core/lwt_pqueue.ml", line 86, characters 12-24
Feb 14 15:08:42.908 [error] 
Feb 14 15:08:42.908 [error] Failed to shutdown socket client: Unix.Unix_error(Unix.ENOTCONN, "shutdown", "")
Feb 14 15:08:42.908 [error] backtrace:
Feb 14 15:08:42.908 [error] Raised by primitive operation at file "src/unix/lwt_unix.cppo.ml", line 1533, characters 2-38
Feb 14 15:08:42.908 [error] Called from file "src/monitor/socketAcceptor.ml", line 173, characters 18-49
Feb 14 15:08:42.908 [error] 
Feb 14 15:09:13.737 [error] Closing connection 'some ephemeral connection' due to uncaught exception in read loop: End_of_file
Feb 14 15:09:13.737 [error] backtrace:
Feb 14 15:09:13.737 [error] Raised at file "map.ml", line 131, characters 10-25
Feb 14 15:09:13.737 [error] Called from file "src/core/lwt.ml", line 817, characters 20-60
Feb 14 15:09:13.737 [error] 
Feb 14 15:09:13.737 [error] Failed to shutdown socket client: Unix.Unix_error(Unix.ENOTCONN, "shutdown", "")
Feb 14 15:09:13.737 [error] backtrace:
Feb 14 15:09:13.737 [error] Raised by primitive operation at file "src/unix/lwt_unix.cppo.ml", line 1533, characters 2-38
Feb 14 15:09:13.737 [error] Called from file "src/monitor/socketAcceptor.ml", line 173, characters 18-49
Feb 14 15:09:13.737 [error] 

Build #PS-173.4548.32, built on January 30, 2018 JRE: 1.8.0_152-release-1024-b11 x86_64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Mac OS X 10.13.3

levenleven commented 6 years ago

Same with latest Flow 0.66

JCMais commented 6 years ago

Error still occurs with latest flow version and PhpStorm 2018 EAP

mmakarin commented 6 years ago

Same here. flow 0.66

grengojbo commented 6 years ago

Same here. flow 0.67.1 MacOS X 10.13.3 WebStorm 2018.1 EAP and 2017.3.5

mmakarin commented 6 years ago

flow 0.68 same thing

levenleven commented 6 years ago

@mroch According to above comments, "Windows support" label should be removed. (Crashes on Mac as well)

lll000111 commented 6 years ago

@levenleven I didn't do it! I have no labeling rights.

abhishek199-dhn commented 6 years ago

flow 0.68 same here MacOS X + WebStorm 2018.1 EAP and 2017.3.5

gabelevi commented 6 years ago

Lwt is a library that Flow uses. It's basically promises for OCaml. So unfortunately most the stacks collected here are for different issues.

@lll000111's first two stack traces shows that each time we start up a Flow server, it crashes due to "Dfind_died". Dfind is the file watcher Flow uses. It sounds like it might be less than stable on Windows for some reason. It looks like #4960 is tracking the dfind dying issue.

@dcgudeman's stack trace shows the server's connections to ephemeral commands (one-off requests, like flow status and flow type-at-pos) are being closed before we expect. Not fatal errors. I wonder if PhpStorm is maybe killing some commands before they finish? How does this affect the user experience? If there's no user-visible effect, I'd just recommend ignoring this part of the log. If there is a user-visible effect, could you report it in its own issue?

Since this issue is kind of ending up as a catch-all, I'm going to close it out.

levenleven commented 6 years ago

@gabelevi As most flow issues this one just closed without resolution. Open another one and it will be closed the same way in a few months. How does this affect user experience? - flow fails to start.

hon2a commented 6 years ago

I'm having the same issue suddenly, launching flow directly from command-line (Windows 7 Enterprise, flow-bin v0.67.1). Weirdly enough it started exhibiting after I've spend quite a bit of time updating to the latest flow-bin throughout our whole codebase.

Mar 27 16:26:06.012 [info] argv=C:\Users\*****\AppData\Roaming\npm\node_modules\flow-bin\flow-win64-v0.67.1\flow.exe start --temp-dir C:\Users\*****\AppData\Local\Temp\flow C:\Users\*****\Documents\repos\*****
Mar 27 16:26:06.013 [info] Creating a new Flow server
Mar 27 16:26:33.448 [error] Closing connection 'server #1' due to uncaught exception in read loop: Unix.Unix_error(Unix.EPIPE, "read", "")
Mar 27 16:26:33.448 [error] backtrace:
Mar 27 16:26:33.448 [error] Raised by primitive operation at file "src/unix/lwt_unix.cppo.ml", line 253, characters 14-31
Mar 27 16:26:33.448 [error] 
Mar 27 16:26:33.534 [error] Flow server (pid 296) exited with code Unknown_error (110)
Mar 27 16:26:33.534 [info] Monitor is exiting (Dying along with server)
Mar 27 16:26:33.534 [info] Broadcasting to threads and waiting 1 second for them to exit
hon2a commented 6 years ago

So ... I found the real culprit in my case by running flow check, which prints out the full stack trace directly.

Turns out Flow was crashing when trying to parse node_modules/module-deps/test/invalid_pkg/package.json, because it contains just a string, not an object. Adding .*/node_modules/module-deps/.* to [ignore] in .flowconfig fixed the problem.

mroch commented 6 years ago

@hon2a can you file a new issue specifically about the crash parsing JSON? thanks :)

hon2a commented 6 years ago

@mroch Sure thing! Here you go: #6049 .