eslint-plugin-flowtype-errors keeps spawning and killing flow processes

Running into this problem, you may notice one of two possible symptoms when running lint: either numerous flow processes are spawned and killed constantly, or the lint fails with the below error.

Flow returned an error: Out of retries, exiting! (code: 7)

To debug the issue you may run flow check by itself, but the same problem appears: the server is spawned, then killed and respawn over and over again.

Underneath the hood, the problem is simple: flow runs out of memory for its dependency hash table. It doesn’t output an error message about this though, unless you rebuild the library for debugging yourself.

To fix the issue, raise sharedmemory.hash_table_pow. By default it’s set to 19, which somehow magically works out to 8MB according to the docs.

The docs say the hash table size is set to 16*2^(sharedmemory.hash_table_pow) bytes, so setting it to 22 for example ends up with about 67MB of space. Why this is capped to begin with is a mystery for the ages.

The below .flowconfig worked for my use case, you may need more welly if your project is huge:

[options]
server.max_workers=1
sharedmemory.hash_table_pow=22