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

Segmentation Fault when running migrations in Debian based node container & Sqlite3 #5809

Open
1mike12 opened this issue Feb 27, 2024 · 2 comments

Comments

@1mike12
Copy link

1mike12 commented Feb 27, 2024

Environment

Knex version:
Database + version: sqlite3 3.40.1 2022-12-28 14:03:47
OS: Debian node:20 image

Bug

  1. Explain what kind of behaviour you are getting and how you think it should do

I have a typical knexfile with a sqlite database that works fine when developing locally on macos.

in the container, I base my docker image off the official node:20 image. I verify that sqlite3 works, I can go into the REPL and create tables, do soe dummy insertions etc..

But as soon as I try to run npx knex migrate:latest or rollback commands it gives me a segfault. I was able to capture this finally with this code in knexfile.ts. I didn't think it could be a knex issue and maybe it was sqlite3, but seeing as I can

import SegFaultHandler from 'segfault-handler';
SegFaultHandler.registerHandler('crash.log');
  1. Error message
# yarn migrate
yarn run v1.22.19
$ npx knex migrate:latest
Requiring external module ts-node/register
Using Spatialite extension at: mod_spatialite
Spatialite extension loaded
PID 107 received SIGSEGV for address: 0x88
/code/node_modules/segfault-handler/build/Release/segfault-handler.node(+0x31e8)[0x7f45d06c31e8]
/lib/x86_64-linux-gnu/libc.so.6(+0x3c050)[0x7f45d278a050]
/lib/x86_64-linux-gnu/libsqlite3.so.0(sqlite3VtabUnlockList+0x23)[0x7f45a8c36303]
/lib/x86_64-linux-gnu/libsqlite3.so.0(+0xbcae0)[0x7f45a8bdaae0]
/lib/x86_64-linux-gnu/libsqlite3.so.0(+0xbd801)[0x7f45a8bdb801]
/lib/x86_64-linux-gnu/libsqlite3.so.0(sqlite3_prepare_v2+0x16)[0x7f45a8bdbc36]
/code/node_modules/sqlite3/build/Release/node_sqlite3.node(_ZN12node_sqlite39Statement12Work_PrepareEP10napi_env__Pv+0x69)[0x7f45d0302689]
/usr/local/bin/node(_ZZN4node14ThreadPoolWork12ScheduleWorkEvENUlP9uv_work_sE_4_FUNES2_+0x59)[0xc67dc9]
/usr/local/bin/node[0x1886e10]
/lib/x86_64-linux-gnu/libc.so.6(+0x89134)[0x7f45d27d7134]
/lib/x86_64-linux-gnu/libc.so.6(__clone+0x40)[0x7f45d2856a40]
Segmentation fault
error Command failed with exit code 139.
  1. Reduced test code, for example in https://npm.runkit.com/knex or if it needs real
    database connection to MySQL or PostgreSQL, then single file example which initializes
    needed data and demonstrates the problem.

I can create a example container if there is traction, just waiting to see if anyone has any insight before commiting the time to do that

@1mike12 1mike12 changed the title Segmentation Fault when running migrations in Debian based node container Segmentation Fault when running migrations in Debian based node container & Sqlite3 Feb 27, 2024
@rluvaton
Copy link
Member

Can you run the same commands with the sqlite client without Knex? It seems like it's not Knex issue from the stack trace

@wajeht
Copy link

wajeht commented Mar 23, 2024

add a .dockerignore to node_modules and rerun it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants