prisma icon indicating copy to clipboard operation
prisma copied to clipboard

MySQL: PANIC: Expected parent IDs to be set when ordering by parent ID. in query-engine/core/src/interpreter/query_interpreters/inmemory_record_processor.rs:71:18

Open efhan-the-unorthodox opened this issue 3 years ago • 3 comments

Background

So basically my application runs within a Docker Container and my hunch is that the problem comes from the Session Store Manager that "hooks" onto using Prisma as the session store. The link to it is here: https://www.npmjs.com/package/@quixo3/prisma-session-store. So when I checked the logs and I got this error. This is all I can report.

Hi Prisma Team! My Prisma Client just crashed. This is the report:

Versions

Name Version
Node v17.8.0
OS linux-musl
Prisma Client 3.13.0
Query Engine 0.1.0
Database mysql

Logs

sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true

efhan-the-unorthodox avatar Jun 14 '22 13:06 efhan-the-unorthodox

Hi @efhan-the-unorthodox, can you share the schema and query you were running that triggered this panic?

matthewmueller avatar Jun 14 '22 19:06 matthewmueller

Hi @efhan-the-unorthodox, can you share the schema and query you were running that triggered this panic?

Err... This will be a bit tricky. So this error from the log itself points towards a session store library that utilizes Prisma for session storage. I cannot seem to find the query that triggers the panic because it's simply called by the library itself and I cannot derive the query. However, the following is the schema that is used for the Session Store.

model Session {
  id        String   @id
  sid       String   @unique
  data      String
  expiresAt   DateTime
}

More or less, I think at this point, I have just realized that this should be a problem with the Session Store Library rather than a problem with Prisma itself. Unless miraculously or coincidentally someone has a similar problem using this library, I think this issue can't really be solved so I more or less would have to find an alternative session store library.

efhan-the-unorthodox avatar Jun 16 '22 11:06 efhan-the-unorthodox

From the error message we now understand, that this is probably a faulty JOIN where the database returns values that itself would happily use to JOIN, but as we are joining some of the things in memory - we can not find the opposite side for the JOIN and hence throw this error message. Common examples are leading or trailing spaces, differences in capiTALIZation on string Ids and similar. Does anything like that ring a bell for you @efhan-the-unorthodox?

janpio avatar Sep 19 '22 23:09 janpio

Closing this as it appears to not be related to prisma per-se. Please @efhan-the-unorthodox comment below if you have more data that makes you think that indeed there's a problem with prisma and not with the queries you are making yourself, as suggested by @janpio https://github.com/prisma/prisma/issues/13812#issuecomment-1251670555 and we will reopen!

miguelff avatar Jul 17 '23 17:07 miguelff