Hi,

While investigating testshm failures in APR 1.7.6 on Windows x64, I saw
the following with a named shared memory segment:

1. Create a segment and write a value into it.
2. Call apr_shm_remove() by filename. It returns APR_SUCCESS and the
   backing file disappears.
3. Call apr_shm_attach() with the same filename. It also returns
   APR_SUCCESS, and the new attachment can read the original value.

I saw the same behavior with apr_shm_delete(). The API docs warn that
creating another segment with the same name can fail, but describe
removal as preventing new attachments. It's the successful attach in
step 3, not the failed recreation, that I'm unsure about.

For context, three cases failed in the 1.7.6 testshm run.
test_named_remove failed first: after successful removal, its attempt
to create a new segment with the same name returned APR_EEXIST. The
test then returned before destroying the original mapping.
test_named_delete and test_named_perms reused that name and failed at
their initial create calls, before testing deletion or permissions.
On trunk the Windows removal tests call apr_shm_destroy() instead, so
they don't exercise the sequence above.

Should a successful apr_shm_remove() or apr_shm_delete() on Windows
guarantee that a fresh apr_shm_attach() cannot reach the old segment?
If Windows can't provide that guarantee for a live mapping, should
apr_shm_remove() still support cleaning up a stale backing file when
no mapping is live?

Thanks,
Andreas

Reply via email to