forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit869f693
committed
On Windows, ensure shared memory handle gets closed if not being used.
Postmaster child processes that aren't supposed to be attached to sharedmemory were not bothering to close the shared memory mapping handle theyinherit from the postmaster process. That's mostly harmless, since thehandle vanishes anyway when the child process exits -- but the sysloggerprocess, if used, doesn't get killed and restarted during recovery from abackend crash. That meant that Windows doesn't see the shared memorymapping as becoming free, so it doesn't delete it and the postmaster isunable to create a new one, resulting in failure to recover from crasheswhenever logging_collector is turned on.Per report from Dmitry Vasilyev. It's a bit astonishing that we'd notfigured this out long ago, since it's been broken from the very beginningsof out native Windows support; probably some previously-unexplained troublereports trace to this.A secondary problem is that on Cygwin (perhaps only in older versions?),exec() may not detach from the shared memory segment after all, in whichcase these child processes did remain attached to shared memory, posingthe risk of an unexpected shared memory clobber if they went off the railssomehow. That may be a long-gone bug, but we can deal with it now if it'sstill live, by detaching within the infrastructure introduced here to dealwith closing the handle.Back-patch to all supported branches.Tom Lane and Amit Kapila1 parent6bcce25 commit869f693
File tree
4 files changed
+116
-25
lines changed- src
- backend
- port
- postmaster
- include/storage
4 files changed
+116
-25
lines changedLines changed: 45 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
195 | 195 |
| |
196 | 196 |
| |
197 | 197 |
| |
198 |
| - | |
| 198 | + | |
199 | 199 |
| |
200 | 200 |
| |
201 | 201 |
| |
| |||
583 | 583 |
| |
584 | 584 |
| |
585 | 585 |
| |
586 |
| - | |
587 |
| - | |
588 |
| - | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
589 | 590 |
| |
590 | 591 |
| |
591 | 592 |
| |
| |||
619 | 620 |
| |
620 | 621 |
| |
621 | 622 |
| |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
622 | 656 |
| |
623 | 657 |
| |
624 | 658 |
| |
625 | 659 |
| |
626 | 660 |
| |
627 | 661 |
| |
628 |
| - | |
629 |
| - | |
630 |
| - | |
631 |
| - | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
632 | 669 |
| |
633 | 670 |
| |
634 | 671 |
| |
|
Lines changed: 66 additions & 16 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
17 | 17 |
| |
18 | 18 |
| |
19 | 19 |
| |
20 |
| - | |
| 20 | + | |
21 | 21 |
| |
22 | 22 |
| |
23 | 23 |
| |
| |||
83 | 83 |
| |
84 | 84 |
| |
85 | 85 |
| |
86 |
| - | |
87 | 86 |
| |
88 | 87 |
| |
89 | 88 |
| |
| |||
115 | 114 |
| |
116 | 115 |
| |
117 | 116 |
| |
118 |
| - | |
119 | 117 |
| |
120 | 118 |
| |
121 | 119 |
| |
| |||
218 | 216 |
| |
219 | 217 |
| |
220 | 218 |
| |
221 |
| - | |
222 |
| - | |
223 |
| - | |
224 | 219 |
| |
225 | 220 |
| |
226 | 221 |
| |
| |||
254 | 249 |
| |
255 | 250 |
| |
256 | 251 |
| |
| 252 | + | |
| 253 | + | |
| 254 | + | |
257 | 255 |
| |
258 | 256 |
| |
259 | 257 |
| |
260 | 258 |
| |
261 | 259 |
| |
262 | 260 |
| |
263 | 261 |
| |
264 |
| - | |
265 |
| - | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
266 | 265 |
| |
267 | 266 |
| |
268 | 267 |
| |
| |||
298 | 297 |
| |
299 | 298 |
| |
300 | 299 |
| |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
301 | 334 |
| |
302 | 335 |
| |
303 | 336 |
| |
304 | 337 |
| |
305 |
| - | |
306 |
| - | |
307 |
| - | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
308 | 345 |
| |
309 | 346 |
| |
310 | 347 |
| |
311 | 348 |
| |
| 349 | + | |
312 | 350 |
| |
313 | 351 |
| |
314 | 352 |
| |
315 |
| - | |
| 353 | + | |
| 354 | + | |
316 | 355 |
| |
317 | 356 |
| |
318 | 357 |
| |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
319 | 368 |
| |
320 | 369 |
| |
321 | 370 |
| |
322 | 371 |
| |
323 |
| - | |
324 |
| - | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
325 | 376 |
| |
326 | 377 |
| |
327 | 378 |
| |
328 | 379 |
| |
| 380 | + | |
329 | 381 |
| |
330 |
| - | |
331 |
| - | |
332 | 382 |
| |
333 | 383 |
| |
334 | 384 |
| |
|
Lines changed: 4 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4628 | 4628 |
| |
4629 | 4629 |
| |
4630 | 4630 |
| |
4631 |
| - | |
| 4631 | + | |
| 4632 | + | |
4632 | 4633 |
| |
4633 | 4634 |
| |
4634 | 4635 |
| |
4635 | 4636 |
| |
4636 | 4637 |
| |
4637 | 4638 |
| |
4638 | 4639 |
| |
| 4640 | + | |
| 4641 | + | |
4639 | 4642 |
| |
4640 | 4643 |
| |
4641 | 4644 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
61 | 61 |
| |
62 | 62 |
| |
63 | 63 |
| |
| 64 | + | |
64 | 65 |
| |
65 | 66 |
| |
66 | 67 |
| |
|
0 commit comments
Comments
(0)