pg.ddx.io  GitHub: postgresql-interfaces/psqlodbc (issues + PRs as email threads)  
help / color / mirror / Atom feed
From: davecramer (@davecramer) <noreply+davecramer@github.com>
To: postgresql-interfaces/psqlodbc <noreply+postgresql-interfaces-psqlodbc@github.com>
Subject: Re: [postgresql-interfaces/psqlodbc] issue #224: psqlODBC driver or MS System.Data.Odbc do not report connection lost
Date: Thu, 05 Nov 2026 16:55:12 +0000
Message-ID: <gh-postgresql-interfaces-psqlodbc-224-c6663924267@github.com> (raw)
In-Reply-To: <gh-postgresql-interfaces-psqlodbc-224@github.com>
References: <gh-postgresql-interfaces-psqlodbc-224@github.com>

Hi Sergey,

Thanks for the logs and the answers. Unfortunately the logs don't cover the failure:

- `mylog_EchoLoader_10820.log` ends after 41 lines, while the driver is still reading the connection string. The file was last written at 16:57, and the failure in your server log is at 17:03:30, so it's from an earlier run.
- `mylog_odbcad32_28136.log` and `psqlodbc_odbcad32_28136.log` come from the ODBC Data Source Administrator (`odbcad32`), not from your application.

The server log is still useful. It shows no `FATAL` or `terminating connection` messages, so the server didn't drop your connection. And there's no new connection from your application at 17:03:30, when the `SELECT` failed. With connection pooling enabled, that would fit the driver manager handing your application a pooled connection that was opened before the server restarted.

To see what happens, could you reproduce scenario 2 with the following enabled, and send the logs from that run?

1. **The driver's log (MyLog) for your application.** Add `Debug=1;CommLog=1` to the application's connection string, or tick MyLog and CommLog in the driver's DSN settings, and keep them on for the whole run. The driver writes `mylog_EchoLoader_<pid>.log` and `psqlodbc_EchoLoader_<pid>.log`. Please send the pair whose process ID matches the run that failed, and note the time it failed. In that log, `CONNECTION_DEAD status=…` lines show what the driver answered each time .NET asked whether the connection was dead.
2. **ODBC tracing,** from the Tracing tab of the ODBC Data Source Administrator, for the same run. It records every call between .NET, the driver manager and the driver, including the `SQLGetConnectAttr` calls for `SQL_ATTR_CONNECTION_DEAD` (attribute 1209) and what they returned. That also shows when the driver manager takes a connection out of its pool.
3. **The PostgreSQL server log** for the same period, as before.

If you can, please also run the same test once with connection pooling turned off for the driver. If scenario 2 goes away, that tells us the stale connections are coming from the pool.

Thanks,
Dave


view thread (5+ messages)  latest in thread

Message-ID: <gh-postgresql-interfaces-psqlodbc-224-c6663924267@github.com>
Permalink:  ../gh-postgresql-interfaces-psqlodbc-224-c6663924267@github.com/

 · 


This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox