473,473 Members | 2,080 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

backend exit mystery

I have libpq client program that repeatedly connects to a DB, queries, and
then disconnects. After a seemingly random number of such successful
sessions (sometimes 30, sometimes hundreds), the backend mysteriously exits
after the client calls PQsetdbLogin(), and the client hangs. Any clues?
Details below...

Client: C program linked with 7.2.1 libpq on HP-UX B.11.00 E 9000/803.
Server: PostgreSQL 7.3.2 on i686-pc-linux-gnu, compiled by GCC 2.96.

Client code snippet:

1 if (text_db_conn == NULL || PQstatus(text_db_conn) != CONNECTION_OK) {
2 if (text_db_conn!=NULL) PQfinish(text_db_conn);
3 fprintf(stderr,"Connecting to DB...\n");
4 fflush(stderr);
5 text_db_conn = PQsetdbLogin(IP, PORT, NULL, NULL,
6 "mydb", "myuser", NULL);
7 if (PQstatus(text_db_conn) == CONNECTION_BAD) {
8 fprintf(stderr,"Connection attempt failed.\n");
9 } else {
10 fprintf(stderr,"Connected.\n");
11 }
12 }

Client hangs after line 5. Client backtrace when hanging:

(gdb) bt
#0 0x20da28 in _select_sys ()
#1 0x1ec788 in select ()
#2 0xb9818 in pqWait ()
#3 0x4000f0e0 in __d_trap_fptr ()
#4 0x1ec788 in select ()
Error accessing memory address 0xffffffbf: Bad address.

Server log (with server_min_messages = debug5) shows:

2003-10-10 17:04:01 [28501] DEBUG: BackendStartup: forked pid=20296
socket=8
2003-10-10 17:04:01 [20296] LOG: connection received: host=10.0.1.1
port=61438
2003-10-10 17:05:34 [28501] DEBUG: reaping dead processes
2003-10-10 17:05:34 [28501] DEBUG: child process (pid 20296) exited with
exit code 0

I attached to this backend before it exited, and got this backtrace:

(gdb) bt
#0 0x420e8182 in recv () from /lib/i686/libc.so.6
#1 0x081115c8 in secure_read (port=0x82be9f0, ptr=0x826f100, len=8192) at
be-secure.c:301
#2 0x08115322 in pq_recvbuf () at pqcomm.c:463
#3 0x08115439 in pq_getbytes (s=0xbfffdd70 "Ho*\b8?*\b8???d\210\024",
len=4) at pqcomm.c:538
#4 0x081472fa in ProcessStartupPacket (port=0x82be9f0, SSLdone=0 '\0') at
postmaster.c:1094
#5 0x08148914 in DoBackend (port=0x82be9f0) at postmaster.c:2178
#6 0x081483ff in BackendStartup (port=0x82be9f0) at postmaster.c:1924
#7 0x081471f1 in ServerLoop () at postmaster.c:1027
#8 0x08146be6 in PostmasterMain (argc=4, argv=0x82a5ae8) at
postmaster.c:788
#9 0x081160dc in main (argc=4, argv=0xbfffe8b4) at main.c:210
#10 0x42017499 in __libc_start_main () from /lib/i686/libc.so.6
(gdb) p debug_query_string
$1 = 0x0
TIA.

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 12 '05 #1
6 2809
On Fri, 10 Oct 2003, Ed L. wrote:
I have libpq client program that repeatedly connects to a DB, queries, and
then disconnects. After a seemingly random number of such successful
sessions (sometimes 30, sometimes hundreds), the backend mysteriously exits
after the client calls PQsetdbLogin(), and the client hangs. Any clues?
Details below...

Client: C program linked with 7.2.1 libpq on HP-UX B.11.00 E 9000/803.
Server: PostgreSQL 7.3.2 on i686-pc-linux-gnu, compiled by GCC 2.96.


How's the memory situation on the server box?
Don't forget linux has that GREAT feature that randomly kills processes
when memory is tight.... Perhaps there's something in syslog
--
Jeff Trout <je**@jefftrout.com>
http://www.jefftrout.com/
http://www.stuarthamm.net/

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 12 '05 #2
On Saturday October 11 2003 9:00, Jeff wrote:
On Fri, 10 Oct 2003, Ed L. wrote:
I have libpq client program that repeatedly connects to a DB, queries,
and then disconnects. After a seemingly random number of such
successful sessions (sometimes 30, sometimes hundreds), the backend
mysteriously exits after the client calls PQsetdbLogin(), and the
client hangs. Any clues? Details below...

Client: C program linked with 7.2.1 libpq on HP-UX B.11.00 E 9000/803.
Server: PostgreSQL 7.3.2 on i686-pc-linux-gnu, compiled by GCC 2.96.


How's the memory situation on the server box?
Don't forget linux has that GREAT feature that randomly kills processes
when memory is tight.... Perhaps there's something in syslog


Hmmm... it's quite repeatable, though not easy to predict after how many
sessions, so I don't think it's that. Happens whether memory is tight or
not.

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

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

Nov 12 '05 #3
On Friday October 10 2003 4:46, Ed L. wrote:
I have libpq client program that repeatedly connects to a DB, queries,
and then disconnects. After a seemingly random number of such successful
sessions (sometimes 30, sometimes hundreds), the backend mysteriously
exits after the client calls PQsetdbLogin(), and the client hangs. Any
clues? Details below...

Client: C program linked with 7.2.1 libpq on HP-UX B.11.00 E 9000/803.
Server: PostgreSQL 7.3.2 on i686-pc-linux-gnu, compiled by GCC 2.96.


Still looking for clues as to the cause of this repeatable connection
failure. Passing an explicit connection timeout to PQconnectdb() escapes
from any long hangs, but the hanging is still an issue I'd like to
understand. Attached is a small C program that reliably reproduces this
problem on the setup above. I added an explicit timeout to PQconnectdb()
to wait only 30 seconds. I'm curious to know if anyone can easily repeat
the problem (careful, it will generate a bit of traffic, cpu load, and run
forever). My last example run showed 17 timeouts seemingly randomly
dispersed among 5000 consecutive connection attempts.

The server has plenty of available memory on a dual processor machine
running Linux 2.4.18-3smp. Tried to catch snapshot data from netstat on
Recv-Q and Send-Q sizes on the server during a hang... that's a little iffy
with the timing of grepping netstat output, but seems like the server's
Recv-Q's were always zero and the Send-Q's were occasional in the tens
(bytes?).

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

Nov 12 '05 #4
On Friday October 10 2003 4:46, Ed L. wrote:
I have libpq client program that repeatedly connects to a DB, queries,
and then disconnects. After a seemingly random number of such successful
sessions (sometimes 30, sometimes hundreds), the backend mysteriously
exits after the client calls PQsetdbLogin(), and the client hangs. Any
clues? Details below...

Client: C program linked with 7.2.1 libpq on HP-UX B.11.00 E 9000/803.
Server: PostgreSQL 7.3.2 on i686-pc-linux-gnu, compiled by GCC 2.96.


Still looking for clues as to the cause of this repeatable connection
failure. Passing an explicit connection timeout to PQconnectdb() escapes
from any long hangs, but the hanging is still an issue I'd like to
understand. Attached is a small C program that reliably reproduces this
problem on the setup above. I added an explicit timeout to PQconnectdb()
to wait only 30 seconds. I'm curious to know if anyone can easily repeat
the problem (careful, it will generate a bit of traffic, cpu load, and run
forever). My last example run showed 17 timeouts seemingly randomly
dispersed among 5000 consecutive connection attempts.

The server has plenty of available memory on a dual processor machine
running Linux 2.4.18-3smp. Tried to catch snapshot data from netstat on
Recv-Q and Send-Q sizes on the server during a hang... that's a little iffy
with the timing of grepping netstat output, but seems like the server's
Recv-Q's were always zero and the Send-Q's were occasional in the tens
(bytes?).

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

Nov 12 '05 #5
Ed Loehr <ed@LoehrTech.com> writes:
Attached is a small C program that reliably reproduces this=20
problem on the setup above. I added an explicit timeout to PQconnectdb()=
to wait only 30 seconds. I'm curious to know if anyone can easily repeat=
the problem (careful, it will generate a bit of traffic, cpu load, and run=
forever). My last example run showed 17 timeouts seemingly randomly=20
dispersed among 5000 consecutive connection attempts.=20=20


I tried to duplicate the problem, without success --- 20000 connection
attempts without failure. Setup is HPUX 10.20 client, RHL8 server
(2.4.18-24.8.0 kernel); but it's a single-processor machine, not dual as
in your example. I was using CVS-tip PG sources, also.

regards, tom lane

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

Nov 12 '05 #6
Ed Loehr <ed@LoehrTech.com> writes:
Attached is a small C program that reliably reproduces this=20
problem on the setup above. I added an explicit timeout to PQconnectdb()=
to wait only 30 seconds. I'm curious to know if anyone can easily repeat=
the problem (careful, it will generate a bit of traffic, cpu load, and run=
forever). My last example run showed 17 timeouts seemingly randomly=20
dispersed among 5000 consecutive connection attempts.=20=20


I tried to duplicate the problem, without success --- 20000 connection
attempts without failure. Setup is HPUX 10.20 client, RHL8 server
(2.4.18-24.8.0 kernel); but it's a single-processor machine, not dual as
in your example. I was using CVS-tip PG sources, also.

regards, tom lane

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

Nov 12 '05 #7

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

Similar topics

5
by: Bruno BAGUETTE | last post by:
> Yes, the mod_auth_pgsql series for Apache 2 is broken as you > describe. It does not release the connection, but the change > is intentional. Looking at the Changelog I see: > > - now we...
1
by: Daveyk0 | last post by:
Hello there, I have a front end database that I have recently made very many changes to to allow off-line use. I keep copies of the databases on my hard drive and link to them rather than the...
5
by: NTL News Group | last post by:
How can I establish the path to the Backend (Tables) of my split database? Regards
5
by: Geir Baardsen | last post by:
Hi! I wonder if anybody can help with the following: I need to password-protect tables in MyBackEnd.DB, which is placed in the same folder as the MyFrontEnd.DB Now I've tried the KB_209953...
115
by: Mark Shelor | last post by:
I've encountered a troublesome inconsistency in the C-language Perl extension I've written for CPAN (Digest::SHA). The problem involves the use of a static array within a performance-critical...
1
by: Bob Powell | last post by:
Hello everyone, I have received any error message in my Postgres error log as follows: "The Postmaster has informed me that some other backend died abnormally and possibly corrupted shared...
14
by: jojoba | last post by:
Hi, I hope this post is ok for this group. Here's my deal: I have two computers on my LAN at home. One desktop. One laptop. Both computers are wireless enabled (and wired enabled too). I...
13
by: rdemyan via AccessMonster.com | last post by:
My front-end code manually links to the backend file. I was wondering what stops Access from linking to the system tables in the backend file. Is it just by virtue that they are hidden? This...
4
by: corey11 | last post by:
I'm a very low-level developer with limited VB knowledge but nonetheless was able to put together a very user-friendly and extremely helpful Access 97 database for my company some 10 years back. We...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
1
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
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 ...
0
muto222
php
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.