Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: spawn E2BIG #254

Closed
witt3rd opened this issue Jul 26, 2019 · 32 comments · Fixed by #907
Closed

Error: spawn E2BIG #254

witt3rd opened this issue Jul 26, 2019 · 32 comments · Fixed by #907
Assignees
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug.
Milestone

Comments

@witt3rd
Copy link

witt3rd commented Jul 26, 2019

Trying to run prisma2 generate (preview-3) on an 18MB model file results in Error: spawn E2BIG

@timsuchanek timsuchanek self-assigned this Jul 28, 2019
@timsuchanek timsuchanek added bug/2-confirmed Bug has been reproduced and confirmed. priority/low labels Jul 28, 2019
@schickling
Copy link
Member

Thanks a lot for reporting this issue. It seems pretty rare to have a schema file that’s larger than a mega byte. Would you mind elaborating on your use case @witt3rd?

@witt3rd
Copy link
Author

witt3rd commented Jul 29, 2019

I am trying to create a GraphQL wrapper for an industry standard database: https://github.com/rbhughes/pg_ppdm

@jmadson
Copy link

jmadson commented Jul 29, 2019

I'm receiving the same error message. We have 400+ Postgres tables. I was following the tutorial:

  • ran prisma2 init, which generated the schema.prisma file based on those tables. The file size is only 268 KB.
  • Attempted to run prisma2 generate to generate the photon client

Received error message:

Error: spawn E2BIG

@schickling
Copy link
Member

Thanks a lot for providing this additional information. We'll be looking into it!

@thortek
Copy link

thortek commented Aug 1, 2019

I'm now receiving the same Error: spawn E2BIG. I attempted to execute prisma2 generate running on Ubuntu 18.04.2 with Postgres 11 in Docker on Digital Ocean. I've only got 102 tables created and a 158kb project.prisma file causing this. This same build process has worked just fine on my local iMac.

@thortek
Copy link

thortek commented Aug 2, 2019

BTW, with the exact same setup I described yesterday except that I updated to preview5, I get the following more detailed error:

Error: Error: Command failed with exit code 7 (E2BIG): /usr/local/lib/node_modules/prisma2/query-engine-linux-glibc-libssl1.1.0 cli --dmmf
spawn E2BIG

@timsuchanek timsuchanek added the kind/bug A reported bug. label Aug 8, 2019
@janpio janpio added this to the Preview 6 milestone Aug 9, 2019
@janpio janpio removed the candidate label Aug 9, 2019
@janpio janpio removed this from the Preview 6 milestone Aug 9, 2019
@timsuchanek
Copy link
Contributor

timsuchanek commented Aug 15, 2019

In the next sprint we will investigate, which concrete bugs are happening.

@janpio janpio assigned divyenduz and unassigned timsuchanek Aug 15, 2019
@janpio janpio added this to the Preview 8 milestone Aug 15, 2019
@janpio janpio removed the candidate label Aug 15, 2019
@thortek
Copy link

thortek commented Aug 16, 2019

I have a sample reproduction here to hopefully help track this down: https://github.com/thortek/prisma2-issue254-reproduction

@divyenduz
Copy link
Contributor

divyenduz commented Aug 21, 2019

I am able to reproduce @thortek's reproduction, the schema.prisma file is 156K

More specifically, the issue happens when running prisma2 generate command, maybe when it tries to spawn query engine binary to get the dmmf. Photon is never generated.

Interestingly, when I tried reproducing this independently with a large schema, I got a different error: SIGABRT as the CLI process went out of heap memory and increasing that via max-old-space-size worked locally till a limit (see below)

node --max-old-space-size=8192 /<path-to>/prisma2/dist/bin.js generate
Models Reproduction Error Fix
1000 https://github.com/divyendu-test/p2-254 SIGABRT max-old-space-size (local CLI)
10000 https://github.com/divyendu-test/p2-254/tree/10k E2BIG --

The max-old-space-size fix works till ~2000 models.

These results might vary across OS/datamodel (I am using similar n models).

Related: https://unix.stackexchange.com/questions/120642/what-defines-the-maximum-size-for-a-command-single-argument

More info: It fails at this function getCompiledGenerators, possible at getRawDMMF. I stop my investigation here.

@Manouli
Copy link

Manouli commented Oct 24, 2019

Tried to use this on our existing DB and unfortunately it won't work. Hopefully we can get it soon.

@farukg
Copy link

farukg commented Nov 1, 2019

Hi,
I have the same Issue. I had it also with prisma1. I tried again today and unfornutaly it still doesnt work.
prisma2 says 61 tables, 2.58 MB Thats not much, right?
I think --max-old-space-size is not the correct direction to investigate, besides that it doesnt work in my case, i tried lowering it, just to see what happens to 1. If you do that, you get a real FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

image

With values above some threshold ~70MB i get a lot of json output of the schema:
First few lines:
image
and the last lines:
image

i tried values between 500 - 12000 it always raises E2BIG Error. :(
its also the same when going via prisma2 init instead of the the introspect command.
Last time i had this issue couple of month ago, i googled a lot, and found almost nothing...i remember it was something about node's threading lib... child.process or fork of new Thread or so....maybe you know more about this

Hope i could help

i think this is related: https://unix.stackexchange.com/questions/120642/what-defines-the-maximum-size-for-a-command-single-argument

output of postgres:
unexpected EOF on client connection with an open transaction
image

@Manouli
Copy link

Manouli commented Nov 7, 2019

@timsuchanek Did this get fixed? I ll retest this :)

@timsuchanek
Copy link
Contributor

@Manouli it'll take still a bit until it's out, the CI pipeline is stuck. I'll ping you once it's out!

@timsuchanek timsuchanek reopened this Nov 7, 2019
@timsuchanek
Copy link
Contributor

We have a new alpha out, which already fixes it for schemas of the size of 1000 models. It seems like schemas with 10000 models are not yet working. We'll investigate and do a fix soon!

@Manouli
Copy link

Manouli commented Nov 7, 2019

@timsuchanek that should more than enough for me :) Thank you so much

@williamluke4
Copy link
Contributor

2.0.0-preview016 fixed this error for me

jednano added a commit to jednano/prisma2 that referenced this issue Nov 8, 2019
jednano added a commit to jednano/prisma2 that referenced this issue Nov 8, 2019
jednano added a commit to jednano/prisma2 that referenced this issue Nov 8, 2019
@jednano jednano mentioned this issue Nov 8, 2019
timsuchanek pushed a commit that referenced this issue Nov 11, 2019
@timsuchanek timsuchanek reopened this Nov 11, 2019
@timsuchanek
Copy link
Contributor

Update: In https://github.com/prisma/prisma2/releases/tag/2.0.0-preview016.2 we pushed the limits a bit further again - a schema with 3000 models is now working.
The next (and last) big leap to get to even bigger schemas is an optimization to the Photon generator code.

@Manouli
Copy link

Manouli commented Nov 14, 2019

@timsuchanek I can confirm that its working for me now. Thank you so much for dealing with this.

@janpio janpio closed this as completed Nov 21, 2019
timsuchanek added a commit that referenced this issue Apr 14, 2020
Former-commit-id: dcda90c
timsuchanek added a commit that referenced this issue Apr 14, 2020
Former-commit-id: dcda90c
Former-commit-id: 9679185
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.