Re: margay fails assertion in stats/dsa/dsm code

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: margay fails assertion in stats/dsa/dsm code
Дата
Msg-id CA+TgmobJ4bSLqxQmtc+8nEAZuwRtMNUdqaTX0ZEKPXi7XwF-fg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: margay fails assertion in stats/dsa/dsm code  (Thomas Munro <thomas.munro@gmail.com>)
Ответы Re: margay fails assertion in stats/dsa/dsm code  (Thomas Munro <thomas.munro@gmail.com>)
Список pgsql-hackers
On Wed, Jun 29, 2022 at 12:01 AM Thomas Munro <thomas.munro@gmail.com> wrote:
> As for whether PostgreSQL needs to do anything, perhaps we should
> ereport for this unexpected error as a matter of self-preservation, to
> avoid the NULL dereference you'd presumably get on a non-cassert build
> with the current coding?  Maybe just:
>
> -               if (errno != EEXIST)
> +               if (op == DSM_OP_ATTACH || errno != EEXIST)
>                         ereport(elevel,
>                                         (errcode_for_dynamic_shared_memory(),
>                                          errmsg("could not open shared
> memory segment \"%s\": %m",
>
> margay would probably still fail until that underlying problem is
> addressed, but less mysteriously on our side at least.

That seems like a correct fix, but maybe we should also be checking
the return value of dsm_impl_op() e.g. define dsm_impl_op_error() as
an inline function that does if (!dsm_impl_op(..., ERROR)) elog(ERROR,
"the author of dsm.c is not as clever as he thinks he is").

-- 
Robert Haas
EDB: http://www.enterprisedb.com



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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: Hardening PostgreSQL via (optional) ban on local file system access
Следующее
От: Michel Pelletier
Дата:
Сообщение: PATCH: Add Table Access Method option to pgbench