microsoft / vscode-node-sqlite3

Asynchronous, non-blocking SQLite3 bindings for Node.js
BSD 3-Clause "New" or "Revised" License
34 stars 12 forks source link

Segfaulting when starting VSCode #45

Open TheDevMinerTV opened 1 week ago

TheDevMinerTV commented 1 week ago

Issue Summary

VSCode SEGFAULTs in @vscode/sqlite3/build/Release/vscode-sqlite3.node.

#0  0x0000000001010101 in ??? ()
#1  0x0000771164cc2dc7 in sqlite3VdbeExec (p=p@entry=0x381c046e4ca0)
    at /usr/src/debug/sqlite/sqlite-src-3460000/sqlite3.c:98848
#2  0x0000771164ccad24 in sqlite3Step (p=<optimized out>) at /usr/src/debug/sqlite/sqlite-src-3460000/sqlite3.c:91222
#3  sqlite3_step (pStmt=<optimized out>) at /usr/src/debug/sqlite/sqlite-src-3460000/sqlite3.c:91283
#4  sqlite3_step (pStmt=<optimized out>) at /usr/src/debug/sqlite/sqlite-src-3460000/sqlite3.c:91272
#5  0x00007711615edec6 in node_sqlite3::Statement::Work_Run(napi_env__*, void*) ()
    at /opt/visual-studio-code/resources/app/node_modules.asar.unpacked/@vscode/sqlite3/build/Release/vscode-sqlite3.node
#6  0x00005ca2a84acb20 in ??? ()
#7  0x0000000000000075 in ??? ()
#8  0x0000000000000000 in ??? ()

Steps to Reproduce

  1. Start VSCode
  2. It closes

Version

not sure

Node.js Version

not sure

How did you install the library?

VSCode 1.90.2-1 on Arch Linux (using the AUR visual-studio-code-bin package)

TheDevMinerTV commented 1 week ago

Looking at the sqlite3.c path, I downloaded the sqlite3.c version from their website. Surrounding code:

  /* Invoke the update-hook if required. */
  if( rc ) goto abort_due_to_error;
  if( pTab ){
    assert( db->xUpdateCallback!=0 );
    assert( pTab->aCol!=0 );
    db->xUpdateCallback(db->pUpdateArg,
           (pOp->p5 & OPFLAG_ISUPDATE) ? SQLITE_UPDATE : SQLITE_INSERT,
           zDb, pTab->zName, x.nKey);                                   // :98848
  }
  break;

After checking with gdb, I see that db->pUpdateArg is never set and sqlite3_update_hook is never getting called which would've set that.

Looking at this module's code, sqlite3_update_hook is only used in Database::RegisterUpdateCallback(Baton*), which is only used in Database::Configure().