forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit389869a
committed
Harden dsm_impl.c against unexpected EEXIST.
Previously, we trusted the OS not to report EEXIST unless we'd passed inIPC_CREAT | IPC_EXCL or O_CREAT | O_EXCL, as appropriate. Solaris'sshm_open() can in fact do that, causing us to crash because we didn'tereport and then we blithely assumed the mapping was successful.Let's treat EEXIST just like any other error, unless we're actuallytrying to create a new segment. This applies to shm_open(), where thisbehavior has been seen, and also to the equivalent operations for oursysv and mmap modes just on principle.Based on the underlying reason for the error, namely contention on alock file managed by Solaris librt for each distinct name, this problemis only likely to happen on 15 and later, because the new shared memorystats system produces shm_open() calls for the same path frompotentially large numbers of backends concurrently duringauthentication. Earlier releases only shared memory segments between asmall number of parallel workers under one Gather node. You couldprobably hit it if you tried hard enough though, and we should have beenmore defensive in the first place. Therefore, back-patch to allsupported releases.Per build farm animal margay. This isn't the end of the story, though,it just changes random crashes into random "File exists" errors; morework needed for a green build farm.Reviewed-by: Robert Haas <robertmhaas@gmail.com>Discussion:https://postgr.es/m/CA%2BhUKGKqKrCV5xKWfh9rnm%3Do%3DDwZLTLtnsj_XpUi9g5%3DV%2B9oyg%40mail.gmail.com1 parent33bd469 commit389869a
1 file changed
+3
-3
lines changedLines changed: 3 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
261 | 261 |
| |
262 | 262 |
| |
263 | 263 |
| |
264 |
| - | |
| 264 | + | |
265 | 265 |
| |
266 | 266 |
| |
267 | 267 |
| |
| |||
500 | 500 |
| |
501 | 501 |
| |
502 | 502 |
| |
503 |
| - | |
| 503 | + | |
504 | 504 |
| |
505 | 505 |
| |
506 | 506 |
| |
| |||
822 | 822 |
| |
823 | 823 |
| |
824 | 824 |
| |
825 |
| - | |
| 825 | + | |
826 | 826 |
| |
827 | 827 |
| |
828 | 828 |
| |
|
0 commit comments
Comments
(0)