"template1" being accessed by other users

Started by Michael P. Soulierover 18 years ago4 messagesgeneral
Jump to latest
#1Michael P. Soulier
michael_soulier@mitel.com

Hi,

We're using postgres on a server where everything is automated, no human
interaction save a web interface.

I have an issue where a post-install script tries to create a database,
and in 1 out of 10 cases I get this:

"createdb: database creation failed: ERROR: source database "template1"
is being accessed by other users"

It is unclear what is using template1 at that time, logs say nothing but
that doesn't mean it isn't happening.

Can createdb block until template1 is available? Again, there's no human
sitting at the box to intervene. This must complete, eventually.

Thanks,
Mike
--
Michael P. Soulier <michael_soulier@mitel.com>, 613-592-2122 x2522
"Any intelligent fool can make things bigger and more complex... It
takes a touch of genius - and a lot of courage to move in the opposite
direction." --Albert Einstein

#2louis gonzales
gonzales@linuxlouis.net
In reply to: Michael P. Soulier (#1)
Re: "template1" being accessed by other users

Not sure, but sounds like a max user connections is preventing successive
connections?

On Thu, 19 Jul 2007, Michael P. Soulier wrote:

Hi,

We're using postgres on a server where everything is automated, no human
interaction save a web interface.

I have an issue where a post-install script tries to create a database,
and in 1 out of 10 cases I get this:

"createdb: database creation failed: ERROR: source database "template1"
is being accessed by other users"

It is unclear what is using template1 at that time, logs say nothing but
that doesn't mean it isn't happening.

Can createdb block until template1 is available? Again, there's no human
sitting at the box to intervene. This must complete, eventually.

Thanks,
Mike

--
Louis Gonzales
louis.gonzales@linuxlouis.net
http://www.linuxlouis.net

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Michael P. Soulier (#1)
Re: "template1" being accessed by other users

"Michael P. Soulier" <michael_soulier@mitel.com> writes:

I have an issue where a post-install script tries to create a database,
and in 1 out of 10 cases I get this:
"createdb: database creation failed: ERROR: source database "template1"
is being accessed by other users"

Try inserting a short sleep before the createdb.

Can createdb block until template1 is available?

For 8.3 we have
http://archives.postgresql.org/pgsql-committers/2007-06/msg00013.php

regards, tom lane

#4Michael P. Soulier
michael_soulier@mitel.com
In reply to: Tom Lane (#3)
Re: "template1" being accessed by other users

Tom Lane wrote:

Try inserting a short sleep before the createdb.

Oh, so I'd be working around a known race condition? Is there a bug open?

For 8.3 we have
http://archives.postgresql.org/pgsql-committers/2007-06/msg00013.php

Ok, thanks.

Mike
--
Michael P. Soulier <michael_soulier@mitel.com>, 613-592-2122 x2522
"Any intelligent fool can make things bigger and more complex... It
takes a touch of genius - and a lot of courage to move in the opposite
direction." --Albert Einstein