title: Npgsql does not work properly, when using PGPOOL cluster
body: <p>My issue details are as follows,</p>
  
  <p>Working Environment</p>
  
  <ul>
  <li>Npgsql = 3.0.7</li>
  <li>Entity Framework = 6.1.3</li>
  <li>PGPOOL = 3.5.2</li>
  <li>Postgres = 9.4.8</li>
  </ul>
  
  <p>When querying database the following error occurs frequently (exception may vary time to time &amp; place of occurrence).</p>
  
  <blockquote>
    <p>ERROR System.IO.EndOfStreamException: Attempted to read past the end of the stream.<br>
    at Npgsql.NpgsqlBuffer.Ensure(Int32 count)<br>
    at Npgsql.NpgsqlConnector.DoReadSingleMessage(DataRowLoadingMode dataRowLoadingMode, Boolean returnNullForAsyncMessage, Boolean isPrependedMessage)<br>
    at Npgsql.NpgsqlConnector.ReadSingleMessage(DataRowLoadingMode dataRowLoadingMode, Boolean returnNullForAsyncMessage)<br>
    at Npgsql.NpgsqlCommand.Execute(CommandBehavior behavior)<br>
    at Npgsql.NpgsqlCommand.ExecuteDbDataReaderInternal(CommandBehavior behavior)<br>
    at Npgsql.NpgsqlCommand.ExecuteDbDataReader(CommandBehavior behavior)<br>
    at System.Data.Entity.Infrastructure.Interception.InternalDispatcher<code>1.Dispatch[TTarget,TInterceptionContext,TResult](TTarget target, Func</code>3 operation, TInterceptionContext interceptionContext, Action<code>3 executing, Action</code>3 executed)<br>
    at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.Reader(DbCommand command, DbCommandInterceptionContext interceptionContext)<br>
    at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)  </p>
  </blockquote>
  
  <p>or:</p>
  
  <blockquote>
    <p>ERROR System.IO.EndOfStreamException: Attempted to read past the end of the stream.<br>
    at Npgsql.NpgsqlBuffer.Ensure(Int32 count)<br>
    at Npgsql.NpgsqlConnector.DoReadSingleMessage(DataRowLoadingMode dataRowLoadingMode, Boolean returnNullForAsyncMessage, Boolean isPrependedMessage)<br>
    at Npgsql.NpgsqlConnector.ReadSingleMessage(DataRowLoadingMode dataRowLoadingMode, Boolean returnNullForAsyncMessage)<br>
    at Npgsql.NpgsqlConnector.ReadExpectingT<br>
    at Npgsql.NpgsqlConnector.ExecuteInternalCommand(FrontendMessage message, Boolean withTimeout)<br>
    at Npgsql.NpgsqlTransaction.Commit()<br>
    at System.Data.Entity.Infrastructure.Interception.InternalDispatcher<code>1.Dispatch[TTarget,TInterceptionContext](TTarget target, Action</code>2 operation, TInterceptionContext interceptionContext, Action<code>3 executing, Action</code>3 executed)  </p>
  </blockquote>
  
  <p>Same query run without pgpool, dose not get the above exception.</p>
  
  <p>Can you please advice me to solve this issue?</p>
  
  <p>Thanks you in advance.</p>