Unknown message code: 3 or Unknown message code: 23
See original GitHub issueSteps to reproduce
We have been unable to reproduce the error in a console application. It is only visible within our production environment. If we take one of our applications, and direct the connection string directly to the db rather than pgbouncer, that will cause the issue to cease. As it happens relatively frequently, we can capture some diagnostics around the issue, but cannot reproduce at will.
The issue
We’ve read all of the previous responses that we can find to this issue, and do not believe it to be a threading issue (re-using the connection). The most common instance of the issue occurs on a short lived web request during which the application uses only 1 db connection. The Unknown message codes are always either 3 or 23.
I’m curious if you have any ideas to try, or logging information to capture which may help us track down the cause.
Relevant connection string parameters:
Pooling=false
Stacktrace
{"StackTraceString":"at Npgsql.Util.PGUtil.ValidateBackendMessageCode(BackendMessageCode code)
at Npgsql.NpgsqlConnector.<<ReadMessage>g__ReadMessageLong|194_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Npgsql.NpgsqlConnector.<ExecuteInternalCommand>d__249.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Npgsql.NpgsqlTransaction.<Commit>d__16.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Npgsql.NpgsqlTransaction.Commit()
at NHibernate.Transaction.AdoTransaction.Commit()",
"Message":"Unknown message code: 3",
"HResult":-2147467259,
"RemoteStackTraceString":null,
"ClassName":"Npgsql.NpgsqlException",
"InnerException":null,
"Data":null,
"WatsonBuckets":null,
"ExceptionMethod":"8
ValidateBackendMessageCode
Npgsql, Version=5.0.10.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7
Npgsql.Util.PGUtil
Void ValidateBackendMessageCode(Npgsql.BackendMessageCode)",
"RemoteStackIndex":0,
"HelpURL":null,
"Source":"Npgsql"}
Thank you beforehand for any assistance!
Further technical details
- Npgsql version: 5.0.10
- PostgreSQL version: 13.2
- pgbouncer version: 1.9.0
Operating system:
- App: Windows Server 2019 Datacenter
- Db: Red Hat 4.8.5-44
Other details about my project setup: pgbouncer configured in transaction mode
Issue Analytics
- State:
- Created 2 years ago
- Comments:16 (8 by maintainers)
Hello everyone. There has been found a possible reason for this error. You can find more info here: https://github.com/npgsql/npgsql/issues/4305#issuecomment-1086728515.
Sure. My Issue. Thanks