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

[BUG] Library crashes with segfault when opening database connection #410

Open
natefabian18 opened this issue Nov 14, 2024 · 0 comments
Open

Comments

@natefabian18
Copy link

natefabian18 commented Nov 14, 2024

Describe your system

  • odbc Package Version: 2.4.9
  • ODBC Driver: msodbcsql17
  • Database Name: master
  • Database Version: Microsoft SQL Server 2022 (RTM-CU15-GDR) (KB5046862) - 16.0.4155.4 (X64) Oct 18 2024 16:16:11 Copyright (C) 2022 Microsoft Corporation Developer Edition (64-bit) on Linux (Ubuntu 22.04.5 LTS)
  • Database OS: Linux (Docker)
  • Node.js Version: 20
  • Node.js OS: Linux (Docker)

Describe the bug
ODBC Library crashes with segfault when opening database connection

Expected behavior
The database is opened and queries can be executed

To Reproduce
Reproduction available in this repositories docker compose, See project readme. Namely running the willCrash.js with node

Code
If applicable, add snippets of code to show:

  • The offending code:
const odbc = require("odbc");
require('dotenv').config()

async function connectToDatabase() {
	let database = process.env.DB || 'db'
	let password = process.env.PASS || 'DATABASE_PASSWORD1!'
	let connString = `Driver={ODBC Driver 17 for SQL Server};Server=${database};Database=master;Uid=sa;Pwd=${password};`;
	console.log(`Connecting with connString: ${connString}`);
	const connection = await odbc.connect(connString);
	const result = await connection.query("select * from INFORMATION_SCHEMA.COLUMNS");
	console.log(result);
}

connectToDatabase().catch((e) => console.log(e));
  • Any DEBUG information printed to the terminal:
    (Segfault)

GDB Debug output

Starting program: /usr/local/bin/node willCrash.js
warning: Error disabling address space randomization: Operation not permitted
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7f3d61bda6c0 (LWP 61)]
[New Thread 0x7f3d613d96c0 (LWP 62)]
[New Thread 0x7f3d60bd86c0 (LWP 63)]
[New Thread 0x7f3d5bfff6c0 (LWP 64)]
[New Thread 0x7f3d5b7fe6c0 (LWP 65)]
[New Thread 0x7f3d603366c0 (LWP 66)]
Connecting with connString: Driver={ODBC Driver 17 for SQL Server};Server=db;Database=master;Uid=sa;Pwd=DATABASE_PASSWORD1!;
[New Thread 0x7f3d3afbf6c0 (LWP 67)]
[New Thread 0x7f3d3a7be6c0 (LWP 68)]
[New Thread 0x7f3d39fbd6c0 (LWP 69)]
[New Thread 0x7f3d397bc6c0 (LWP 70)]

Thread 8 "node" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7f3d3afbf6c0 (LWP 67)]
0x0000000001a9141a in SSL_SESSION_free ()
  • Any error information returned from a function call:

Additional context
Add any other context about the problem here.

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

1 participant