Started http server
chrissisura opened this issue · comments
Hi Prisma Team! My Prisma Client just crashed. This is the report:
Versions
Name | Version |
---|---|
Node | v14.1.0 |
OS | darwin |
Prisma Client | 2.9.0 |
Description
signalCode: undefined | exitCode: undefined | killed: undefined
SocketError: other side closed
at Socket.Rc (/Users/chrissisura/GitHub/magpie/node_modules/@prisma/node_modules/.pnpm/undici@2.0.7/node_modules/undici/lib/core/client.js:686:22)
at Socket.emit (events.js:327:22)
at endReadableNT (_stream_readable.js:1223:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
Exit code: undefined
Started http server
Logs
prisma-client {
prisma-client engineConfig: {
prisma-client cwd: '/Users/chrissisura/GitHub/magpie/prisma',
prisma-client enableDebugLogs: false,
prisma-client enableEngineDebugMode: undefined,
prisma-client datamodelPath: '/Users/chrissisura/GitHub/magpie/node_modules/.prisma/client/schema.prisma',
prisma-client prismaPath: undefined,
prisma-client engineEndpoint: undefined,
prisma-client generator: {
prisma-client name: 'client',
prisma-client provider: 'prisma-client-js',
prisma-client output: '/Users/chrissisura/GitHub/magpie/node_modules/@prisma/client',
prisma-client binaryTargets: [],
prisma-client previewFeatures: [Array],
prisma-client config: {}
prisma-client },
prisma-client showColors: false,
prisma-client logLevel: undefined,
prisma-client logQueries: undefined,
prisma-client flags: [],
prisma-client clientVersion: '2.9.0',
prisma-client enableExperimental: [ 'connectOrCreate' ],
prisma-client useUds: undefined
prisma-client }
prisma-client }
plusX Execution permissions of /Users/chrissisura/GitHub/magpie/node_modules/.prisma/client/query-engine-darwin are fine
plusX Execution permissions of /Users/chrissisura/GitHub/magpie/node_modules/.prisma/client/query-engine-darwin are fine
plusX Execution permissions of /Users/chrissisura/GitHub/magpie/node_modules/.prisma/client/query-engine-darwin are fine
plusX Execution permissions of /Users/chrissisura/GitHub/magpie/node_modules/.prisma/client/query-engine-darwin are fine
plusX Execution permissions of /Users/chrissisura/GitHub/magpie/node_modules/.prisma/client/query-engine-darwin are fine
plusX Execution permissions of /Users/chrissisura/GitHub/magpie/node_modules/.prisma/client/query-engine-darwin are fine
plusX Execution permissions of /Users/chrissisura/GitHub/magpie/node_modules/.prisma/client/query-engine-darwin are fine
plusX Execution permissions of /Users/chrissisura/GitHub/magpie/node_modules/.prisma/client/query-engine-darwin are fine
plusX Execution permissions of /Users/chrissisura/GitHub/magpie/node_modules/.prisma/client/query-engine-darwin are fine
plusX Execution permissions of /Users/chrissisura/GitHub/magpie/node_modules/.prisma/client/query-engine-darwin are fine
plusX Execution permissions of /Users/chrissisura/GitHub/magpie/node_modules/.prisma/client/query-engine-darwin are fine
plusX Execution permissions of /Users/chrissisura/GitHub/magpie/node_modules/.prisma/client/query-engine-darwin are fine
plusX Execution permissions of /Users/chrissisura/GitHub/magpie/node_modules/.prisma/client/query-engine-darwin are fine
plusX Execution permissions of /Users/chrissisura/GitHub/magpie/node_modules/.prisma/client/query-engine-darwin are fine
plusX Execution permissions of /Users/chrissisura/GitHub/magpie/node_modules/.prisma/client/query-engine-darwin are fine
plusX Execution permissions of /Users/chrissisura/GitHub/magpie/node_modules/.prisma/client/query-engine-darwin are fine
plusX Execution permissions of /Users/chrissisura/GitHub/magpie/node_modules/.prisma/client/query-engine-darwin are fine
plusX Execution permissions of /Users/chrissisura/GitHub/magpie/node_modules/.prisma/client/query-engine-darwin are fine
I believe this has something to do with my async loop invoking child processes, in which before prisma 2.9 it threw an error message with a can read signalCode of undefined, but now with this update https://github.com/prisma/prisma/pull/3751/commits it ran infinitely if I don't call $disconnect the client. But now it sometimes work and sometimes don't.
Maybe this crashes because multiple Tables want to connect its objects to one table at the same time.
Hey @chrissisura
Do you have a reliable reproduction for this which you can share? That would be very helpful here.
Unfortunately reproducibility is hard, because it only happened every 10th time when I ran the function. But at least I managed to fix it (see lower version). The top version is NOT the one who created the crash of the http server, BUT it for some reason created to many objects in the database without throwing errors. At the time I wasn't aware that await in an forEach does not work as intended, but even when I tried to make it synchronous, I often had created a infinite running function. (for example when removing the prisma.$disconnect) I read online that prisma may create forked processes, when ran in parallel. Do you think the problem might be concurrent calling of the same database objects causing it to crash? Also when I have a debugger breakpoint on prisma.$disconnect the data written to the basebase is correct. (I assume because it is only writing one at a time then) Thanks for your time! Best regards
Inconsistent version:
documentSubSections.forEach((documentSubSection) => {
documentSubSection.Document.forEach(async (document) => {
await createApprovalProcessFunction(
SOMEPARAMETERS,
prisma,
).catch(e => console.log(e))
prisma.$disconnect()
})
})
}
Fixed Version:
let approvalProcessPromises: Promise<ApprovalProcess>[] = []
documentSubSections.forEach(async (documentSubSection) => {
documentSubSection.Document.forEach(async (document) => {
approvalProcessPromises.push(
createApprovalProcessFunction(SOMEPARAMETERS, prisma)
)
})
})
return approvalProcessPromises
})
Closing due to inactivity, please comment here if this still an issue in the latest version