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

Prisma client segfault on Ubuntu 22.04 #17223

Closed
vovaklimov opened this issue Jan 10, 2023 · 9 comments · Fixed by #18426
Closed

Prisma client segfault on Ubuntu 22.04 #17223

vovaklimov opened this issue Jan 10, 2023 · 9 comments · Fixed by #18426
Assignees
Labels
bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. kind/bug A reported bug. team/client Issue for team Client. topic: openssl topic: postgresql topic: segmentation fault
Milestone

Comments

@vovaklimov
Copy link

Bug description

I'm trying to perform node 16 to node 18 migration and facing issues with prisma.

Basically any query I'm trying to run on a PostgreSQL DB fails with [1] 139600 segmentation fault error message on my Ubuntu 22.04 environment.

How to reproduce

  1. Get a fresh Ubuntu 22.04 installation (in Docker or inside a VM) with Node v18
  2. Set up a basic Prisma project using npx prisma init command or in any other way, use "postgresql" as a provider
  3. Create any schema (it's shape doesn't matter) and sync it with your database schema
  4. Create a simple script performing any query (for example prisma.model.findMany()) using a prisma client.
  5. Get a segmentation fault error while running the program.

Expected behavior

Queries should run flawlessly and return corresponding results.

Prisma information

generator client {
  provider = "prisma-client-js"
}

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

model User {
  id    String @id @default(uuid())
  email String @unique
  name  String
}
import { PrismaClient } from '@prisma/client';

const client = new PrismaClient();

console.log(await client.user.findMany());

Environment & setup

  • OS: Ubuntu 22.04 (inside WSL2)
  • Database: PostgreSQL (hosted on Supabase)
  • Node.js version: 18.13.0

Prisma Version

prisma                  : 4.8.1
@prisma/client          : 4.8.1
Current platform        : debian-openssl-1.1.x
Query Engine (Node-API) : libquery-engine d6e67a83f971b175a593ccc12e15c4a757f93ffe (at node_modules/@prisma/engines/libquery_engine-debian-openssl-1.1.x.so.node)
Migration Engine        : migration-engine-cli d6e67a83f971b175a593ccc12e15c4a757f93ffe (at node_modules/@prisma/engines/migration-engine-debian-openssl-1.1.x)
Introspection Engine    : introspection-core d6e67a83f971b175a593ccc12e15c4a757f93ffe (at node_modules/@prisma/engines/introspection-engine-debian-openssl-1.1.x)
Format Binary           : prisma-fmt d6e67a83f971b175a593ccc12e15c4a757f93ffe (at node_modules/@prisma/engines/prisma-fmt-debian-openssl-1.1.x)
Format Wasm             : @prisma/prisma-fmt-wasm 4.8.0-61.d6e67a83f971b175a593ccc12e15c4a757f93ffe
Default Engines Hash    : d6e67a83f971b175a593ccc12e15c4a757f93ffe
Studio                  : 0.479.0
@vovaklimov vovaklimov added the kind/bug A reported bug. label Jan 10, 2023
@mcbethio mcbethio added team/client Issue for team Client. bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. topic: postgresql labels Jan 11, 2023
@ROOKA44
Copy link

ROOKA44 commented Jan 15, 2023

same issue

@pitininja
Copy link

Same issue here when deploying our app with NodeJS v18. Got an error: /usr/bin/wrap-command.sh: line 7: 1775 Segmentation fault (core dumped) node index.js. When downgrading to NodeJS v16, it's working fine. Tested with Prisma v4.7.1 / v4.8.0 / v4.8.1 / v4.9.0

@vovaklimov
Copy link
Author

It looks like the issue is caused by OpenSSL versioning issues. Ubuntu 22.04 has OpenSSL 1.1.1s and it causes Prisma to segfault on Node 18. I've tried to reproduce the issue on my Fedora 37 with OpenSSL 3.0.5 and the issue is gone.

So, basically, latest version of Prisma doesn't work properly with LTS version of Node on LTS version of Ubuntu because of OpenSSL 😅

@gtolarc
Copy link

gtolarc commented Feb 7, 2023

same issue with node:lts-bullseye-slim

@do-kevin
Copy link

It looks like the issue is caused by OpenSSL versioning issues. Ubuntu 22.04 has OpenSSL 1.1.1s and it causes Prisma to segfault on Node 18. I've tried to reproduce the issue on my Fedora 37 with OpenSSL 3.0.5 and the issue is gone.

So, basically, latest version of Prisma doesn't work properly with LTS version of Node on LTS version of Ubuntu because of OpenSSL 😅

Thank you. I was on Node 18.9.0. I reverted to Node 16.13.0 and the error was gone and Prisma was working again.

@aqrln
Copy link
Member

aqrln commented Mar 22, 2023

Hi everyone! Could you check if updating prisma and @prisma/client to 4.12.0-integration-rtld-deepbind.3 fixes the issue for you? It would be very helpful to test this on more different systems.

This is an experimental dev version not intended for production but if it works as expected, we'll work on making this land in a stable release. Thank you!

@samielahi
Copy link

Updating both to 4.12.0-integration-rtld-deepbin.3 did the trick for me!

My Setup

  • OS: Ubuntu 22.04
  • Database: PostgreSQL
  • Node.js version: 18.13.0

@nikkhn
Copy link

nikkhn commented Mar 23, 2023

Hi everyone! Could you check if updating prisma and @prisma/client to 4.12.0-integration-rtld-deepbind.3 fixes the issue for you? It would be very helpful to test this on more different systems.

This is an experimental dev version not intended for production but if it works as expected, we'll work on making this land in a stable release. Thank you!

This worked for me as well thank you!!

aqrln added a commit that referenced this issue Apr 14, 2023
@janpio janpio added this to the 4.13.0 milestone Apr 15, 2023
@aqrln
Copy link
Member

aqrln commented Apr 17, 2023

This issue is fixed in Prisma 4.13.0 which will be released tomorrow, on Tuesday, Apr 18. If you need to temporarily use a pre-release version until then, you can use 4.13.0-dev.33.

Note that this GitHub issue is about a specific bug that occurs when using Node.js 17+ on a system with OpenSSL 1.1 on x86-64 CPUs when using TLS to connect to database. Please do not post comments here if you encounter a segfault under different circumstances, and open a new issue instead.

If you are facing segfaults on ARM, please leave a comment in #18510 or open a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. kind/bug A reported bug. team/client Issue for team Client. topic: openssl topic: postgresql topic: segmentation fault
Projects
None yet
Development

Successfully merging a pull request may close this issue.