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

Fail test test_misc.py::test_options_startup_param on ubuntu-24.04 #1056

Closed
kav23alex opened this issue Apr 27, 2024 · 1 comment · Fixed by #1058
Closed

Fail test test_misc.py::test_options_startup_param on ubuntu-24.04 #1056

kav23alex opened this issue Apr 27, 2024 · 1 comment · Fixed by #1058

Comments

@kav23alex
Copy link

When running tests on ubuntu-24.04, sometimes the test_misc.py::test_options_startup_param test fails with the error "FATAL: client sent partial pkt in startup phase"
reproduce:

a=`printf 'a%.0s' {1..1000}`; \
for i in `seq 100`; do \
echo "iter $i"; \
sudo -u postgres psql -d "host=127.0.0.1 port=15432 client_encoding=UTF8 connect_timeout=10 dbname=postgres options='-c timezone=test'" -c "select 1" &> /dev/null;  \
sudo -u postgres psql -d "host=127.0.0.1 port=15432 client_encoding=UTF8 connect_timeout=10 dbname=postgres options='-c timezone=$a'" &> /tmp/logmsg; \
grep "partial pkt" /tmp/logmsg && { echo "FOUND"; break; }; \
sleep 0.1; \
done

If you increase tcp_socket_buffer from 4096 to 8192, the error is not reproduced.

bouncer.ini

[databases]
postgres = port=5432 host=127.0.0.1 dbname=postgres user=postgres pool_size=2

[pgbouncer]
logfile = test.log
pidfile = test.pid

listen_addr = 127.0.0.1
listen_port = 15432
unix_socket_dir = /tmp

auth_type = trust
auth_file = userlist.txt
pool_mode = statement

; use a small tcp_socket_buffer so that we trigger EAGAIN more often in tests.
; Otherwise bugs caused by EAGAIN are hard to debug.
tcp_socket_buffer = 4096

JelteF added a commit to JelteF/pgbouncer that referenced this issue Apr 29, 2024
We were bailing out from a connection if we did not receive the full
startup packet in one go, or if it didn't fit in pkt_buf. This fixes
these issues by reusing the packet buffering logic that was introduced
for prepared statement support for our startup packet parsing.

Fixes pgbouncer#1056
@JelteF
Copy link
Member

JelteF commented Apr 29, 2024

I created a fix for this in #1058 could you try that out and confirm that it indeed fixes your reproducing case too.

JelteF added a commit that referenced this issue May 2, 2024
We were bailing out from a connection if we did not receive the full
startup packet in one go, or if it didn't fit in pkt_buf. This fixes
these issues by reusing the packet buffering logic that was introduced
for prepared statement support for our startup packet parsing.

Fixes #1056
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

Successfully merging a pull request may close this issue.

2 participants