Thread

  1. psql & "unexpected EOF on client connection"

    John Gateley <gateley@jriver.com> — 2001-01-31T20:55:34Z

    Hi Y'all.
    
    I have been getting the dreaded "unexpected EOF on client
    connection" in my system logs, but the surprising thing is that
    it comes from psql (I think). I am executing psql
    via a 'system' system call, and about 1 time out of 20 I get
    the "unexpected EOF" message. Unfortunately, this
    also causes the 'system' call to return an error, even though
    all SQL code was executed properly. (After searching
    postgresql.org I found out that the message normally
    means that PGfinish wasn't called.)
    
    the exact code in question is:
    res=system("/usr/bin/psql <a-file-name");
    
    Gory details available on request.
    
    Thanks for any help,
    
    John Gateley
    gateley@jriver.com, J. River, Inc.
    
    
    
    
  2. Re: psql & "unexpected EOF on client connection"

    Tom Lane <tgl@sss.pgh.pa.us> — 2001-02-03T20:06:31Z

    gateley@jriver.com writes:
    > I have been getting the dreaded "unexpected EOF on client
    > connection" in my system logs, but the surprising thing is that
    > it comes from psql (I think). I am executing psql
    > via a 'system' system call, and about 1 time out of 20 I get
    > the "unexpected EOF" message. Unfortunately, this
    > also causes the 'system' call to return an error, even though
    > all SQL code was executed properly. (After searching
    > postgresql.org I found out that the message normally
    > means that PGfinish wasn't called.)
    
    So it does.  I didn't think there were any paths in psql that would
    lead to such an ungraceful exit, especially not if no SQL error occurs.
    
    > Gory details available on request.
    
    Please.  For starters, what platform are you on, and which PG version?
    
    			regards, tom lane
    
    
  3. Re: psql & "unexpected EOF on client connection"

    John Gateley <gateley@jriver.com> — 2001-02-05T15:02:08Z

    Tom Lane wrote:
    > 
    > gateley@jriver.com writes:
    > > I have been getting the dreaded "unexpected EOF on client
    > > connection" in my system logs, but the surprising thing is that
    > > it comes from psql (I think). I am executing psql
    > > via a 'system' system call, and about 1 time out of 20 I get
    > > the "unexpected EOF" message. Unfortunately, this
    > > also causes the 'system' call to return an error, even though
    > > all SQL code was executed properly. (After searching
    > > postgresql.org I found out that the message normally
    > > means that PGfinish wasn't called.)
    > 
    > So it does.  I didn't think there were any paths in psql that would
    > lead to such an ungraceful exit, especially not if no SQL error occurs.
    > 
    > > Gory details available on request.
    > 
    > Please.  For starters, what platform are you on, and which PG version?
    
    RedHat Linux 7.0, with kernel 2.2.17
    Postgresql version 7.0.3, as well as the stock
    version shipped with RedHat 7 (7.0.1???)
    
    My app gathers a bunch of data, and then
    dumps it into the database. It does not
    retrieve any data from the database (other
    apps do that). About 1 time out of 20, the call
    to PGconnectdb fails with a segfault signal. Because
    of this, I run the PGconnectdb/PGexec etc. in a
    forked process. If the forked process dies because
    of the signal, then I try using system("psql ....")
    as described above. About 1 time out of 20 this
    fails.
    
    Thanks,
    
    j
    
    
  4. Re: psql & "unexpected EOF on client connection"

    Tom Lane <tgl@sss.pgh.pa.us> — 2001-02-05T15:31:37Z

    gateley@jriver.com writes:
    > About 1 time out of 20, the call
    > to PGconnectdb fails with a segfault signal.
    
    Well, you've already got some pretty severe problems then.  Seems to me
    you ought to track down the reason for this failure before worrying
    about cosmetic issues like an ungraceful disconnect.
    
    I suggest compiling both libpq and your app with -g and extracting a
    backtrace from the core file produced by the segfault ...
    
    			regards, tom lane