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

bun error: Partially Length-prefixed Bytes unmatched lengths; error not present when using node #14243

Closed
tkurze opened this issue Sep 29, 2024 · 3 comments
Assignees
Labels
bug Something isn't working node:net

Comments

@tkurze
Copy link

tkurze commented Sep 29, 2024

What version of Bun is running?

1.1.29+6d43b3662

What platform is your computer?

Darwin 24.0.0 arm64 arm

What steps can reproduce the bug?

Start a new project, add mssql as dependency and query a (big enough) table; like so: SELECT * from .

const pool = await sql.connect(sqlConfig)
const query = `SELECT * from ${process.env.MSSQL_TABLE}`
const result = await pool.query(query)
console.log(result.recordset.length)

If the table has enough content (in my case only about a 1000 rows) I always encounter the following problem. The problem does not occur when using node.

error: Partially Length-prefixed Bytes unmatched lengths : expected 30, but got 352 bytes
at [...]/node_modules/tedious/lib/value-parser.js:659:17
at readPLPStream ([...]/node_modules/tedious/lib/value-parser.js:750:23)
at [...]/node_modules/tedious/lib/token/row-token-parser.js:12:348
654 | parser.position += chunkLength;
655 | currentLength += chunkLength;
656 | }
657 | if (expectedLength !== UNKNOWN_PLP_LEN) {
658 | if (currentLength !== Number(expectedLength)) {
659 | throw new Error('Partially Length-prefixed Bytes unmatched lengths : expected ' + expectedLength + ', but got ' + currentLength + ' bytes');
^
error: Partially Length-prefixed Bytes unmatched lengths : expected 836, but got 161 bytes
at [...]/node_modules/tedious/lib/value-parser.js:659:17
at readPLPStream ([...]/node_modules/tedious/lib/value-parser.js:750:23)
at [...]/node_modules/tedious/lib/token/row-token-parser.js:12:348

What is the expected behavior?

No error should occur.

What do you see instead?

An error message: error: Partially Length-prefixed Bytes unmatched lengths : expected 836, but got 161 bytes

Additional information

Node version: v22.9.0

@tkurze tkurze added bug Something isn't working needs triage labels Sep 29, 2024
@ptrxyz
Copy link

ptrxyz commented Sep 30, 2024

I also ran into this. There is no way to determine if this error happens so it makes it pretty much impossible to use MS SQL with bun. :/
Considering that this is a problem with reading streams over the net, could this also be related to #14249?

@robskl
Copy link

robskl commented Oct 21, 2024

I also ran into this. The most annoying part is that once this error happens it crashes server instance. Looks like I have made quite of a mistake by swapping out underlying runtime without evaluating its compatibility with MS SQL. 🙈

@cirospaciari
Copy link
Member

This is fixed on v1.1.34 if you still run on this issue feel free to reopen with another repro

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working node:net
Projects
None yet
Development

No branches or pull requests

5 participants