flow / flow-bin

Binary wrapper for Flow - A static type checker for JavaScript
https://flow.org
Other
536 stars 48 forks source link

Flow server error. #138

Closed jdetle closed 2 years ago

jdetle commented 6 years ago

Issue

Hi All, sorry if I can't help much which the log dump, but I'm trying to run yarn flow and getting this issue from the hack workers. Should I crosspost this in https://github.com/facebook/hhvm?

Error Dump

[2018-09-08 18:42:12.523] Initializing Server (This might take some time)
[2018-09-08 18:42:12.523] executable=/Users/mac/github/one/nteract.io/node_modules/flow-bin/flow-osx-v0.80.0/flow
[2018-09-08 18:42:12.523] version=0.80.0
[2018-09-08 18:42:12.525] Parsing
[2018-09-08 18:42:14.697] Building package heap
[2018-09-08 18:42:14.781] Loading libraries
[2018-09-08 18:42:16.505] Resolving dependencies
Exception: Failure("Str.replace: reference to unmatched group")
Potential backtrace:
Raised by primitive operation at file "str.ml", line 654, characters 2-54
Called from file "str.ml", line 679, characters 26-39
Called from file "str.ml", line 683, characters 31-51
Called from file "src/services/inference/module/module_js.ml", line 79, characters 21-111
Called from file "list.ml", line 96, characters 24-34
Called from file "src/services/inference/module/module_js.ml", line 89, characters 20-56
Called from file "src/state/locals/module/module_hashtables.ml", line 84, characters 17-23
Called from file "src/services/inference/module/module_js.ml", line 441, characters 21-63
Called from file "src/services/inference/module/module_js.ml", line 635, characters 2-79
Called from file "map.ml", line 294, characters 19-42
Called from file "src/services/inference/module/module_js.ml", line 642, characters 25-208
Called from file "src/services/inference/module/module_js.ml", line 673, characters 4-67
Called from file "src/services/inference/module/module_js.ml", line 683, characters 4-74
Called from file "src/services/inference/types_js.ml", line 187, characters 21-121
Called from file "list.ml", line 96, characters 24-34
Called from file "hack/procs/workerController.ml", line 189, characters 42-47
Called from file "hack/procs/worker.ml", line 103, characters 4-37
Worker exited (code: 2)
Subprocess(54327): fail 2Unhandled exception: Worker_failed (process_id = 54327): (Worker_quit WEXITED 2)
Raised at file "src/core/lwt.ml", line 3008, characters 20-29
Called from file "src/unix/lwt_main.ml", line 42, characters 8-18
Called from file "src/server/server.ml", line 157, characters 6-54

Versions

Version of flow-bin: '0.80.0'. Yarn version: '1.9.4'

jdetle commented 6 years ago
Sep  8 18:59:22.568 [info] Creating a new Flow server
Sep  8 18:59:23.474 [error] Closing connection 'some ephemeral connection' due to uncaught exception in read loop: End_of_file
Sep  8 18:59:23.474 [error] backtrace:
Sep  8 18:59:23.474 [error] Raised at file "map.ml", line 130, characters 10-25
Sep  8 18:59:23.474 [error] Called from file "src/core/lwt.ml", line 817, characters 20-60
Sep  8 18:59:23.474 [error] 
Sep  8 18:59:23.474 [error] Failed to shutdown socket client: Unix.Unix_error(Unix.ENOTCONN, "shutdown", "")
Sep  8 18:59:23.474 [error] backtrace:
Sep  8 18:59:23.474 [error] Raised by primitive operation at file "src/unix/lwt_unix.cppo.ml", line 1533, characters 2-38
Sep  8 18:59:23.474 [error] Called from file "src/monitor/socketAcceptor.ml", line 148, characters 18-49
Sep  8 18:59:23.474 [error] 
Unable to obtain kernel buffer: Operation not permitted
usage: sudo dmesg
Sep  8 18:59:28.011 [error] Flow server (pid 3686) exited with code Unknown_error (110)
Sep  8 18:59:28.011 [info] Monitor is exiting (Dying along with server)
Sep  8 18:59:28.011 [info] Broadcasting to threads and waiting 1 second for them to exit

more errors

jdetle commented 6 years ago

Closed because duplication of https://github.com/facebook/flow/issues/5919, but this is a really difficult to debug error.

jdetle commented 6 years ago

Not sure if its the same issue so I'm going to leave this open for visibility

nrabinowitz commented 6 years ago

Seeing the same issue in v0.82.0:

Oct  3 10:19:24.763 [info] argv=/some_path/node_modules/flow-bin/flow-osx-v0.82.0/flow start
Oct  3 10:19:24.764 [info] Creating a new Flow server
Oct  3 10:20:03.298 [error] Closing connection 'server #1' due to uncaught exception in read loop: End_of_file
Oct  3 10:20:03.298 [error] backtrace:
Oct  3 10:20:03.298 [error] Raised at file "map.ml", line 130, characters 10-25
Oct  3 10:20:03.298 [error] Called from file "src/unix/lwt_engine.ml", line 318, characters 8-36
Oct  3 10:20:03.298 [error] 
Unable to obtain kernel buffer: Operation not permitted
usage: sudo dmesg
Oct  3 10:20:03.314 [error] Flow server (pid 74556) exited with code Unknown_error (110)
Oct  3 10:20:03.314 [info] Monitor is exiting (Dying along with server)
Oct  3 10:20:03.314 [info] Broadcasting to threads and waiting 1 second for them to exit

In my case, I suspect this to be due to the number of files Flow is trying to parse (running this from the root of a monorepo with 165K files including node_modules).

MarcelCutts commented 6 years ago

We've been seeing this failure on our CI too.

yarn run v1.9.2
$ flow check
Worker interrupted with signal: sigkill
Subprocess(108): fail 2Unhandled exception: Worker_failed (process_id = 108): (Worker_quit WEXITED 2)
Raised at file "src/core/lwt.ml", line 3008, characters 20-29
Called from file "src/unix/lwt_main.ml", line 42, characters 8-18
Called from file "src/commands/checkCommands.ml", line 108, characters 57-132
Called from file "src/flow.ml", line 86, characters 6-34

Worker slave 144 exception: Unix.Unix_error(Unix.EPIPE, "write", "")
Worker slave 144 Potential backtrace:
Raised by primitive operation at file "unix.ml", line 257, characters 7-34
Called from file "hack/utils/marshal_tools.ml", line 145, characters 6-67
Called from file "hack/utils/marshal_tools.ml", line 158, characters 4-312
Called from file "hack/utils/measure.ml", line 238, characters 12-16
Called from file "hack/procs/worker.ml", line 88, characters 14-143
Called from file "hack/procs/worker.ml", line 128, characters 4-37
Worker slave 138 exception: Unix.Unix_error(Unix.EPIPE, "write", "")
Worker slave 138 Potential backtrace:
Raised by primitive operation at file "unix.ml", line 257, characters 7-34
Called from file "hack/utils/marshal_tools.ml", line 145, characters 6-67
Called from file "hack/utils/marshal_tools.ml", line 158, characters 4-312
Called from file "hack/utils/measure.ml", line 238, characters 12-16
Called from file "hack/procs/worker.ml", line 88, characters 14-143
Called from file "hack/procs/worker.ml", line 128, characters 4-37
Worker slave 146 exception: Unix.Unix_error(Unix.EPIPE, "write", "")
Worker slave 146 Potential backtrace:
Worker slave 150 exception: Unix.Unix_error(Unix.EPIPE, "write", "")
Worker slave 150 Potential backtrace:
Unix.Unix_error(Unix.EPIPE, "write", "")
Raised by primitive operation at file "unix.ml", line 257, characters 7-34
Called from file "hack/utils/marshal_tools.ml", line 145, characters 6-67
Called from file "hack/utils/marshal_tools.ml", line 158, characters 4-312
Called from file "hack/utils/measure.ml", line 238, characters 12-16
Called from file "hack/procs/worker.ml", line 88, characters 14-143
Called from file "hack/procs/worker.ml", line 128, characters 4-37
Raised by primitive operation at file "unix.ml", line 257, characters 7-34
Called from file "hack/utils/marshal_tools.ml", line 145, characters 6-67
Called from file "hack/utils/marshal_tools.ml", line 158, characters 4-312
Called from file "hack/utils/measure.ml", line 238, characters 12-16
Called from file "hack/procs/worker.ml", line 88, characters 14-143
Called from file "hack/procs/worker.ml", line 128, characters 4-37
Raised by primitive operation at file "unix.ml", line 257, characters 7-34
Called from file "hack/utils/marshal_tools.ml", line 145, characters 6-67
Called from file "hack/utils/marshal_tools.ml", line 158, characters 4-63
Called from file "hack/utils/sys/timeout.ml", line 28, characters 12-18
Worker slave 152 exception: Unix.Unix_error(Unix.EPIPE, "write", "")
Worker slave 152 Potential backtrace:
Worker slave 151 exception: Unix.Unix_error(Unix.EPIPE, "write", "")
Worker slave 151 Potential backtrace:
Raised by primitive operation at file "unix.ml", line 257, characters 7-34
Called from file "hack/utils/marshal_tools.ml", line 145, characters 6-67
Called from file "hack/utils/marshal_tools.ml", line 158, characters 4-312
Called from file "hack/utils/measure.ml", line 238, characters 12-16
Called from file "hack/procs/worker.ml", line 88, characters 14-143
Called from file "hack/procs/worker.ml", line 128, characters 4-37
Worker slave 149 exception: Unix.Unix_error(Unix.EPIPE, "write", "")
Worker slave 149 Potential backtrace:
Raised by primitive operation at file "unix.ml", line 257, characters 7-34
Called from file "hack/utils/marshal_tools.ml", line 145, characters 6-67
Called from file "hack/utils/marshal_tools.ml", line 158, characters 4-312
Called from file "hack/utils/measure.ml", line 238, characters 12-16
Called from file "hack/procs/worker.ml", line 88, characters 14-143
Called from file "hack/procs/worker.ml", line 128, characters 4-37
Raised by primitive operation at file "unix.ml", line 257, characters 7-34
Called from file "hack/utils/marshal_tools.ml", line 145, characters 6-67
Called from file "hack/utils/marshal_tools.ml", line 158, characters 4-312
Called from file "hack/utils/measure.ml", line 238, characters 12-16
Called from file "hack/procs/worker.ml", line 88, characters 14-143
Called from file "hack/procs/worker.ml", line 128, characters 4-37
Worker slave 147 exception: Unix.Unix_error(Unix.EPIPE, "write", "")
Worker slave 147 Potential backtrace:
Raised by primitive operation at file "unix.ml", line 257, characters 7-34
Called from file "hack/utils/marshal_tools.ml", line 145, characters 6-67
Called from file "hack/utils/marshal_tools.ml", line 158, characters 4-312
Called from file "hack/utils/measure.ml", line 238, characters 12-16
Called from file "hack/procs/worker.ml", line 88, characters 14-143
Called from file "hack/procs/worker.ml", line 128, characters 4-37
Unix.Unix_error(Unix.EPIPE, "write", "")
Raised by primitive operation at file "unix.ml", line 257, characters 7-34
Called from file "hack/utils/marshal_tools.ml", line 145, characters 6-67
Called from file "hack/utils/marshal_tools.ml", line 158, characters 4-63
Called from file "hack/utils/sys/timeout.ml", line 28, characters 12-18
Unix.Unix_error(Unix.EPIPE, "write", "")
Raised by primitive operation at file "unix.ml", line 257, characters 7-34
Called from file "hack/utils/marshal_tools.ml", line 145, characters 6-67
Called from file "hack/utils/marshal_tools.ml", line 158, characters 4-63
Called from file "hack/utils/sys/timeout.ml", line 28, characters 12-18
Unix.Unix_error(Unix.EPIPE, "write", "")
Raised by primitive operation at file "unix.ml", line 257, characters 7-34
Called from file "hack/utils/marshal_tools.ml", line 145, characters 6-67
Called from file "hack/utils/marshal_tools.ml", line 158, characters 4-63
Called from file "hack/utils/sys/timeout.ml", line 28, characters 12-18
Unix.Unix_error(Unix.EPIPE, "write", "")
Raised by primitive operation at file "unix.ml", line 257, characters 7-34
Called from file "hack/utils/marshal_tools.ml", line 145, characters 6-67
Called from file "hack/utils/marshal_tools.ml", line 158, characters 4-63
Called from file "hack/utils/sys/timeout.ml", line 28, characters 12-18
error Command failed with exit code 110.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Unix.Unix_error(Unix.EPIPE, "write", "")
Raised by primitive operation at file "unix.ml", line 257, characters 7-34
Called from file "hack/utils/marshal_tools.ml", line 145, characters 6-67
Called from file "hack/utils/marshal_tools.ml", line 158, characters 4-63
Called from file "hack/utils/sys/timeout.ml", line 28, characters 12-18
Exited with code 1
jdetle commented 6 years ago

I may be full of it but I think it usually comes from a typo that leads to fatal error parsing flow

MarcelCutts commented 6 years ago

To be clear, it's not consistent for us. Rerunning the workflow on Circle usually does the trick.

travelerspb commented 5 years ago

we have the same issue (v0.84). On CircleCI only, never occurs on local machines

morloy commented 5 years ago

Same here. Never fails on local machines, fails 70% of the time on CircleCI.

psirenny commented 5 years ago

I ran into this issue when another script failed to terminate the flow server once it finished running. In my case, flow-coverage-report was the culprit.

jesstelford commented 5 years ago

For those arriving here via google with CI (particularly CircleCI) failures; add the following:

.flowconfig

[options]
server.max_workers=1

This will stop flow from trying to consume too many virtual CPUs (which CircleCI doesn't actually provide), letting it run to completion without first running out of memory and killing its sub processes.

deterralba commented 5 years ago

Thanks @jesstelford. For circleCI, it also works with server.max_workers=4 and is probably faster.

LeoLeBras commented 5 years ago

In my case, I launched flow during yarn install with CircleCI :

{
  "scripts": {
    "prepublish": "yarn test && yarn build",
    "test": "eslint . && flow && jest --coverage --forceExit"
  },
}

I replaced prepublish with prepublishOnly to fix the problem.

mroch commented 2 years ago

Closing out old issues. This repository is just packaging prebuilt binaries. Please report issues with Flow itself on facebook/flow