Open kenz-gelsoft opened 19 hours ago
I'll try porting these logic tonight. I hope these fixes test failures.
I found that test case fails only when !msg->attachedhandles.IsEmpty(). That test case calls sendmsg() muliple times, but first call fails that !msg->attachedhandles.IsEmpty() after sendmsg().
I guess this is when sending FD before previously sent FDs are received. My debugging in https://github.com/kenz-gelsoft/gecko-dev/issues/49 supports this.
If FDs are closed before processed, they can be recycled for sending another font descriptors, it may look like a shared memory corruption.
It may also result in unreceived file descriptor is required error.
@waddlesplash
This is an answer to your comment at https://github.com/kenz-gelsoft/gecko-dev/issues/34#issuecomment-2311585220
I found firefox's single Unit test (GTest)
IPDLTest_CrossProcess.TestShmem
is smaller test case to reproduce the issue. Test failure is intermittent.I investigated that failure on https://github.com/kenz-gelsoft/gecko-dev/issues/49 (I created this new Issue, as that was very low S/N.)
I found that test case fails only when
!msg->attached_handles_.IsEmpty()
. That test case callssendmsg()
muliple times, but first call fails that!msg->attached_handles_.IsEmpty()
aftersendmsg()
.https://github.com/kenz-gelsoft/gecko-dev/issues/49#issuecomment-2377928216
For the same condition, firefox's IPC code (based on Chromium IPC) has special logic for Darwin(macOS) like this:
For this Darwin(macOS) only code, I looked that git blame and I found 12yr old bugzilla why they introduced this special logic: https://bugzilla.mozilla.org/show_bug.cgi?id=868919#c7
If Haiku's implementation follows to the same spec, it can be POSIX compliant behavior, but application code (firefox IPC code) need to handle early FD close specially for Haiku.
What do you think on this?