]> granicus.if.org Git - pgbouncer/commitdiff
Fix wait time computation with auth_user
authorPeter Eisentraut <peter@eisentraut.org>
Wed, 31 Jul 2019 11:51:44 +0000 (13:51 +0200)
committerPeter Eisentraut <peter@eisentraut.org>
Wed, 31 Jul 2019 11:51:44 +0000 (13:51 +0200)
When using auth_user, the transition to the CL_WAITING_LOGIN state
would not initialize the client->wait_start field.  This would either
lead to garbage values being recorded, or under assertions enabled it
would crash in activate_client().

(test_auth_user was actually reproducing this problem, but a crash
requires assertions enabled and new memory being all zero, so it was
difficult to catch it.)

Author: @pinaraf

see #393

src/objects.c

index 0c589b6f521c1b1553b04ee89a32935ef0c3bcc6..9750c5f13e13e4537026de71f799b562a792654a 100644 (file)
@@ -186,9 +186,8 @@ void change_client_state(PgSocket *client, SocketState newstate)
                statlist_append(&login_client_list, &client->head);
                break;
        case CL_WAITING:
-               client->wait_start = get_cached_time();
-               /* fallthrough */
        case CL_WAITING_LOGIN:
+               client->wait_start = get_cached_time();
                statlist_append(&pool->waiting_client_list, &client->head);
                break;
        case CL_ACTIVE: