Re: unsafe use of hash_search(... HASH_ENTER ...)

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: unsafe use of hash_search(... HASH_ENTER ...)
Дата
Msg-id 10592.1117165213@sss.pgh.pa.us
обсуждение исходный текст
Ответ на unsafe use of hash_search(... HASH_ENTER ...)  ("Qingqing Zhou" <zhouqq@cs.toronto.edu>)
Список pgsql-hackers
"Qingqing Zhou" <zhouqq@cs.toronto.edu> writes:
> In md.c/RememberFsyncRequest():

>  if (hash_search(pendingOpsTable, &entry, HASH_ENTER, NULL) == NULL)
>   ereport(FATAL,
>     (errcode(ERRCODE_OUT_OF_MEMORY),
>      errmsg("out of memory")));

> pendingOpsTable uses "MdCxt" to allocate memory. So if "out of memory", we
> actually have no chance to raise the error level to FATAL. A quick fix is to
> use malloc() HASH_ALLOC method for pendingOpsTable.

"Unsafe" is a bit of an overstatement, when you evidently haven't
analyzed the consequences of either choice of error level.  That is,
why is this a bug?
        regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Qingqing Zhou"
Дата:
Сообщение: unsafe use of hash_search(... HASH_ENTER ...)
Следующее
От: "Qingqing Zhou"
Дата:
Сообщение: Re: unsafe use of hash_search(... HASH_ENTER ...)