8.2 pg_freespacemap crash - Mailing list pgsql-bugs

From Dimitri Fontaine
Subject 8.2 pg_freespacemap crash
Date
Msg-id 200904071534.49514.dfontaine@hi-media.com
Whole thread Raw
Responses Re: 8.2 pg_freespacemap crash  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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

pgsql-bugs by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: postgresql-8.3.6-1PGDG : redirect_stderr = on does not start server
Next
From: Tom Lane
Date:
Subject: Re: PostgreSQL 8.3.7: soundex function returns UTF-16 characters