473,722 Members | 2,430 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

"q" with psql display paging dumps out of psql

Hi,

Environment:

SunOS 5.7 Generic_106541-29 sun4u sparc SUNW,UltraSPARC-IIi-Engine
Postgresql-7.4.6
Build config: --with-java --enable-thread-safety
gcc version 3.3.1
less-381
readline-4.3

$ echo $PAGER
/usr/local/bin/less
$ echo $LESS
-e

I recently upgraded from 7.4.2 to 7.4.6 and have run into a new
problem. As frequently as not, maybe even most times, when I "q" out
of paging the output of a query in psql: Instead of just quitting that
query, I get dumped straight out of psql. To add insult to injury: The
command history for the current session isn't saved. (Only what was in
the command history on entry.) It's really quite irritating :/.

It's not repeatable. If I try to trace the psql session with truss, it
doesn't do it. If I "G" to the end of the output and then "q", it
doesn't do it.

I down-graded to Postgresql-7.4.5. It happened with it. I upgraded
"less" from v332 to v381. No improvement.

"echo $?" after it happens yields "141." There is no "141" in
/usr/include/sys/errno.h.

I'm guessing it's some kind of race condition. Any suggestions where I
might start debugging this problem?

Jim

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddres sHere" to ma*******@postg resql.org)

Nov 23 '05 #1
4 3513
Jim Seymour wrote:
"echo $?" after it happens yields "141." There is no "141" in
/usr/include/sys/errno.h.


Exit code 141 means signal 141 - 128 = 13 = SIGPIPE. I haven't finished
thinking what that means in this case, though ...

--
Peter Eisentraut
http://developer.postgresql.org/~petere/
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postg resql.org

Nov 23 '05 #2
js******@linxne t.com (Jim Seymour) writes:
I recently upgraded from 7.4.2 to 7.4.6 and have run into a new
problem. As frequently as not, maybe even most times, when I "q" out
of paging the output of a query in psql: Instead of just quitting that
query, I get dumped straight out of psql. To add insult to injury: The
command history for the current session isn't saved.
"echo $?" after it happens yields "141."
141-128 = 13 = SIGPIPE. So psql is getting sigpipe'd. The question is
why? It is set up to ignore SIGPIPE everywhere that it could reasonably
expect to get it, in particular from writing to the pager.
I'm guessing it's some kind of race condition.


The timing condition involved is probably whether or not psql has
finished writing all of the query result to the pager before you
quit the pager. So if you retrieve a large query result and "q"
immediately you can probably make it more reproducible.

Also, I don't think we changed that stuff between 7.4.2 and 7.4.6
(though I haven't trawled the commit logs to make sure). Was your
7.4.2 installation also built with --enable-thread-safety? It seems
likely that addition or removal of --enable-thread-safety would make
a difference.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postg resql.org so that your
message can get through to the mailing list cleanly

Nov 23 '05 #3
Peter Eisentraut wrote:
Jim Seymour wrote:
"echo $?" after it happens yields "141." There is no "141" in
/usr/include/sys/errno.h.

Exit code 141 means signal 141 - 128 = 13 = SIGPIPE. I haven't finished
thinking what that means in this case, though ...


I would expect it means the pipe between the data and pager was
inappropriately interrupted. Not that that helps a lot.

--
Until later, Geoffrey

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 23 '05 #4
Tom Lane <tg*@sss.pgh.pa .us> wrote:

js******@linxne t.com (Jim Seymour) writes:
I recently upgraded from 7.4.2 to 7.4.6 and have run into a new
problem. As frequently as not, maybe even most times, when I "q" out
of paging the output of a query in psql: Instead of just quitting that
query, I get dumped straight out of psql. To add insult to injury: The
command history for the current session isn't saved.
"echo $?" after it happens yields "141."
141-128 = 13 = SIGPIPE. So psql is getting sigpipe'd.


Yeah, a couple guys on one of my IRC channels figured that out. I
subsequently smacked myself on the forehead and went "Doh!" (Been too
many years away from systems coding, I guess.)
The question is
why? It is set up to ignore SIGPIPE everywhere that it could reasonably
expect to get it, in particular from writing to the pager.
Dunno.
I'm guessing it's some kind of race condition.
The timing condition involved is probably whether or not psql has
finished writing all of the query result to the pager before you
quit the pager. So if you retrieve a large query result and "q"
immediately you can probably make it more reproducible.


I suppose anything's possible. But I usually look at the result for a
bit after querying for it ;), so... Anyway, I tried it on a query that
pretty reliably exhibits the problem, and no amount of waiting before
hitting "q" seems to make any difference.

By the way, I get this in the serverlog: "LOG: unexpected EOF on
client connection".

Also, I don't think we changed that stuff between 7.4.2 and 7.4.6
(though I haven't trawled the commit logs to make sure). Was your
7.4.2 installation also built with --enable-thread-safety?
Yes, my 7.4.2 install was built with --enable-thread-safety. (In fact:
If you check the archives, you'll see it was I discovered a problem
with building with --enable-thread-safety in 7.4.2 and created a patch
to fix it.)
It seems
likely that addition or removal of --enable-thread-safety would make
a difference.


I was thinking of giving that a go, being as the only things I could
see in the HISTORY that looked like they might have any relationship
was "thread on Solaris" stuff. Sure enough, compiling without
--enable-thread-safety makes the problem go away.

Anything else I can try/answer for y'all?

Jim

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postg resql.org so that your
message can get through to the mailing list cleanly

Nov 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
7691
by: Wm | last post by:
I'm trying to get a handle on the best way to handle setting up my listings so that I display groups of about 25 records per page. I currently have a page that returns over 1,000 names/addresses, which is obviously not very efficient. Does anyone have any suggestions on the best way to approach this, or recommendations on what pitfalls to avoid? I'm assuming that I need to be able to count the total number of records that match the search...
25
3091
by: Nitin Bhardwaj | last post by:
Well, i'm a relatively new into C( strictly speaking : well i'm a student and have been doing & studying C programming for the last 4 years).....and also a regular reader of "comp.lang.c" I don't have a copy of ANSI C89 standard,therefore i had to post this question: What is the difference between "unspecified" behaviour & "undefined" behaviour of some C Code ??
0
314
by: Felix Finch | last post by:
I have a perl test program which has about 80 test cases, each of which creates its own schema so I can remove them with DROP SCHEMA xxx CASCADE. Normally each test case creates and drops the same schema, but it can run a mode to preserve each schema and all the disk files for each test. I recently changed my cleanup code to run psql with all -c commands on one command line rather than a separate psql -c for each one ... psql -c 'DROP...
1
10871
by: Ennio-Sr | last post by:
Hi all! I'm writing a script that presents the user with a numbered lines menu, each line corresponding to a <case n> which executes a psql command. As the psql-commands are very similar to each other (all of them have the structure: 1.- psql mydb -x -c "SELECT * FROM tb_nm WHERE col_nm LIKE '%$k_r%'" ) I thought it was possible to shorten it, initializing a str with said command at the beginning of the script and limiting the...
3
2222
by: Anony Mous | last post by:
Hi, I've run into a problem. I've had postgres V8 beta on my WinXP Pro machine for some time now, and it's been running great. Now, for some reason, I cannot issue any queries to the database via psql. See snippit below... ------------ C:\Program Files\PostgreSQL\8.0-beta1\bin>createdb -U postgres test CREATE DATABASE
1
5721
by: Kim | last post by:
How can I display "No data found" in the repeater if there are no records found after selecting an item from a dropdown list. Another question is: Can repeater perform paging as in datagrid if the number of records to be displayed in too long ? I am using a repeater instead of datagrid as the latter does not allow me to have one data-bound column with hyperlink.
2
2386
by: Jeff Gardner | last post by:
Greetings: I've a script written for paging through a given recordset with page links, etc. I want to be able to limit the number of page numbers displayed as a large query may result in 100 or more pages and having 100 or more page links is ugly, to say the least. Below is the code that I am using for the paging. I'd like something like pages 1 - 5, click 5 or next, then pages 6-10 are displayed, etc. I am not sure where to start as...
0
2611
by: =?Utf-8?B?TWlrZQ==?= | last post by:
Via an ASPX (and code behind) in .net 2.0 I want to be able to "page" though and display the contents of an xml file. So if there are 100 elements, I can display "page 1 of 4" and list 25 elements per page. How can I do this? Below is the code used to display the XML file // Create XmlDocument and load the XML from file string FilterValue = "Autos";
2
4306
by: bips2008 | last post by:
The code seems to work fine in other browser but in IE it throws this error. This is very urgent for me and any help would be greatly appreciated For your convienence i have posted the code for the file. The portion that is not working is the star rating part <?php session_start(); include_once('includes/host_conf.php'); include_once('includes/db_connect.php'); include_once('includes/mysql.lib.php');...
0
8739
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9384
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9238
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9157
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6681
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5995
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4762
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3207
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2602
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.