0
votes

My issue details are as follows,

Working Environment

  • Npgsql = 3.0.7
  • Entity Framework = 6.1.3
  • PGPOOL = 3.5.2
  • Postgres = 9.4.8

When querying database the following error occurs frequently (exception may vary time to time & place of occurrence).

ERROR System.IO.EndOfStreamException: Attempted to read past the end of the stream.
at Npgsql.NpgsqlBuffer.Ensure(Int32 count)
at Npgsql.NpgsqlConnector.DoReadSingleMessage(DataRowLoadingMode dataRowLoadingMode, Boolean returnNullForAsyncMessage, Boolean isPrependedMessage)
at Npgsql.NpgsqlConnector.ReadSingleMessage(DataRowLoadingMode dataRowLoadingMode, Boolean returnNullForAsyncMessage)
at Npgsql.NpgsqlCommand.Execute(CommandBehavior behavior)
at Npgsql.NpgsqlCommand.ExecuteDbDataReaderInternal(CommandBehavior behavior)
at Npgsql.NpgsqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Entity.Infrastructure.Interception.InternalDispatcher1.Dispatch[TTarget,TInterceptionContext,TResult](TTarget target, Func3 operation, TInterceptionContext interceptionContext, Action3 executing, Action3 executed)
at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.Reader(DbCommand command, DbCommandInterceptionContext interceptionContext)
at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)

or:

ERROR System.IO.EndOfStreamException: Attempted to read past the end of the stream.
at Npgsql.NpgsqlBuffer.Ensure(Int32 count)
at Npgsql.NpgsqlConnector.DoReadSingleMessage(DataRowLoadingMode dataRowLoadingMode, Boolean returnNullForAsyncMessage, Boolean isPrependedMessage)
at Npgsql.NpgsqlConnector.ReadSingleMessage(DataRowLoadingMode dataRowLoadingMode, Boolean returnNullForAsyncMessage)
at Npgsql.NpgsqlConnector.ReadExpectingT
at Npgsql.NpgsqlConnector.ExecuteInternalCommand(FrontendMessage message, Boolean withTimeout)
at Npgsql.NpgsqlTransaction.Commit()
at System.Data.Entity.Infrastructure.Interception.InternalDispatcher1.Dispatch[TTarget,TInterceptionContext](TTarget target, Action2 operation, TInterceptionContext interceptionContext, Action3 executing, Action3 executed)

Same query run without pgpool, dose not get the above exception.

Can you please advice me to solve this issue?

Thanks you in advance.

1

1 Answers

0
votes

This seems like a duplicate of https://github.com/npgsql/npgsql/issues/1060, which has already been fixed. Try using the very new 3.1.0 to see if it solves your problems (watch out, it may be a bit raw), or wait until 3.0.8 comes out - it will contain the fix as well.