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.

5.0.0: Npgsql.NpgsqlException (0x80004005): Exception while reading from stream

See original GitHub issue

Hello, after upgrading to 5.0.0 version, this is the error i get for long queries. Long queries get timeout. Happens only on 5.0.0. The same queries / codebase works fine with V3.1.2 or when connected with any local sql client to the same database.

The following is the exception

System.InvalidOperationException
An exception has been raised that is likely due to a transient failure.

System.InvalidOperationException: An exception has been raised that is likely due to a transient failure.
 ---> Npgsql.NpgsqlException (0x80004005): Exception while reading from stream
 ---> System.TimeoutException: Timeout during reading attempt
   at Npgsql.NpgsqlConnector.<ReadMessage>g__ReadMessageLong|194_0(NpgsqlConnector connector, Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage)
   at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming, CancellationToken cancellationToken)
   at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken)
   at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken)
   at Npgsql.NpgsqlCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.AsyncEnumerator.InitializeReaderAsync(DbContext _, Boolean result, CancellationToken cancellationToken)
   at Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifySucceeded, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifySucceeded, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.AsyncEnumerator.MoveNextAsync()
   at Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleAsync[TSource](IAsyncEnumerable`1 asyncEnumerable, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleAsync[TSource](IAsyncEnumerable`1 asyncEnumerable, CancellationToken cancellationToken)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:20 (10 by maintainers)

github_iconTop GitHub Comments

3reactions
asadcrcommented, Dec 7, 2020

@roji Setting a Command Timeout=0 still does not fix the issue. I will try to compile a runnable sample hopefully. if there is something else you would like me to try, that would be helpful.

2reactions
YohDeadfallcommented, Jan 22, 2021

@etiennecl’s problem was moved to the new issue, but it’s hard to say what was here. Let’s wait a week for @asadcr and close the issue in case of no response. Otherwise, we can close it right now and reopen later.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Npgsql Exception while reading from stream, Postgres
All I am doing is SELECTs. Here is the stack trace: Exception while reading from stream at Npgsql.ReadBuffer.Ensure(Int32 count, Boolean ...
Read more >
Exception while reading from stream · Issue #4532
Npgsql.NpgsqlException (0x80004005): Exception while reading from stream ---> System.TimeoutException: Timeout during reading attempt
Read more >
Solved: Postgresql: Exception while reading from stream
This error may happen when connection string is lacking port number. Try using server:port in connection string to Postgres database. Message 7 of...
Read more >
Developers - 5.0.4: Npgsql.NpgsqlException (0x80004005)
5.0.4: Npgsql.NpgsqlException (0x80004005): Exception while reading from stream ... Hello,. we are experiencing the same exception described in ...
Read more >
PostgreSQL connections fail with block message
Error on IMSI WCF Pipeline: Npgsql.NpgsqlException (0x80004005): Exception while reading from stream ---> System.IO.IOException: Unable to read data from ...
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