Skip to content

invalid startup packet layout: expected terminator as last byte #63

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

Closed
shaneiseminger opened this issue Oct 30, 2011 · 5 comments
Closed

Comments

@shaneiseminger
Copy link

I just upgraded to node 0.5.10 and started getting "invalid startup packet layout: expected terminator as last byte" when connecting (connection then fails). I'm not entirely sure if this is a node-postgres issue, but it seems to be the most likely source of the problem. Things were working fine until the upgrade.

Additional detail: I'm use node-orm on top of node-postgres, though I don't believe there's any issue there.

@shaneiseminger
Copy link
Author

I don't know if it helps but here is the value of the buffer.toString(), inserted after line 69-72 of connection.js:

9usern[username]databaseQ[database]@

@defunctzombie
Copy link
Contributor

I too get this error. It seems that something changed between 0.5.10+ and 0.5.8 to cause this behavior. I am not using any orm and just using the library directly. The final buffer seems to be corrupted and thus the correct bytes are not sent over the wire (confirmed with tcp dump).

0.5.8 wire transmission:
0000 0029 0003 0000 7573 6572 .......)....user
0070 6f73 7467 7265 7300 6461 7461 6261 .postgres.databa
7365 0062 6974 666c 6f6f 7200 00

0.5.10+ transmission:
0000 0029 0003 0000 7573 6572 ...-...)....user
7f70 6f73 7467 7265 7300 6461 7461 6261 .postgres.databa
7365 0062 6974 666c 6f6f 7272 00

You can see that on row 2, byte 1 there is 0x7f when it should be 0x00.

@brianc
Copy link
Owner

brianc commented Oct 30, 2011

null terminated buffers being written differently:

nodejs/node-v0.x-archive@6a72e52

I'll have this fixed within 24 hours. If you wanna try submitting a patch the culprit is within the /lib/writer.js class. Should be a 1 line fix.

@shaneiseminger
Copy link
Author

Thanks! This patch works for me.

@brianc brianc closed this as completed in 46f6d90 Oct 31, 2011
@pvencill
Copy link

I'm still getting this exact issue on Ubuntu 10.10 w/ Postgres 9.1, running node 0.6.6

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

4 participants