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

pgbouncer appears to lose sync when parameter is set in transaction mode #52

Closed
roji opened this issue May 24, 2015 · 7 comments
Closed
Labels
bug something is broken fixed

Comments

@roji
Copy link

roji commented May 24, 2015

I'm working on the .NET driver for PostgreSQL, Npgsql, and I think I've come across an issue.

During my tests, I set pgbouncer in transaction mode, and sent a packet containing a SET statement_timeout=30000 simple query message, followed by a regular extended protocol query: this seemed to make pgbouncer "lose sync" in some way. I know SET isn't supported in transaction mode, but I'd have expected a clear error rather than the strange behavior below:

Messages sent (as in wireshark): Q/P/D/B/E/S (the first Q is the SET)
Messages received: C/Z

pgbouncer logs:

2015-05-24 11:58:13.192 24481 WARNING S-0x8a677a0: npgsql_tests/npgsql_tests@127.0.0.1:5432 got packet 'S' from server when not linked
2015-05-24 11:58:13.192 24481 WARNING S-0x8a677a0: npgsql_tests/npgsql_tests@127.0.0.1:5432 got packet 'S' from server when not linked
2015-05-24 11:58:13.192 24481 WARNING S-0x8a677a0: npgsql_tests/npgsql_tests@127.0.0.1:5432 got packet 'C' from server when not linked
2015-05-24 11:58:13.192 24481 WARNING S-0x8a677a0: npgsql_tests/npgsql_tests@127.0.0.1:5432 got packet 'Z' from server when not linked

pgbouncer 1.5.4 on Ubuntu utopic, PostgreSQL 9.3. Let me know if there's any other info that can help.

@markokr
Copy link
Contributor

markokr commented Jul 31, 2015

Losing the setting by getting differerent server connection should be normal. But not losing protocol sync.

Could you send pgbouncer -v -v -v log about that query exchange?

@roji
Copy link
Author

roji commented Aug 3, 2015

Here you go: https://gist.github.com/roji/4f3205c2e8ffcdd786fb

My repro simply connects, sends a Q with set statement_timeout=30000, sends a trivial P/D/B/E/S sequence and closes the connection. Then it tries to connect again and sends another trivial P/D/B/E/S and the error occurs.

I can reproduce this really easily here, let me know if you need any more info.

@markokr markokr added bug something is broken and removed moreinfo labels Aug 6, 2015
@markokr
Copy link
Contributor

markokr commented Aug 6, 2015

problem seems to be that client sent stream of several sync commands (Q and S) to server and pgbouncer switches server after the first.

need to think how to solve it. keep a counter?

@markokr
Copy link
Contributor

markokr commented Aug 6, 2015

Counter should solve bind-sync-exec problem in #44 too?

@PJMODOS
Copy link
Contributor

PJMODOS commented Aug 6, 2015

yeah I think counter would help with #44 as well

markokr added a commit to markokr/pgbouncer-dev that referenced this issue Aug 8, 2015
This avoids releasing server too early.

Should fix pgbouncer#44 and pgbouncer#52.
@markokr
Copy link
Contributor

markokr commented Aug 8, 2015

Pushed experimental patch to master, please test if it solves the issue.

@markokr markokr added the fixed label Aug 8, 2015
@roji
Copy link
Author

roji commented Aug 19, 2015

Confirmed, using the latest master the problem doesn't occur, thanks!

@roji roji closed this as completed Aug 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something is broken fixed
Projects
None yet
Development

No branches or pull requests

3 participants