RE: [HACKERS] How do I get the backend server into gdb?
I need to debug this connection problem I am having with Access97. My
question is how can I get the new Postgres backend that starts up for Access
into debug (gdb)? I can get the PostMaster open in gdb.
Thanks, Michael
You can attach to a running process using gdb... 'gdb -t <pid>' or
something like that...its been awhile since I've used it, sorry...
On Wed, 28 Apr 1999, Michael J Davis wrote:
I need to debug this connection problem I am having with Access97. My
question is how can I get the new Postgres backend that starts up for Access
into debug (gdb)? I can get the PostMaster open in gdb.Thanks, Michael
Marc G. Fournier ICQ#7615664 IRC Nick: Scrappy
Systems Administrator @ hub.org
primary: scrappy@hub.org secondary: scrappy@{freebsd|postgresql}.org
The problem I need to debug won't allow me to do this. A Postgres
connection starts and then dies very quickly with a user authentication
error or database non existence error before I have a chance to attach to
the process via gdb. I need to find out why postgres will not allow my
Access97 connection to succeed. Pg_hba.conf appears to be configured
correctly (it was working and has not changed in past two months). I need
to have the new postgres session start up in debug.
-----Original Message-----
From: The Hermit Hacker [SMTP:scrappy@hub.org]
Sent: Wednesday, April 28, 1999 10:19 AM
To: Michael J Davis
Cc: pgsql-hackers@postgreSQL.org
Subject: RE: [HACKERS] How do I get the backend server into
gdb?
You can attach to a running process using gdb... 'gdb -t <pid>' or
something like that...its been awhile since I've used it, sorry...
On Wed, 28 Apr 1999, Michael J Davis wrote:
I need to debug this connection problem I am having with Access97.
My
question is how can I get the new Postgres backend that starts up
for Access
into debug (gdb)? I can get the PostMaster open in gdb.
Thanks, Michael
Marc G. Fournier ICQ#7615664 IRC
Nick: Scrappy
Systems Administrator @ hub.org
primary: scrappy@hub.org secondary:
scrappy@{freebsd|postgresql}.org
Import Notes
Resolved by subject fallback
Then how do you debug issues in the backend?
-----Original Message-----
From: The Hermit Hacker [SMTP:scrappy@hub.org]
Sent: Wednesday, April 28, 1999 10:19 AM
To: Michael J Davis
Cc: pgsql-hackers@postgresql.org
Subject: RE: [HACKERS] How do I get the backend server into
gdb?
You can attach to a running process using gdb... 'gdb -t <pid>' or
something like that...its been awhile since I've used it, sorry...
On Wed, 28 Apr 1999, Michael J Davis wrote:
I need to debug this connection problem I am having with Access97.
My
question is how can I get the new Postgres backend that starts up
for Access
into debug (gdb)? I can get the PostMaster open in gdb.
Thanks, Michael
Marc G. Fournier ICQ#7615664 IRC
Nick: Scrappy
Systems Administrator @ hub.org
primary: scrappy@hub.org secondary:
scrappy@{freebsd|postgresql}.org
Import Notes
Resolved by subject fallback
There is some option that starts backends, and then sleeps waiting for a
gdb connection, or something like that.
Or you can add the sleep yourself.
[Charset iso-8859-1 unsupported, filtering to ASCII...]
The problem I need to debug won't allow me to do this. A Postgres
connection starts and then dies very quickly with a user authentication
error or database non existence error before I have a chance to attach to
the process via gdb. I need to find out why postgres will not allow my
Access97 connection to succeed. Pg_hba.conf appears to be configured
correctly (it was working and has not changed in past two months). I need
to have the new postgres session start up in debug.-----Original Message-----
From: The Hermit Hacker [SMTP:scrappy@hub.org]
Sent: Wednesday, April 28, 1999 10:19 AM
To: Michael J Davis
Cc: pgsql-hackers@postgreSQL.org
Subject: RE: [HACKERS] How do I get the backend server into
gdb?You can attach to a running process using gdb... 'gdb -t <pid>' or
something like that...its been awhile since I've used it, sorry...On Wed, 28 Apr 1999, Michael J Davis wrote:
I need to debug this connection problem I am having with Access97.
My
question is how can I get the new Postgres backend that starts up
for Access
into debug (gdb)? I can get the PostMaster open in gdb.
Thanks, Michael
Marc G. Fournier ICQ#7615664 IRC
Nick: Scrappy
Systems Administrator @ hub.org
primary: scrappy@hub.org secondary:
scrappy@{freebsd|postgresql}.org
--
Bruce Momjian | http://www.op.net/~candle
maillist@candle.pha.pa.us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
Bruce Momjian wrote:
There is some option that starts backends, and then sleeps
waiting for a
gdb connection, or something like that.
Why not just the following
gdb postmaster
Set one ore more breakpoints where you think the problem
might be, then type 'run'.
Start the client and with a bit of luck gdb will break at
the breakpoint set.
You may need to do this a couple of times until you
have found the right area in the code.
--------
Regards
Theo
I tired but it breaks in the Postmaster and not in the backend process that
is created for each process.
-----Original Message-----
From: Theo Kramer [SMTP:theo@flame.co.za]
Sent: Wednesday, April 28, 1999 2:08 PM
To: pgsql-hackers@postgreSQL.org
Subject: Re: [HACKERS] How do I get the backend server into
gdb?
Bruce Momjian wrote:
There is some option that starts backends, and then sleeps
waiting for a
gdb connection, or something like that.
Why not just the following
gdb postmaster
Set one ore more breakpoints where you think the problem
might be, then type 'run'.
Start the client and with a bit of luck gdb will break at
the breakpoint set.
You may need to do this a couple of times until you
have found the right area in the code.
--------
Regards
Theo
Import Notes
Resolved by subject fallback
And the answer is an undocumented parameter to the postmaster. The
parameter "-W 30" (must be inside the "-o " because must it be sent to
postgres not to the postmaster) will cause new processes to wait 30 seconds.
This gave me enough time to find the pid for the new process and execute
"gdb postgres pid" or "xxgdb postgres pid". This pushed the new postgres
process into the debugger where I could set my break points and debug. I
discovered this by stumbling around in the code a little. I suppose if I
had looked at the code first, I would not have had to pose my question. The
responses to my question surprise me a little. On one hand, jumping in and
searching the code for my answer was much, much easier than I expected. On
the other hand, I expected others to suggest the techniques they use for
debugging issues. It makes me wonder how much real debugging is taking
place? After all, this list is for hackers right? Sorry for the
negativity. This last issue has me stumped and I am stuck until I can get
it resolved. I really don't like being stuck very much.
Thanks, Michael
-----Original Message-----
From: Bruce Momjian [SMTP:maillist@candle.pha.pa.us]
Sent: Wednesday, April 28, 1999 1:54 PM
To: Michael J Davis
Cc: scrappy@hub.org; pgsql-hackers@postgreSQL.org
Subject: Re: [HACKERS] How do I get the backend server into
gdb?
There is some option that starts backends, and then sleeps waiting
for a
gdb connection, or something like that.
Or you can add the sleep yourself.
[Charset iso-8859-1 unsupported, filtering to ASCII...]
The problem I need to debug won't allow me to do this. A Postgres
connection starts and then dies very quickly with a user
authentication
error or database non existence error before I have a chance to
attach to
the process via gdb. I need to find out why postgres will not
allow my
Access97 connection to succeed. Pg_hba.conf appears to be
configured
correctly (it was working and has not changed in past two months).
I need
to have the new postgres session start up in debug.
-----Original Message-----
From: The Hermit Hacker [SMTP:scrappy@hub.org]
Sent: Wednesday, April 28, 1999 10:19 AM
To: Michael J Davis
Cc: pgsql-hackers@postgreSQL.org
Subject: RE: [HACKERS] How do I get the backend
server into
gdb?
You can attach to a running process using gdb... 'gdb -t
<pid>' or
something like that...its been awhile since I've used it,
sorry...
On Wed, 28 Apr 1999, Michael J Davis wrote:
I need to debug this connection problem I am having with
Access97.
My
question is how can I get the new Postgres backend that
starts up
for Access
into debug (gdb)? I can get the PostMaster open in gdb.
Thanks, Michael
Marc G. Fournier ICQ#7615664
IRC
Nick: Scrappy
Systems Administrator @ hub.org
primary: scrappy@hub.org secondary:
scrappy@{freebsd|postgresql}.org
--
Bruce Momjian | http://www.op.net/~candle
maillist@candle.pha.pa.us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania
19026
Import Notes
Resolved by subject fallback
On 28-Apr-99 Michael J Davis wrote:
I tired but it breaks in the Postmaster and not in the backend process that
is created for each process.
Have you tried starting the postmaster in debug mode? From man postmaster:
-d [debug_level]
The optional argument debug_level determines the
amount of debugging output the backend servers will
produce. If debug_level is one, the postmaster will
trace all connection traffic, and nothing else. For
levels two and higher, debugging is turned on in the
backend process and the postmaster displays more
information, including the backend environment and
process traffic. Note that if no file is specified
for backend servers to send their debugging output
then this output will appear on the controlling tty
of their parent postmaster.
There other debugging comments in this man page so you may wanna look
at it first.
Vince.
--
==========================================================================
Vince Vielhaber -- KA8CSH email: vev@michvhf.com flame-mail: /dev/null
# include <std/disclaimers.h> TEAM-OS2
Online Campground Directory http://www.camping-usa.com
Online Giftshop Superstore http://www.cloudninegifts.com
==========================================================================
Michael J Davis <michael.j.davis@tvguide.com> writes:
On the other hand, I expected others to suggest the techniques they use for
debugging issues.
Well, the attach-to-a-running-backend procedure has always sufficed for
my purposes in backend debugging. (Some other people like to just start
a backend directly from gdb, but of course that's not going to shed much
light on connection failures.)
If you are having an authorization problem, it's not likely the backend
per se that's at fault --- connection authorization is done in the
postmaster before forking a subprocess, so you should be able to step
through the postmaster's checks just with gdb on the postmaster.
Actually, it'd be best to start with a debugger attached to the frontend
and see exactly what series of messages go back and forth. That would
at least give you an idea of what phase is failing. I have no idea how
to do that in a Windows/Access97 environment, but it's easy enough if
you are using psql or some other Unix frontend. (Read the "protocol"
chapter in the developer's guide to know what's supposed to happen,
then set breakpoints in connectDB() in fe-connect.c.)
It might be that just seeing what error message comes back from the
server will tell you what you need to know --- it looked to me like
Access was unhelpfully providing its own generic message instead of
quoting what the backend or postmaster had to say. (Note: I installed
more verbose connection-rejection messages just last week, so make sure
you have up to date sources.)
BTW, on at least some platforms, the most recent versions of gdb are
capable of dealing with forked subprocesses intelligently, so that's
also a possible answer if you are chasing a problem that occurs
immediately after the fork.
regards, tom lane
Import Notes
Reply to msg id not found: YourmessageofWed28Apr1999154657-050093C04F1F5173D211A27900105AA8FCFC145443@lambic.prevuenet.com | Resolved by subject fallback
See tcop/postgres.c.
I tired but it breaks in the Postmaster and not in the backend process that
is created for each process.-----Original Message-----
From: Theo Kramer [SMTP:theo@flame.co.za]
Sent: Wednesday, April 28, 1999 2:08 PM
To: pgsql-hackers@postgreSQL.org
Subject: Re: [HACKERS] How do I get the backend server into
gdb?Bruce Momjian wrote:
There is some option that starts backends, and then sleeps
waiting for a
gdb connection, or something like that.Why not just the following
gdb postmaster
Set one ore more breakpoints where you think the problem
might be, then type 'run'.Start the client and with a bit of luck gdb will break at
the breakpoint set.You may need to do this a couple of times until you
have found the right area in the code.
--------
Regards
Theo
--
Bruce Momjian | http://www.op.net/~candle
maillist@candle.pha.pa.us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
I need to debug this connection problem I am having with Access97. My
question is how can I get the new Postgres backend that starts up for Access
into debug (gdb)? I can get the PostMaster open in gdb.Thanks, Michael
$ postgres -h
postgres: illegal option -- h
Usage: postgres [options] [dbname]
...
-W wait N seconds to allow attach from a debugger
I added the -W option for this purpose. You should start the postmaster
with the following option:
postmaster -o '-W 15' ...
The -W option is passed to the backend which sleeps 15 seconds before doing
any work. In the meantime you have the time to do a ps, find the backend pid
and attach gdb to the process.
Obviously you can't do that in a production environment because it adda a
fixed delay for each connection which will make your users very angry.
--
Massimo Dal Zotto
+----------------------------------------------------------------------+
| Massimo Dal Zotto email: dz@cs.unitn.it |
| Via Marconi, 141 phone: ++39-0461534251 |
| 38057 Pergine Valsugana (TN) www: http://www.cs.unitn.it/~dz/ |
| Italy pgp: finger dz@tango.cs.unitn.it |
+----------------------------------------------------------------------+
Massimo Dal Zotto <dz@cs.unitn.it> writes:
The -W option is passed to the backend which sleeps 15 seconds before doing
any work. In the meantime you have the time to do a ps, find the backend pid
and attach gdb to the process.
Obviously you can't do that in a production environment because it adda a
fixed delay for each connection which will make your users very angry.
Since it's a -o option, I see no need to force it to be used on every
connection. Instead start psql with environment variable
PGOPTIONS="-W 15"
or whatever you need for the particular session. The PGOPTIONS are sent
in the connection request and then catenated to whatever the postmaster
might have in its -o switch.
(BTW, it might be a good idea to go through the backend command-line
switches carefully and see if any of them could be security holes.
I'm feeling paranoid because of Matthias Schmitt's unresolved report...)
regards, tom lane
Import Notes
Reply to msg id not found: YourmessageofThu29Apr1999112822+0200199904290928.LAA01786@nikita.wizard.net | Resolved by subject fallback
How does this work when using Access97 or some other ODBC client instead of
psql? Psql worked great, the problem existed only when trying to access my
database with an ODBC client.
-----Original Message-----
From: Tom Lane [SMTP:tgl@sss.pgh.pa.us]
Sent: Thursday, April 29, 1999 4:34 PM
To: Massimo Dal Zotto
Cc: hackers@postgreSQL.org
Subject: Re: [HACKERS] How do I get the backend server into
gdb?
Massimo Dal Zotto <dz@cs.unitn.it> writes:
The -W option is passed to the backend which sleeps 15 seconds
before doing
any work. In the meantime you have the time to do a ps, find the
backend pid
and attach gdb to the process.
Obviously you can't do that in a production environment because it
adda a
fixed delay for each connection which will make your users very
angry.
Since it's a -o option, I see no need to force it to be used on
every
connection. Instead start psql with environment variable
PGOPTIONS="-W 15"
or whatever you need for the particular session. The PGOPTIONS are
sent
in the connection request and then catenated to whatever the
postmaster
might have in its -o switch.
(BTW, it might be a good idea to go through the backend command-line
switches carefully and see if any of them could be security holes.
I'm feeling paranoid because of Matthias Schmitt's unresolved
report...)
regards, tom lane
Import Notes
Resolved by subject fallback
Since it's a -o option, I see no need to force it to be used on every
connection. Instead start psql with environment variable
PGOPTIONS="-W 15"
or whatever you need for the particular session. The PGOPTIONS are sent
in the connection request and then catenated to whatever the postmaster
might have in its -o switch.(BTW, it might be a good idea to go through the backend command-line
switches carefully and see if any of them could be security holes.
I'm feeling paranoid because of Matthias Schmitt's unresolved report...)
I didn't know it did that.
--
Bruce Momjian | http://www.op.net/~candle
maillist@candle.pha.pa.us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026