Обсуждение: waiting for lock?

Поиск
Список
Период
Сортировка

waiting for lock?

От
Lennert Buytenhek
Дата:
Hi,

this evening I found a whole bunch of cron jobs hanging on a VACUUM of a
database. I killed them off and retried manually:

ulsec=> vacuum;
NOTICE:  Skipping "pg_type" --- only table owner can VACUUM it
NOTICE:  Skipping "pg_attribute" --- only table owner can VACUUM it
NOTICE:  Skipping "pg_proc" --- only table owner can VACUUM it
NOTICE:  Skipping "pg_class" --- only table owner can VACUUM it
NOTICE:  Skipping "pg_indexes" --- only table owner can VACUUM it
NOTICE:  Skipping "pg_group" --- only table owner can VACUUM it
NOTICE:  Skipping "pg_database" --- only table owner can VACUUM it
NOTICE:  Skipping "pg_attrdef" --- only table owner can VACUUM it
NOTICE:  Skipping "pg_relcheck" --- only table owner can VACUUM it
NOTICE:  Skipping "pg_trigger" --- only table owner can VACUUM it
NOTICE:  Skipping "pg_inherits" --- only table owner can VACUUM it
NOTICE:  Skipping "pg_index" --- only table owner can VACUUM it
NOTICE:  Skipping "pg_statistic" --- only table owner can VACUUM it
NOTICE:  Skipping "pg_operator" --- only table owner can VACUUM it
NOTICE:  Skipping "pg_opclass" --- only table owner can VACUUM it
NOTICE:  Skipping "pg_am" --- only table owner can VACUUM it
NOTICE:  Skipping "pg_amop" --- only table owner can VACUUM it
NOTICE:  Skipping "pg_amproc" --- only table owner can VACUUM it
NOTICE:  Skipping "pg_language" --- only table owner can VACUUM it
NOTICE:  Skipping "pg_aggregate" --- only table owner can VACUUM it
NOTICE:  Skipping "pg_ipl" --- only table owner can VACUUM it
NOTICE:  Skipping "pg_inheritproc" --- only table owner can VACUUM it
NOTICE:  Skipping "pg_rewrite" --- only table owner can VACUUM it
NOTICE:  Skipping "pg_listener" --- only table owner can VACUUM it
NOTICE:  Skipping "pg_description" --- only table owner can VACUUM it
NOTICE:  Skipping "pg_shadow" --- only table owner can VACUUM it
NOTICE:  Skipping "pg_user" --- only table owner can VACUUM it
NOTICE:  Skipping "pg_rules" --- only table owner can VACUUM it



And there it hangs.

strace reveals that the corresponding postgres process on the server hangs
on:

semop(10241, 0xbfffe924, 1


If you send psql a SIGINT, it returns with:

NOTICE:  Skipping "pg_rules" --- only table owner can VACUUM it
Cancel request sent
ERROR:  Query cancel requested while waiting lock
ulsec=>


When this happened, no other clients were accessing the database.
Restarting the server (postgresql 7.0.2) cured all. Anyone knows what's
going on there?



/Lennert

Re: waiting for lock?

От
Tom Lane
Дата:
Lennert Buytenhek <buytenh@gnu.org> writes:
> If you send psql a SIGINT, it returns with:
> NOTICE:  Skipping "pg_rules" --- only table owner can VACUUM it
> Cancel request sent
> ERROR:  Query cancel requested while waiting lock
> ulsec=>

> Restarting the server (postgresql 7.0.2) cured all.

Hmph.  Something quit and left a lock set on some table (whatever
VACUUM would've come to after pg_rules), it looks like.  Could be
an artifact of the known bug in 7.0.* that shared memory state isn't
properly cleaned up when a client disconnects in the middle of a
BEGIN block.  That's fixed for 7.0.3, if we ever quit arguing and
push it out the door ;-)

            regards, tom lane