Re: BUG #4941: pg_stat_statements crash
От | Itagaki Takahiro |
---|---|
Тема | Re: BUG #4941: pg_stat_statements crash |
Дата | |
Msg-id | 20090727103830.E3CA.52131E4D@oss.ntt.co.jp обсуждение исходный текст |
Ответ на | BUG #4941: pg_stat_statements crash ("" <alr.nospamforme@gmail.com>) |
Ответы |
Re: BUG #4941: pg_stat_statements crash
|
Список | pgsql-bugs |
"" <alr.nospamforme@gmail.com> wrote: > Bug reference: 4941 > PostgreSQL version: 8.4.0 > Operating system: windows 2008,2003 > Description: pg_stat_statements crash > crash every time after that even with reboots. I researched the issue, and found pgss_shmem_startup() is called for each connection establishment. Then, shared structure might corrupt because we read dumpfile into memory without any locks. The problem seems to come from EXEC_BACKEND; shmem_startup_hook is called only once on POSIX platforms, but many times on Windows. We should call [Read dumpfile] routine only once even on Windows. How about executing the routine during AddinShmemInitLock is taken? The best solution might be to call shmem_startup_hook only once every platforms, but it is difficult without fork(). [8.4.0] pgss_shmem_startup(void) { LWLockAcquire(AddinShmemInitLock, LW_EXCLUSIVE); pgss = ShmemInitStruct("pg_stat_statements" &found); if (!found) { [Initialize shared memory]; } LWLockRelease(AddinShmemInitLock); [Read dumpfile]; } [To be] pgss_shmem_startup(void) { LWLockAcquire(AddinShmemInitLock, LW_EXCLUSIVE); pgss = ShmemInitStruct("pg_stat_statements" &found); if (!found) { [Initialize shared memory]; [Read dumpfile]; } LWLockRelease(AddinShmemInitLock); } Regards, --- ITAGAKI Takahiro NTT Open Source Software Center
В списке pgsql-bugs по дате отправления: