[Lazarus] PostgreSql: unexpected EOF on client connection with an open transaction

Mark Morgan Lloyd markMLl.lazarus at telemetry.co.uk
Wed Sep 2 16:22:54 CEST 2015


Marc Santhoff wrote:
> On Di, 2015-09-01 at 14:26 -0300, Leonardo M. Ramé wrote:
>> Hi, this is kind of a dejavu, I'm pretty sure I have asked this question 
>> before, but I can't find the old message, so, here I go.
>>
>> In my postgresql.log file I get this two messages every time I 
>> query/update the database:
>>
>> could not receive data from client: Connection reset by peer
>> unexpected EOF on client connection with an open transaction
>>
>> I'm using TPQConnection/TSqlTransaction/TSqlQuery in a CGI with this method:
>>
>> procedure TDataModule1.ExecSql(ASql: string);
>> var
>>    lSql: TSQLQuery;
>> begin
>>    lSql := TSQLQuery.Create(nil);
>>    try
>>      lSql.DataBase := PQConnection1;
>>      lSql.Transaction := SQLTransaction1;
>>      lSql.SQL.Text:= ASql;
>>      lSql.ExecSQL;
>>      SQLTransaction1.Commit;
> 
> Only guessing: maybe the transaction object is set to "autocommit" and
> the .Commit statement produces the error?

I saw a suggestion earlier via Google (which I probably can't find 
again) that after the query had been executed an implicit begin would be 
reissued.

>>    finally
>>      lSql.Free;
>>    end;
>> end;
>>
>> The query is executed without issues, data is stored into the db, but I 
>> keep getting those messages.
>>
>> I'm using FPC 3.1.1 - Lazarus 1.5 - Linux 64bits (Ubuntu 15.04).

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]




More information about the Lazarus mailing list