postmaster process and multithreading

From: andrew klassen <aptklassen(at)yahoo(dot)com>
To: pgsql-interfaces <pgsql-interfaces(at)postgresql(dot)org>
Subject: postmaster process and multithreading
Date: 2007-11-28 22:40:06
Message-ID: 642562.84474.qm@web37312.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

I compiled postgres with threading enabled because I wanted
multithreading in the client process that I was writing. I don't
necessarily care if all server processes are multithreaded but
it does look like it affects the postmaster process in some way.

The reason I am asking is because sometimes the postmaster
will create a core dump and it will show two threads but the
backtrace on both threads does not show any helpful information.
I am wondering if I can disable multithreading in the postmaster/server
file compiles and by doing so make the gdb output a little more helpful.

I have include gdb backtraces. Any ideas are welcome.
BTW I am running postgres 8.2.5 and Freebsd 4.10.

Here is what I get:
# gdb postgres -c /cores/postgres-0-474dcec7
GNU gdb 4.18 (FreeBSD)
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
Core was generated by `postgres'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/lib/libcrypt.so.2...done.
Reading symbols from /usr/lib/libm.so.2...done.
Reading symbols from /usr/lib/libc_r.so.4...done.
Reading symbols from /usr/libexec/ld-elf.so.1...done.
#0 0x8837bc94 in thread_sigframe_add (thread=0x0, sig=0, has_args=0)
at /usr/bsd/src/lib/libc_r/uthread/uthread_sig.c:1093
1093 /usr/bsd/src/lib/libc_r/uthread/uthread_sig.c: No such file or directory.
(gdb) bt
#0 0x8837bc94 in thread_sigframe_add (thread=0x0, sig=0, has_args=0)
at /usr/bsd/src/lib/libc_r/uthread/uthread_sig.c:1093
(gdb) info threads
2 process 264745 _thread_kern_scheduler ()
at /usr/bsd/src/lib/libc_r/uthread/uthread_kern.c:602
* 1 process 133673 0x8837bc94 in thread_sigframe_add (thread=0x0, sig=0,
has_args=0) at /usr/bsd/src/lib/libc_r/uthread/uthread_sig.c:1093
(gdb) thread 2
[Switching to thread 2 (process 264745)]
#0 _thread_kern_scheduler ()
at /usr/bsd/src/lib/libc_r/uthread/uthread_kern.c:602
602 /usr/bsd/src/lib/libc_r/uthread/uthread_kern.c: No such file or directory.
(gdb) bt
#0 _thread_kern_scheduler ()
at /usr/bsd/src/lib/libc_r/uthread/uthread_kern.c:602
#1 0x0 in ?? ()
(gdb) bt full
#0 _thread_kern_scheduler ()
at /usr/bsd/src/lib/libc_r/uthread/uthread_kern.c:602
ts = {tv_sec = 102, tv_nsec = 799262000}
tv = {tv_sec = 102, tv_usec = 799262}
curthread = (struct pthread *) 0x8327000
pthread = 0x883c5090
pthread_h = 0x8327000
current_tick = 0
add_to_prioq = 1
#1 0x0 in ?? ()
No symbol table info available.
(gdb) thread 1
[Switching to thread 1 (process 133673)]
#0 0x8837bc94 in thread_sigframe_add (thread=0x0, sig=0, has_args=0)
at /usr/bsd/src/lib/libc_r/uthread/uthread_sig.c:1093
1093 /usr/bsd/src/lib/libc_r/uthread/uthread_sig.c: No such file or directory.
(gdb) bt full
#0 0x8837bc94 in thread_sigframe_add (thread=0x0, sig=0, has_args=0)
at /usr/bsd/src/lib/libc_r/uthread/uthread_sig.c:1093
has_args = -2009207968
psf = (struct pthread_signal_frame *) 0x0
stackp = 0
(gdb) l main
55 main.c: No such file or directory.
(gdb) l PostmasterMain
373 postmaster.c: No such file or directory.
(gdb) print IsPostmasterEnvironment
$1 = 1 '\001'
(gdb) print MyProcPid
$2 = 2601
(gdb) print IsUnderPostmaster
$3 = 0 '\000'
(gdb) print StartupPID
$4 = 0
(gdb) print BgWriterPID
$5 = 2652
(gdb) print PgStatPID
$6 = 2653
(gdb) quit

If I attach gdb to a health postmaster thread #1 bt still does not look correct:

0x8838094c in __sys_poll () from /usr/lib/libc_r.so.4
(gdb) info threads
2 process 36551, thread 2 0x8837f1bb in _thread_kern_sched (ucp=0x0)
at /usr/bsd/src/lib/libc_r/uthread/uthread_kern.c:123
* 1 process 36551, thread 1 0x8838094c in __sys_poll () from /usr/lib/libc_r.so.4
(gdb) bt full
#0 0x8838094c in __sys_poll () from /usr/lib/libc_r.so.4
No symbol table info available.
#1 0x8837fe74 in thread_kern_poll (wait_reqd=1)
at /usr/bsd/src/lib/libc_r/uthread/uthread_kern.c:829
count = 0
i = -2009313020
found = -1077937916
kern_pipe_added = 1
nfds = 3
timeout_ms = 60000
pthread = (struct pthread *) 0x0
ts = {tv_sec = 6593, tv_nsec = 729608000}
tv = {tv_sec = 6593, tv_usec = 729608}
#2 0x8837f81e in _thread_kern_scheduler ()
at /usr/bsd/src/lib/libc_r/uthread/uthread_kern.c:504
ts = {tv_sec = 6593, tv_nsec = 729608000}
tv = {tv_sec = 6593, tv_usec = 729608}
curthread = (struct pthread *) 0x883dc9a0
pthread = 0x883c5090
pthread_h = 0x0
current_tick = 2285764128
add_to_prioq = 0
#3 0x0 in ?? ()
No symbol table info available.
(gdb) thread 2
[Switching to thread 2 (process 36551, thread 2)]
#0 0x8837f1bb in _thread_kern_sched (ucp=0x0)
at /usrbsd/src/lib/libc_r/uthread/uthread_kern.c:123
123 /usr/bsd/src/lib/libc_r/uthread/uthread_kern.c: No such file or di
rectory.
(gdb) bt full
#0 0x8837f1bb in _thread_kern_sched (ucp=0x0)
at /usr/bsd/src/lib/libc_r/uthread/uthread_kern.c:123
curthread = (struct pthread *) 0x8327000
#1 0x8837f9f9 in _thread_kern_sched_state (state=PS_SELECT_WAIT,
fname=0x883be360 "/usr/bsd/src/lib/libc_r/uthread/uthread_select.c",
lineno=149) at /usr/bsd/src/lib/libc_r/uthread/uthread_kern.c:637
state = PS_SELECT_WAIT
fname = 0x883be360 "/usr/bsd/src/lib/libc_r/uthread/uthread_select
.c"
curthread = (struct pthread *) 0xbfbff904
#2 0x8837c94f in _select (numfds=7, readfds=0xbfbff9d4, writefds=0x0,
exceptfds=0x0, timeout=0xbfbff9c4)
at /usr/bsd/src/lib/libc_r/uthread/uthread_select.c:149
timeout = (struct timeval *) 0xbfbff904
curthread = (struct pthread *) 0x8327000
ts = {tv_sec = 60, tv_nsec = 0}
i = 4
ret = 0
f_wait = 1
pfd_index = -1077937916
got_events = -1077937900
fd_count = 2
data = {nfds = 2, fds = 0x8327c00}
#3 0x8837cb66 in select (numfds=7, readfds=0xbfbff9d4, writefds=0x0,
exceptfds=0x0, timeout=0xbfbff9c4)
at /usr/bsd/src/lib/libc_r/uthread/uthread_select.c:271
exceptfds = (fd_set *) 0x0
timeout = (struct timeval *) 0xbfbff9c4
ret = -1077937724
#4 0x817c80b in ServerLoop () at postmaster.c:1162
port = (Port *) 0xbfbff9c4
rmask = {fds_bits = {96, 0 <repeats 31 times>}}
timeout = {tv_sec = 60, tv_usec = 0}
selres = -1077937724
i = -1077937452
readmask = {fds_bits = {96, 0 <repeats 31 times>}}
nSockets = 7
now = -1077937724
last_touch_time = 1196288034
earlier = {tv_sec = 1196288034, tv_usec = 365978}
later = {tv_sec = -2009303956, tv_usec = 2}
#5 0x817c42a in PostmasterMain (argc=11, argv=0xbfbffbac) at postmaster.c:966
opt = 137671169
status = 209
userDoption = 0x834b200 "\220\002"
i = 60000
#6 0x8142974 in main (argc=11, argv=0xbfbffbac) at main.c:188
argv = (char **) 0xbfbffbac
(gdb)

____________________________________________________________________________________
Never miss a thing. Make Yahoo your home page.
http://www.yahoo.com/r/hs

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message Tom Lane 2007-11-28 23:08:12 Re: postmaster process and multithreading
Previous Message Abraham, Danny 2007-11-28 14:43:00 Sliding windows on LIBPQ