473,756 Members | 2,383 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

7.4.3 server panic


I have been able to crash the server a few times with the following function
when it is called on a user and schema that was recently deleted. Following
is a log of what happened and also the function that was called. This is
7.4.3 on Freebsd 5.2.1. It doesn't always panic when it encounters a
deleted user/schema, it's kind of sporadic but happens often enough that
it's easy to duplicate.

Chris

----------------------------------------------------------------------------
------
CREATE OR REPLACE FUNCTION setuser(varchar ) RETURNS integer AS
'
DECLARE
in_username ALIAS FOR \$1;
BEGIN
EXECUTE ''SET SESSION AUTHORIZATION '' || in_username;
EXECUTE ''SET SEARCH_PATH TO '' || in_username || '',PUBLIC'';
RETURN 1;
END '
LANGUAGE 'plpgsql';

----------------------------------------------------------------------------
-----
LOG: statement: select * from
setuser('suppor t')
LOG: statement: SET SESSION AUTHORIZATION support
CONTEXT: PL/pgSQL function "setuser" line 4 at execute statement
LOG: statement: SET SEARCH_PATH TO support,PUBLIC
CONTEXT: PL/pgSQL function "setuser" line 5 at execute statement
ERROR: schema "support" does not exist
CONTEXT: PL/pgSQL function "setuser" line 5 at execute statement
STATEMENT: select * from
setuser('suppor t')
ERROR: invalid user ID: 194
PANIC: error during error recovery, giving up
LOG: server process (PID 38302) was terminated by signal 6
LOG: terminating any other active server processes
WARNING: terminating connection because of crash of another server process
DETAIL: The postmaster has commanded this server process to roll back the
current transaction and exit, because another server process exited
abnormally and possibly corrupted shared memory.
HINT: In a moment you should be able to reconnect to the database and
repeat your command.

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 23 '05 #1
5 1392
"Chris Ochs" <ch***@paymento nline.com> writes:
ERROR: invalid user ID: 194
PANIC: error during error recovery, giving up
LOG: server process (PID 38302) was terminated by signal 6


Can you get a stack traceback from this crash? The only occurrence of
"invalid user ID:" that I see in the source code is in
GetUserNameFrom Id(), but there's no visible reason why that would be
called during error recovery.

Also, a recipe for reproducing it would help. I spent a little time
trying with your function with no success. You might be able to make
it more reproducible by inserting delays in the setuser() function.
(See the sleep() function in src/test/regress/sql/stats.sql for a quick
and dirty way to delay.) I didn't have any luck, but since I don't know
what's going on concurrently with this function in your environment,
I was probably trying the wrong things.

regards, tom lane

---------------------------(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 23 '05 #2
"Chris Ochs" <ch***@paymento nline.com> writes:
ERROR: invalid user ID: 194
PANIC: error during error recovery, giving up
LOG: server process (PID 38302) was terminated by signal 6
Can you get a stack traceback from this crash? The only occurrence of
"invalid user ID:" that I see in the source code is in
GetUserNameFrom Id(), but there's no visible reason why that would be
called during error recovery.


(gdb) bt
#0 0x284f9dcf in kill () from /lib/libc.so.5
#1 0x284ee878 in raise () from /lib/libc.so.5
#2 0x28566f82 in abort () from /lib/libc.so.5
#3 0x08226a6a in errfinish ()
#4 0x08226953 in errfinish ()
#5 0x0822f54d in GetUserNameFrom Id ()
#6 0x081183a3 in show_session_au thorization ()
#7 0x08232fe7 in show_all_settin gs ()
#8 0x0823196b in AtEOXact_GUC ()
#9 0x0823164f in AtEOXact_GUC ()
#10 0x08094cbd in XactPopRollback ()
#11 0x081a2334 in PostgresMain ()
#12 0x0817576b in PostmasterMain ()
#13 0x08174fa3 in PostmasterMain ()
#14 0x08173436 in PostmasterMain ()
#15 0x08172c1c in PostmasterMain ()
#16 0x0813b7fa in main ()
#17 0x0806d822 in _start ()
(gdb)


Also, a recipe for reproducing it would help. I spent a little time
trying with your function with no success. You might be able to make
it more reproducible by inserting delays in the setuser() function.
(See the sleep() function in src/test/regress/sql/stats.sql for a quick
and dirty way to delay.) I didn't have any luck, but since I don't know
what's going on concurrently with this function in your environment,
I was probably trying the wrong things.
I'm not sure myself exactly what the trigger is. The database connections
are all through mod perl/Apache::DBI which I suspect have something to do
with the problem. Maybe when a user is dropped, it changes the state of the
database in some way that an active, open connection doesn't pick up? Just
a guess. One thing I noticed is that the panic happens not when setuser is
called on the user that is deleted, but on a user that doesn't, and never
did, exist. It also keeps panicing on the same user even though I am
calling setuser on several other users that don't exist (or did and have
been deleted). It does appear though that deleting a user/schema has some
sort of effect, because it always seems to happen when I have deleted a
user/schema. In other words it's never happened in the absence of a
recently deleted user that setuser was called on, even though it's not that
user that it appears to panic on. If that makes sense....

Chris

regards, tom lane

---------------------------(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

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 23 '05 #3
"Chris" <ch***@paymento nline.com> writes:
Can you get a stack traceback from this crash?
(gdb) bt
#0 0x284f9dcf in kill () from /lib/libc.so.5
#1 0x284ee878 in raise () from /lib/libc.so.5
#2 0x28566f82 in abort () from /lib/libc.so.5
#3 0x08226a6a in errfinish ()
#4 0x08226953 in errfinish ()
#5 0x0822f54d in GetUserNameFrom Id ()
#6 0x081183a3 in show_session_au thorization ()
#7 0x08232fe7 in show_all_settin gs ()
#8 0x0823196b in AtEOXact_GUC ()
#9 0x0823164f in AtEOXact_GUC ()
#10 0x08094cbd in XactPopRollback ()
#11 0x081a2334 in PostgresMain ()


The trace is a bit bogus, but it did help me figure out what's going on:
I think that we're trying to report the current session authorization to
the client (which is something that happens automatically on any change)
and it's referencing a deleted user. Is it possible that your setup is
deleting the user that the entire session is running as?

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 23 '05 #4
>
(gdb) bt
#0 0x284f9dcf in kill () from /lib/libc.so.5
#1 0x284ee878 in raise () from /lib/libc.so.5
#2 0x28566f82 in abort () from /lib/libc.so.5
#3 0x08226a6a in errfinish ()
#4 0x08226953 in errfinish ()
#5 0x0822f54d in GetUserNameFrom Id ()
#6 0x081183a3 in show_session_au thorization ()
#7 0x08232fe7 in show_all_settin gs ()
#8 0x0823196b in AtEOXact_GUC ()
#9 0x0823164f in AtEOXact_GUC ()
#10 0x08094cbd in XactPopRollback ()
#11 0x081a2334 in PostgresMain ()


The trace is a bit bogus, but it did help me figure out what's going on:
I think that we're trying to report the current session authorization to
the client (which is something that happens automatically on any change)
and it's referencing a deleted user. Is it possible that your setup is
deleting the user that the entire session is running as?

regards, tom lane


By entire session do you mean the superuser that initially makes the
connection? If so, then definitely no that user is not deleted. It's
possible that a set session authorization was issued, the current session
user was then deleted by another connection, and then the session of the
deleted user tried to report. I am calling reset session authorization at
the start of every run of our application, but I could have missed something
so that it does end up in a state of trying to report on a user session
where the user no longer exists.

Chris


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

Nov 23 '05 #5
"Chris Ochs" <ch***@paymento nline.com> writes:
I think that we're trying to report the current session authorization to
the client (which is something that happens automatically on any change)
and it's referencing a deleted user. Is it possible that your setup is
deleting the user that the entire session is running as?
By entire session do you mean the superuser that initially makes the
connection? If so, then definitely no that user is not deleted. It's
possible that a set session authorization was issued, the current session
user was then deleted by another connection, and then the session of the
deleted user tried to report. I am calling reset session authorization at
the start of every run of our application, but I could have missed something
so that it does end up in a state of trying to report on a user session
where the user no longer exists.


Okay. The ideal fix would be for the system to refuse to allow
dropping a user that someone is currently connected or authorized as,
but that seems impractical to enforce. (An authorization could, for
example, be hidden a few levels down a session's call stack if there
are nested SECURITY DEFINER function calls. It'd be expensive even
to check this for your own session, let alone any other sessions.)

What I think I will do is alter the SET SESSION AUTHORIZATION code so
that it stores both the name and userID of the currently authorized
user, and then it can just report the name part to the client without
having to do a lookup, which is a Good Thing if we're in an aborted
transaction.

The downside of this is that an ALTER USER RENAME won't affect the
stored data and so the reported authorization name won't change in
existing sessions ... but I don't think that works now anyway.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 23 '05 #6

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

Similar topics

12
6195
by: Sander Smeenk | last post by:
Hi, After a very recent postgresql update, the postmaster failed to start because of this: | PANIC: The database cluster was initialized with LC_CTYPE | 'nl_NL@euro.UTF-8', which is not recognized by setlocale(). | It looks like you need to initdb. Now I know nl_NL@euro.UTF-8 is an incorrect locale, I fixed that some
2
999
by: Mike Rylander | last post by:
I hope I'm not reporting a known problem, but it seems that the NNTP server is not getting new postings any more. Thanks in advance! -- Mike Rylander miker@purplefrog.com Indentation is a wonderful form of commentary from programmer to programmer, but its symbology is
29
2712
by: lec | last post by:
Hi, I'm observing the following: If I commit the following records 1,2,3,4,5,6,7,8,9,10 to the database and the server hangs, I could lose records 5,6,7,8,9 but record 10 is there. How is this possible and do anyone know how Postgresql physically writes the records? Thanks, thomas.
2
2119
by: Andrew Sukow | last post by:
Greetings, Our postgres system crashed and upon restarting it our database had the following errors. The error log was 4.5 gigs which is much larger than usual. We looked online for information about lost left siblings and how to fix the data and not lose the 400 million records we have. Anyone have an idea what's the matter and what the fix is? LOG: database system was interrupted while in recovery at 2004-08-17 08:59:41 PDT HINT: ...
2
4924
by: Mike | last post by:
Hi, I am strugling with a simple problem which I can't seem to resolve. I have an asp.net page which contains a server-control (flytreeview, which is a kind of a tree to be exact). The tree is being updated by some other process through remoting. When the page loads, I init the tree, and in my browser I can see the initialized tree. The problem is that every time that I receive update to tree from the remote process,
15
1485
by: niteshkpatil | last post by:
Hi, I am compiling a C program on Hp-UX11.11 using the HP C compiler. % cc test.c (say for example....) I get the following message and the compilation is aborted. % cc: panic 3011:
9
26035
by: Cathy | last post by:
I am using a System.Data.SqlClient.SqlConnection to connect to a SQL Server 2005 database. I instantiate the SqlConnection with a connection string... SqlConnection sqlConn = new SqlConnection(@"Network Library=DBMSSOCN;Data Source=(local)" + ",1433;Database=CATHYDB;User id=cathy;Password=pswd;"); When this code runs I can guarantee that everything about it will be
0
1165
by: pk2068 | last post by:
Hello. I would like to have a built-in ALSA support for my VIA soundcard. When i selected it like a module , all works fine, and the new kernel boots with its appropriate initrd image. BUT, when i selected it like a build-in , the new kernel doesnt boot. It just puts. "kernel panic". I was using kernels from 2.6.15 to 2.6.21. It is interesting that in some releases you even don't have the possibility to mark an alsa suport vor...
1
1518
by: cpptutor2000 | last post by:
I am trying to debug some kernel software and running into a kernel panic problem. The OS is Linux 2.6.18 and I am running on a PMC-Sierra processor. When the kernel panic occurs, there is a call trace. Now as this is an embedded system application, my only debugging statements is to apply debug print statements at appropriate locations and find out how many of them get printed out before the panic occurs. I am starting from the...
0
9456
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9275
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
9713
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8713
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6534
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
5142
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3358
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2666
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.