Thread: psql \q hang

psql \q hang

From
Jeff Ross
Date:
Hi all,

This is more of an odd anoyance than anything, but for the past month or
so when I \q out of psql I have to wait 20-25 seconds for the return to
the shell prompt.  This is the only copy of psql running and it doesn't
matter what database I'm connected to.  I'm running 8.4.4 on OpenBSD and
primarily PostgreSQL is powering Drupal.

Searching Google turned up nothing.  I can live with it but I'd be more
interested in fixing it.

Thanks!

Jeff Ross

Re: psql \q hang

From
"Greg Sabino Mullane"
Date:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160


> This is more of an odd anoyance than anything, but for the past month or
> so when I \q out of psql I have to wait 20-25 seconds for the return to
> the shell prompt.  This is the only copy of psql running and it doesn't

Perhaps there is an issue writing to the ~/.psql_history file? Try running
with --no-readline and see if it still happens. Otherwise, consider
using strace or lsof to see what it is doing during those 20 seconds.

- --
Greg Sabino Mullane greg@turnstep.com
End Point Corporation http://www.endpoint.com/
PGP Key: 0x14964AC8 201010041754
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
-----BEGIN PGP SIGNATURE-----

iEYEAREDAAYFAkyqTTcACgkQvJuQZxSWSsjyJQCfbb5otQ3j1ne+Du4LWa0vZn48
zEsAoM/m241CdF4/v/Us2Ip2OWGxgdG7
=JJea
-----END PGP SIGNATURE-----



Re: psql \q hang

From
Jeff Ross
Date:
On 10/04/10 15:55, Greg Sabino Mullane wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: RIPEMD160
>
>
>> This is more of an odd anoyance than anything, but for the past month or
>> so when I \q out of psql I have to wait 20-25 seconds for the return to
>> the shell prompt.  This is the only copy of psql running and it doesn't
>
> Perhaps there is an issue writing to the ~/.psql_history file? Try running
> with --no-readline and see if it still happens. Otherwise, consider
> using strace or lsof to see what it is doing during those 20 seconds.
>
> - --
> Greg Sabino Mullane greg@turnstep.com
> End Point Corporation http://www.endpoint.com/
> PGP Key: 0x14964AC8 201010041754
> http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
> -----BEGIN PGP SIGNATURE-----

Thanks for the hint, Greg!  It was indeed the .psql_history file.
Although I'm using the default history size, the file was over 5MB in
size and full of a table dump.  I truncated the file and no more delay
quitting psql.

Jeff


Re: psql \q hang

From
Tom Lane
Date:
Jeff Ross <jross@wykids.org> writes:
> Thanks for the hint, Greg!  It was indeed the .psql_history file.
> Although I'm using the default history size, the file was over 5MB in
> size and full of a table dump.  I truncated the file and no more delay
> quitting psql.

Huh ... what version of libreadline (or libedit) are you using exactly?
How did the large dump get in there?

            regards, tom lane

Re: psql \q hang

From
Jeff Ross
Date:
On 10/05/10 10:35, Tom Lane wrote:
> Jeff Ross<jross@wykids.org>  writes:
>> Thanks for the hint, Greg!  It was indeed the .psql_history file.
>> Although I'm using the default history size, the file was over 5MB in
>> size and full of a table dump.  I truncated the file and no more delay
>> quitting psql.
>
> Huh ... what version of libreadline (or libedit) are you using exactly?
> How did the large dump get in there?
>
>             regards, tom lane
>

According to the README in the source, this is "Gnu Readline library,
version 4.3.".

I'm not sure how the dump got in there.  I have a table of US Cities,
Zip Codes and lat/long data in one of the databases and the contents of
that table were in the history file twice.

Jeff

Re: psql \q hang

From
Tom Lane
Date:
Jeff Ross <jross@wykids.org> writes:
> On 10/05/10 10:35, Tom Lane wrote:
>> Huh ... what version of libreadline (or libedit) are you using exactly?
>> How did the large dump get in there?

> According to the README in the source, this is "Gnu Readline library,
> version 4.3.".

Well, that's not terribly new, but still ...

> I'm not sure how the dump got in there.  I have a table of US Cities,
> Zip Codes and lat/long data in one of the databases and the contents of
> that table were in the history file twice.

When you say "contents of the table", what do you mean exactly?  Did it
look like COPY data, psql SELECT output, or what?  I'm still quite
confused about how data that you didn't type got into the history.

If you still have the file on backup media, it might be useful to look
at the last few history lines before each instance of the table
contents.

            regards, tom lane