| From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
|---|---|
| To: | Thomas Munro <thomas(dot)munro(at)gmail(dot)com> |
| Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Marcel Hofstetter <hofstetter(at)jomasoft(dot)ch> |
| Subject: | Re: margay fails assertion in stats/dsa/dsm code |
| Date: | 2022-06-30 16:02:21 |
| Message-ID: | CA+TgmobJ4bSLqxQmtc+8nEAZuwRtMNUdqaTX0ZEKPXi7XwF-fg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Wed, Jun 29, 2022 at 12:01 AM Thomas Munro <thomas(dot)munro(at)gmail(dot)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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Michel Pelletier | 2022-06-30 16:09:17 | PATCH: Add Table Access Method option to pgbench |
| Previous Message | Robert Haas | 2022-06-30 15:52:20 | Re: Hardening PostgreSQL via (optional) ban on local file system access |