Re: "could not reattach to shared memory" on buildfarm member dory
Tom Lane <tgl@sss.pgh.pa.us>
Noah Misch <noah@leadboat.com> writes: > On Tue, Apr 02, 2019 at 10:09:00AM -0400, Tom Lane wrote: >> I worry that your proposed fix is unstable, in particular this assumption >> seems shaky: >>> + * ... The idea is that, if the allocator handed out >>> + * REGION1 pages before REGION2 pages at one occasion, it will do so whenever >>> + * both regions are free. > True. If Windows changes to prefer allocating from the most recently freed > region, shmem-protective-region-v1.patch would cease to help. It's not > impossible. >> I wonder whether it's possible to address this by configuring the "default >> thread pool" to have only one thread? It seems like the extra threads are >> just adding backend startup overhead to no benefit, since we won't use 'em. > I didn't find a way to configure the pool's size. Seems odd ... > Another option is to reattach shared memory earlier, before the default thread > pool starts. A Windows application using only the unavoidable DLLs > (kernel32.dll, ntdll.dll, kernelbase.dll) doesn't get a default thread pool; > the pool starts when one loads ws2_32.dll, ucrtbased.dll, etc. Hence, the > DllMain() function of a DLL that loads early could avoid the problem. (Cygwin > fork() uses that route to remap shared memory, though it also retries failed > forks.) If we proceed that way, we'd add a tiny pg_shmem.dll that appears > early in the load order, just after the unavoidable DLLs. It would extract > applicable parameters from the command line and reattach shared memory. When > it fails, it would set a flag so the usual code can raise an error. Does that > sound more or less attractive than shmem-protective-region-v1.patch? Well, it definitely sounds like more work. Let's not do such work until we have to. Your patch has the advantages of being (a) small and (b) done, and there's much to be said for that. regards, tom lane
Commits
-
Avoid "could not reattach" by providing space for concurrent allocation.
- 203886d3ae22 9.4.22 landed
- f5989b379cef 10.8 landed
- 7a5677818556 9.5.17 landed
- 57ebbbb8f15a 9.6.13 landed
- e45a8ff87149 11.3 landed
- 617dc6d299c9 12.0 landed
-
Assert that pgwin32_signal_initialize() has been called early enough.
- ab9ed9be2378 12.0 landed
-
Remove investigative code for can't-reattach-to-shared-memory errors.
- bcbf2346d69f 11.0 landed
-
Does it help to wait before reattaching?
- 23078689a992 11.0 landed
-
Map and unmap the shared memory block before risking VirtualFree.
- 73042b8d136f 11.0 landed
-
Further effort at preventing memory map dump from affecting the results.
- ce07aff48f15 11.0 landed
-
Remove Windows module-list-dumping code.
- f7df8043f08a 11.0 landed
-
Dump full memory maps around failing Windows reattach code.
- 6ba0cc4bd3a6 11.0 landed
-
Get still more info about Windows can't-reattach-to-shared-memory errors.
- eb16011f4c08 11.0 landed
-
Get more info about Windows can't-reattach-to-shared-memory errors.
- 68e7e973d222 11.0 landed
-
Try to get some info about Windows can't-reattach-to-shared-memory errors.
- 63ca350ef9f5 11.0 landed