question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unknown message code: 3 or Unknown message code: 23

See original GitHub issue

Steps 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:closed
  • Created 2 years ago
  • Comments:16 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
vonzshikcommented, Apr 2, 2022

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.

1reaction
Michael-Kempecommented, Feb 22, 2022

Sure. My Issue. Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

"Unknown message code: 74" on dotnet ef database ...
When I changed the port number to the correct one everything goes well: Username=postgres;Password=p@$$word;Host=localhost;Port=5432;Database= ...
Read more >
'Received unknown response for J for SSLRequest' : r/csharp
I was trying to migrate a sql database created on MySqlWorkbench - the code in question sits on Program.cs . I am on...
Read more >
SqlDataSource - The Manage Queries dialog fails with the ' ...
SqlDataSource - The Manage Queries dialog fails with the 'column "proisagg" does not exist' error on connecting to PostgreSQL 15 Beta 2.
Read more >
iOS update and restore errors
If your device couldn't be restored and you get a message that "an unknown error occurred [error number]," use these steps.
Read more >
unknown message digest algorithm, who can help to ...
When I run 'puppetd --test', it is failed, and the error message is unknown message digest algorithm. in the past this command is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found