Skip site navigation (1) Skip section navigation (2)

Re: Big disconnect_and_exit cleanup in pg_basebackup

From: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Magnus Hagander <magnus(at)hagander(dot)net>, Hans-Jürgen Schönig <hs(at)cybertec(dot)at>
Subject: Re: Big disconnect_and_exit cleanup in pg_basebackup
Date: 2013-01-02 16:44:12
Message-ID: 50E463DC.2040309@cybertec.at (view raw or flat)
Thread:
Lists: pgsql-hackers
2013-01-02 17:17 keltezéssel, Boszormenyi Zoltan írta:
> Hi,
>
> the previously sent "factor out pg_malloc and friends" patch
> may call exit() in case of OOM during allocation and as a consequence,
> PQfinish() won't get called, leaving an "unexpected EOF from client"
> in the log.
>
> Let's close this annoyance in pg_basebackup. The attached patch does
> the following:
>
> - adds a PQfinish() (actually PQfinishSafe()) call that was just posted
>   in another thread
> - replace all PQfinish() and PQclear() with their *Safe counterpart so
>   a normal execution won't result in a crash because of calling PQfinish()
>   on a stale pointer

Forget about this point, the attached version sets "conn = NULL;"
explicitly after PQfinish(conn).

> - kill the disconnect_and_exit() macro, replace it with plain exit(),
>   the atexit callback does the disconnect anyway.
>
> Best regards,
> Zoltán Böszörményi
>
>
>


-- 
----------------------------------
Zoltán Böszörményi
Cybertec Schönig & Schönig GmbH
Gröhrmühlgasse 26
A-2700 Wiener Neustadt, Austria
Web: http://www.postgresql-support.de
      http://www.postgresql.at/


Attachment: pg_basebackup-disconnect-on-exit-cleanup-v3.patch
Description: text/x-patch (16.9 KB)

In response to

pgsql-hackers by date

Next:From: Tom LaneDate: 2013-01-02 16:44:32
Subject: Re: [COMMITTERS] pgsql: Unify some tar functionality across different parts
Previous:From: Magnus HaganderDate: 2013-01-02 16:39:04
Subject: Re: [COMMITTERS] pgsql: Unify some tar functionality across different parts

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group