Flow: error: Closing connection 'some ephemeral connection' due to uncaught exception in read loop: End_of_file

Created on 10 Jan 2018  路  29Comments  路  Source: facebook/flow

This happens at least with Flow 0.63.1 when using with IntelliJ or Webstorm and macOS 10.13.2 High Sierra:

Jan 10 15:47:20.320 [info] argv=/path/to/project/node_modules/flow-bin/flow-osx-v0.63.1/flow server /path/to/project
Jan 10 15:47:20.320 [info] Creating a new Flow server
Jan 10 15:47:50.393 [error] Closing connection 'some ephemeral connection' due to uncaught exception in read loop: End_of_file
Jan 10 15:47:50.394 [error] backtrace:
Jan 10 15:47:50.394 [error] Raised at file "map.ml", line 122, characters 16-25
Jan 10 15:47:50.394 [error] Called from file "src/unix/lwt_engine.ml", line 309, characters 8-36
Jan 10 15:47:50.394 [error] 
Jan 10 15:47:50.394 [error] Failed to shutdown socket client: Unix.Unix_error(Unix.ENOTCONN, "shutdown", "")
Jan 10 15:48:20.405 [error] Closing connection 'some ephemeral connection' due to uncaught exception in read loop: End_of_file
Jan 10 15:48:20.405 [error] backtrace:
Jan 10 15:48:20.405 [error] Raised at file "map.ml", line 122, characters 16-25
Jan 10 15:48:20.405 [error] Called from file "src/core/lwt.ml", line 802, characters 20-60
Jan 10 15:48:20.405 [error] 
Jan 10 15:48:20.406 [error] Failed to shutdown socket client: Unix.Unix_error(Unix.ENOTCONN, "shutdown", "")
Jan 10 15:48:50.415 [error] Closing connection 'some ephemeral connection' due to uncaught exception in read loop: End_of_file
Jan 10 15:48:50.415 [error] backtrace:
Jan 10 15:48:50.415 [error] Raised at file "map.ml", line 122, characters 16-25
Jan 10 15:48:50.415 [error] Called from file "src/core/lwt.ml", line 802, characters 20-60
Jan 10 15:48:50.415 [error] 
Jan 10 15:48:50.415 [error] Failed to shutdown socket client: Unix.Unix_error(Unix.ENOTCONN, "shutdown", "")
Jan 10 15:49:21.716 [error] Closing connection 'some ephemeral connection' due to uncaught exception in read loop: End_of_file
Jan 10 15:49:21.716 [error] backtrace:
Jan 10 15:49:21.716 [error] Raised at file "map.ml", line 122, characters 16-25
Jan 10 15:49:21.716 [error] Called from file "src/unix/lwt_engine.ml", line 309, characters 8-36
Jan 10 15:49:21.716 [error] 
Jan 10 15:49:21.716 [error] Failed to shutdown socket client: Unix.Unix_error(Unix.ENOTCONN, "shutdown", "")
Pending clarification

Most helpful comment

@mrkev the issue is logged as https://youtrack.jetbrains.com/issue/WEB-30296 on the WebStorm tracker.
There鈥檚 a comment above mentioning the problem occurring in VS Code as well.
To our knowledge, the problem lies on the Flow side. It seems that WebStorm uses some Flow鈥檚 methods in its integration with the Flow service that trigger the problem. Probably other editors don鈥檛 use these methods as much as we do, but we can鈥檛 say for sure what exactly should be changed on our side to work around the problem.
We are considering re-implementing the integration using the new LSP APIs introduced in Flow recently. And we hope that it will help us resolve this issue. Please note that we haven鈥檛 started working on that yet and we don鈥檛 know the state of the new API.

All 29 comments

Same issue here

I'm seeing the same thing with Webstorm and macOS 10.13.1 High Sierra.

same issue here

WebStrom 2017.3.3

$ uname -a
Linux ** 4.13.0-26-generic #29~16.04.2-Ubuntu SMP Tue Jan 9 22:00:44 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

Same (tested with flow 64 too)

same issue here([email protected])

same (webstorm + high sierra + [email protected])

same here

I was experiencing this issue on WebStorm 2017.1, [email protected], and macOS Sierra 10.12.6.

After updating WebStorm to 2017.3, the issue has gone away and flowjs intregration is working as expected.

Same here (IntelliJ Ultimate 2017.3.4 + Windows 10 + [email protected])

flow, 64bit windows 10 - vscode
Closing connection 'server #1' due to uncaught exception in read loop: Unix.Unix_error

flow-bin/flow-osx-v0.66.0; JetBrains IDEA 2018.1; macOS High Sierra 10.13.3


Closing connection 'some ephemeral connection' due to uncaught exception in read loop: End_of_file

Mar 30 11:14:06.232 [info] Creating a new Flow server
Mar 30 11:14:37.608 [error] Closing connection 'some ephemeral connection' due to uncaught exception in read loop: End_of_file
Mar 30 11:14:37.608 [error] backtrace:
Mar 30 11:14:37.608 [error] Raised at file "map.ml", line 130, characters 10-25
Mar 30 11:14:37.608 [error] Called from file "src/core/lwt.ml", line 817, characters 20-60
Mar 30 11:14:37.608 [error] 
Mar 30 11:14:37.608 [error] Failed to shutdown socket client: Unix.Unix_error(Unix.ENOTCONN, "shutdown", "")
Mar 30 11:14:37.608 [error] backtrace:
Mar 30 11:14:37.608 [error] Raised by primitive operation at file "src/unix/lwt_unix.cppo.ml", line 1533, characters 2-38
Mar 30 11:14:37.608 [error] Called from file "src/monitor/socketAcceptor.ml", line 180, characters 18-49
Mar 30 11:14:37.608 [error] 
Mar 30 11:15:40.232 [error] Closing connection 'some ephemeral connection' due to uncaught exception in read loop: End_of_file
Mar 30 11:15:40.232 [error] backtrace:
Mar 30 11:15:40.232 [error] Raised at file "map.ml", line 130, characters 10-25
Mar 30 11:15:40.232 [error] Called from file "src/core/lwt.ml", line 817, characters 20-60
Mar 30 11:15:40.232 [error] 
Mar 30 11:15:40.232 [error] Failed to shutdown socket client: Unix.Unix_error(Unix.ENOTCONN, "shutdown", "")
Mar 30 11:15:40.232 [error] backtrace:
Mar 30 11:15:40.232 [error] Raised by primitive operation at file "src/unix/lwt_unix.cppo.ml", line 1533, characters 2-38
Mar 30 11:15:40.232 [error] Called from file "src/monitor/socketAcceptor.ml", line 180, characters 18-49
Mar 30 11:15:40.232 [error]

same here

Also still getting this, running latest version of RubyMine.

/Users/jcham/.nvm/versions/node/v6.10.3/bin/node /Users/jcham/Git/CB/calmanac/node_modules/flow-bin/cli.js server /Users/jcham/Git/CB/calmanac
Apr 23 08:10:30.078 [info] argv=/Users/jcham/Git/CB/calmanac/node_modules/flow-bin/flow-osx-v0.65.0/flow server /Users/jcham/Git/CB/calmanac
Apr 23 08:10:30.078 [info] Creating a new Flow server
Apr 23 08:11:00.214 [error] Closing connection 'some ephemeral connection' due to uncaught exception in read loop: End_of_file
Apr 23 08:11:00.215 [error] backtrace:
Apr 23 08:11:00.215 [error] Raised at file "map.ml", line 130, characters 10-25
Apr 23 08:11:00.215 [error] Called from file "src/core/lwt.ml", line 817, characters 20-60
Apr 23 08:11:00.215 [error] 
Apr 23 08:11:00.215 [error] Failed to shutdown socket client: Unix.Unix_error(Unix.ENOTCONN, "shutdown", "")
Apr 23 08:11:00.215 [error] backtrace:
Apr 23 08:11:00.215 [error] Raised by primitive operation at file "src/unix/lwt_unix.cppo.ml", line 1533, characters 2-38
Apr 23 08:11:00.215 [error] Called from file "src/monitor/socketAcceptor.ml", line 173, characters 18-49
Apr 23 08:11:00.215 [error] 
Apr 23 08:11:30.199 [error] Closing connection 'some ephemeral connection' due to uncaught exception in read loop: End_of_file
Apr 23 08:11:30.199 [error] backtrace:
Apr 23 08:11:30.199 [error] Raised at file "map.ml", line 130, characters 10-25
Apr 23 08:11:30.199 [error] Called from file "src/core/lwt.ml", line 817, characters 20-60
Apr 23 08:11:30.199 [error] 
Apr 23 08:11:30.199 [error] Failed to shutdown socket client: Unix.Unix_error(Unix.ENOTCONN, "shutdown", "")
Apr 23 08:11:30.199 [error] backtrace:
Apr 23 08:11:30.199 [error] Raised by primitive operation at file "src/unix/lwt_unix.cppo.ml", line 1533, characters 2-38
Apr 23 08:11:30.199 [error] Called from file "src/monitor/socketAcceptor.ml", line 173, characters 18-49
Apr 23 08:11:30.199 [error] 
Apr 23 08:12:00.219 [error] Closing connection 'some ephemeral connection' due to uncaught exception in read loop: End_of_file
Apr 23 08:12:00.219 [error] backtrace:
Apr 23 08:12:00.219 [error] Raised at file "map.ml", line 130, characters 10-25
Apr 23 08:12:00.219 [error] Called from file "src/core/lwt.ml", line 817, characters 20-60
Apr 23 08:12:00.219 [error] 
Apr 23 08:12:00.219 [error] Failed to shutdown socket client: Unix.Unix_error(Unix.ENOTCONN, "shutdown", "")
Apr 23 08:12:00.219 [error] backtrace:
Apr 23 08:12:00.219 [error] Raised by primitive operation at file "src/unix/lwt_unix.cppo.ml", line 1533, characters 2-38
Apr 23 08:12:00.219 [error] Called from file "src/monitor/socketAcceptor.ml", line 173, characters 18-49
Apr 23 08:12:00.219 [error] 

Run flow check and it will tell you which file is crashing flow. Add this file to the [ignore] section of .flowconfig (or fix the error if it's your code) and run flow check again. Repeat until flow runs without crashing.

This one is still not fixed. 馃槥

Yeah that's not the solution to this problem, if only it were that straightforward.

same here

same here

https://github.com/facebook/flow/issues/6424 seems to be the same issue, also with Webstorm.

"same here" doesn't help solve this issue. Please comment your version of flow, editor, and any other information that might help reproduce the error if you have it

Same here:
flow-bin/flow-osx-v0.74.0; WebStorm 2018.1.5; macOS High Sierra 10.13.6

Any other info I can provide?

@zdrazil that's good, thanks! Out of curiosity, when did the problem start? Was it there from the beginning or did it come once your project reached a certain size / you imported some package / etc?

Also curious-- has anyone submitted this bug report to WebStorm and got a response? I haven't seen reports for this bug pertaining to VSCode or Atom, so I'm almost certain this is an issue with the editor.

@mrkev the issue is logged as https://youtrack.jetbrains.com/issue/WEB-30296 on the WebStorm tracker.
There鈥檚 a comment above mentioning the problem occurring in VS Code as well.
To our knowledge, the problem lies on the Flow side. It seems that WebStorm uses some Flow鈥檚 methods in its integration with the Flow service that trigger the problem. Probably other editors don鈥檛 use these methods as much as we do, but we can鈥檛 say for sure what exactly should be changed on our side to work around the problem.
We are considering re-implementing the integration using the new LSP APIs introduced in Flow recently. And we hope that it will help us resolve this issue. Please note that we haven鈥檛 started working on that yet and we don鈥檛 know the state of the new API.

Same here, details:

IntelliJ IDEA 2018.2.2 (Ultimate Edition)
Build #IU-182.4129.33, built on August 21, 2018
Windows 10 10.0

"flow-bin": "^0.80.0"

.flowconfig in the project root:

[ignore]
<PROJECT_ROOT>/.idea/.*
<PROJECT_ROOT>/android/.*
<PROJECT_ROOT>/docs/.*
<PROJECT_ROOT>/ios/.*
<PROJECT_ROOT>/node_modules/.*
<PROJECT_ROOT>/plugins/.*

[include]

[libs]

[lints]

[options]

[strict]

Also Flow console reports about Sep 3 20:28:59.101 [info] File watcher reported 19 files changed when only one file has been changed as in #6424

Similar problem still happens with 0.84.0:

/Users/path/to/project/node_modules/flow-bin/vendor/flow server /Users/path/to/project
Nov  2 11:29:11.758 [info] argv=/Users/path/to/project/node_modules/flow-bin/flow-osx-v0.84.0/flow server /Users/path/to/project
Nov  2 11:29:11.759 [info] Creating a new Flow server
Nov  2 11:29:24.421 [info] File watcher reported 4 files changed
Nov  2 11:29:41.854 [error] Closing connection 'some ephemeral connection' due to uncaught exception in read loop: End_of_file
Nov  2 11:29:41.854 [error] backtrace:
Nov  2 11:29:41.854 [error] Raised at file "map.ml", line 130, characters 10-25
Nov  2 11:29:41.854 [error] Called from file "src/unix/lwt_engine.ml", line 318, characters 8-36
Nov  2 11:29:41.854 [error] 
Nov  2 11:29:41.854 [error] Failed to shutdown socket client: Unix.Unix_error(Unix.ENOTCONN, "shutdown", "")
Nov  2 11:29:41.854 [error] backtrace:
Nov  2 11:29:41.854 [error] Raised by primitive operation at file "src/unix/lwt_unix.cppo.ml", line 1533, characters 2-38
Nov  2 11:29:41.854 [error] Called from file "src/monitor/socketAcceptor.ml", line 148, characters 18-49
Nov  2 11:29:41.854 [error] 
Nov  2 11:29:46.673 [error] Closing connection 'server #1' due to uncaught exception in read loop: End_of_file
Nov  2 11:29:46.673 [error] backtrace:
Nov  2 11:29:46.673 [error] Raised at file "map.ml", line 130, characters 10-25
Nov  2 11:29:46.673 [error] Called from file "src/unix/lwt_engine.ml", line 318, characters 8-36
Nov  2 11:29:46.673 [error] 
Unable to obtain kernel buffer: Operation not permitted
usage: sudo dmesg
Nov  2 11:29:46.690 [error] Flow server (pid 34338) exited with code Unknown_error (110)
Nov  2 11:29:46.690 [info] Monitor is exiting (Dying along with server)
Nov  2 11:29:46.690 [info] Broadcasting to threads and waiting 1 second for them to exit

and:

/Users/path/to/project/node_modules/flow-bin/vendor/flow server /Users/path/to/project
Nov  2 11:38:34.590 [info] argv=/Users/path/to/project/node_modules/flow-bin/flow-osx-v0.84.0/flow server /Users/path/to/project
Nov  2 11:38:34.590 [info] Creating a new Flow server
Nov  2 11:39:03.533 [info] File watcher reported 3 files changed
Nov  2 11:39:05.541 [info] File watcher reported 1 file changed
Nov  2 11:39:07.427 [error] Closing connection 'server #1' due to uncaught exception in read loop: End_of_file
Nov  2 11:39:07.427 [error] backtrace:
Nov  2 11:39:07.427 [error] Raised at file "map.ml", line 130, characters 10-25
Nov  2 11:39:07.427 [error] Called from file "src/unix/lwt_engine.ml", line 318, characters 8-36
Nov  2 11:39:07.427 [error] 
Unable to obtain kernel buffer: Operation not permitted
usage: sudo dmesg
Nov  2 11:39:07.443 [error] Flow server (pid 37074) exited with code Unknown_error (110)
Nov  2 11:39:07.443 [info] Monitor is exiting (Dying along with server)
Nov  2 11:39:07.443 [info] Broadcasting to threads and waiting 1 second for them to exit

This completely breaks Flow support in IntelliJ IDEA.

I had one yarn linked package and when unlinked that, flow started to work normally again.

We started having this issue when jumping to babel 7.

I think this might not happen anymore? 馃Anyone still experiencing this with recent Flows?

I am getting this error on my machine now.

Flow, a static type checker for JavaScript, version 0.121.0

IntelliJ IDEA 2019.3.3 (Ultimate Edition)
Build #IU-193.6494.35, built on February 11, 2020
Licensed to

Runtime version: 11.0.5+10-b520.38 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.14.6
GC: ParNew, ConcurrentMarkSweep
Memory: 4012M
Cores: 12
Registry: javascript.flow.use.lsp=false (I tried with both true and false)
Non-Bundled Plugins: CheckStyle-IDEA, R4Intellij, com.alayouni.ansiHighlight, com.google.bamboo.id, com.intellij.ideolog, com.intellij.lang.jsgraphql, com.jetbrains.plugins.ini4idea, org.intellij.plugins.hcl, org.jetbrains.kotlin, some.awesome

Logs from intellij:

Apr  3 10:23:25.667 [info] argv=/node_modules/flow-bin/flow-osx-v0.121.0/flow server /
Apr  3 10:23:25.667 [info] lazy_mode=off
Apr  3 10:23:25.667 [info] arch=classic
Apr  3 10:23:25.667 [info] abstract_locations=off
Apr  3 10:23:25.667 [info] max_workers=12
Apr  3 10:23:25.667 [info] Creating a new Flow server
Apr  3 10:23:55.993 [error] Connection 'some ephemeral connection' was closed from the other side
Apr  3 10:23:55.993 [error] Failed to shutdown socket client: Unix.Unix_error(Unix.ENOTCONN, "shutdown", "")
Apr  3 10:23:55.993 [error] backtrace:
Apr  3 10:23:55.993 [error] Raised by primitive operation at file "src/unix/lwt_unix.cppo.ml", line 1656, characters 2-38
Apr  3 10:23:55.993 [error] Called from file "src/monitor/socketAcceptor.ml", line 148, characters 18-49
Apr  3 10:23:55.993 [error] 
Apr  3 10:24:10.427 [info] File watcher reported 2 files changed

Everything works fine when running from command line directly. (I'm not quite sure if this is intellij problem or flow problem. But I found this thread so here I am!)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Gozala picture Gozala  路  54Comments

gcanti picture gcanti  路  48Comments

StoneCypher picture StoneCypher  路  253Comments

jamesisaac picture jamesisaac  路  44Comments

xtinec picture xtinec  路  65Comments