better-sqlite3: Unofficial fork: help with segmentation fault (core dumped)
This just randomly came up while I was working on tests for #367 (cc @missinglink). All I did was make slight changes to the missinglink:unsafe_mode
branch. I haven’t dug deeper but I assume a segfault is always bad and my changes kind of did a fuzzing? Now the question is: did I unravel an existing bug or can unsafe
actually cause a segfault? Which would be a heckin bold UNSAFE if I’ve ever seen one 😄
Steps to reproduce:
git clone --single-branch --branch segfault git@github.com:Prinzhorn/better-sqlite3.git
cd better-sqlite3
npm install
npm test
integrity checks
Database#prepare()
1) while iterating (allowed)
2) while busy (blocked)
3) while closed (blocked)
Database#exec()
4) while iterating (blocked)
5) while busy (blocked)
6) while closed (blocked)
Database#pragma()
7) while iterating (blocked)
8) while busy (blocked)
9) while closed (blocked)
Database#checkpoint()
10) while iterating (blocked)
11) while busy (blocked)
12) while closed (blocked)
Database#backup()
13) while iterating (allowed)
(node:13917) UnhandledPromiseRejectionWarning: TypeError: The database connection is not open
at Database.backup (/home/alex/Documents/Projects/Bandsalat/forks/better-sqlite3/lib/backup.js:31:33)
(node:13917) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 15)
(node:13917) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
14) while busy (allowed)
(node:13917) UnhandledPromiseRejectionWarning: TypeError: The database connection is not open
at Database.backup (/home/alex/Documents/Projects/Bandsalat/forks/better-sqlite3/lib/backup.js:31:33)
(node:13917) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 17)
15) while closed (blocked)
(node:13917) UnhandledPromiseRejectionWarning: TypeError: The database connection is not open
at Database.backup (/home/alex/Documents/Projects/Bandsalat/forks/better-sqlite3/lib/backup.js:31:33)
(node:13917) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 19)
Database#function()
16) while iterating (blocked)
17) while busy (blocked)
18) while closed (blocked)
Database#aggregate()
19) while iterating (blocked)
20) while busy (blocked)
21) while closed (blocked)
Database#loadExtension()
22) while iterating (blocked)
23) while busy (blocked)
24) while closed (blocked)
Database#close()
Segmentation fault (core dumped)
npm ERR! Test failed. See above for more details.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 21 (9 by maintainers)
I think I’ve caught a cold and I’m lacking big brain energy right now. I’ll get back to you when I can. Maybe you can put some thought into the unsafe-block I’ve suggested above.