8.2 pg_freespacemap crash

From: Dimitri Fontaine <dfontaine(at)hi-media(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: 8.2 pg_freespacemap crash
Date: 2009-04-07 13:34:49
Message-ID: 200904071534.49514.dfontaine@hi-media.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,

We've been hit by a pg_freespacemap contrib module crash (SIGSEGV), gdb showed
it was in line 162 of it's pg_freespacemap.c file.
fctx->record[i].reltablespace = fsmrel->key.spcNode;

Thanks to Andrew Gierth (irc:RhodiumToad) and after some analysis and we've
been able to understand what happened: MaxFSMPages is not the maximum number
of elements (tables and indexes) contained into the FSM memory, and the
contrib believes it is.

In fact, AFAUI this number is computed from the max_fsm_pages setting applying
to it the 6 bytes per table. When you put in there some index FSM information,
you need 4 bytes. So you can store more items than max_fsm_pages * 6 bytes.

Please find attached a "stupid" patch for the case not to happen again here, I
suppose you'll want some more refined solution to get into -core.

Regards,
--
dim

PS: of course any faulty reasoning here would be mine, and we still have the
evidences around (core).

Attachment Content-Type Size
13-pg_freespacemap.maxfsmpages.patch text/x-patch 583 bytes

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2009-04-07 14:06:21 Re: PostgreSQL 8.3.7: soundex function returns UTF-16 characters
Previous Message Heikki Linnakangas 2009-04-07 11:08:36 Re: postgresql-8.3.6-1PGDG : redirect_stderr = on does not start server