[Webkit-unassigned] [Bug 61287] [UNIX] Don't use SOCK_DGRAM in socketpair()

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed May 25 23:46:08 PDT 2011


https://bugs.webkit.org/show_bug.cgi?id=61287





--- Comment #11 from Kimmo Kinnunen <kimmo.t.kinnunen at nokia.com>  2011-05-25 23:46:08 PST ---
(In reply to comment #0)
> While implemeting the plugin process for the GTK port I noticed that when closing a page containing a plugin, the web process got blocked waiting for a sync message reply which was never sent because the plugin process was about to die. 

So the problem here is not the usage of SOCK_DGRAM per se. AFAICS the real problem is that the web process or UI process is not able to observe plugin process crash.

The original intention of the of using SOCK_DGRAM was two-fold:
 - it guarantees that the message is not buffered at any point redundantly (minimum latency)
 - it simplifies implementation greatly

The original solution to the real problem in this bug report was to listen the child process crash by other means.

The original reason of using SOCK_DGRAM instead of SOCK_SEQPACKET was to avoid discussion about Linux specificness of the original patch.

I would advice not using SOCK_STREAM. The main problem I see is the lack of guarantees about buffering and need for receiver to preserve buffers, split messages correctly etc. Also the implementation gets quite complex, as you need to buffer the file descriptors. Anecdotal evidence of this complexity might be for example that the suggested patch leaks file descriptors when connection is closed while the fds are in buffer. (AFAICS from very quick inspection, sorry if I'm wrong). 

Also remember that Mac implementation is dgram-based, so it is very much easier to achieve similar performance characteristics, avoid unnecessary kludging in common parts and maybe even code reuse.

My suggestion would be to (not that it should matter in this point):
 1. Use SOCK_SEQPACKET on Linux, observe crashes with recvmsg == 0
 2. ifdef Non-Linux, use platform specific way of observing child process crash
 3. rename this bug

1. is needed only if you are perfectionist, otherwise only 2. suffices.

To do 2. cross-platform, you can for example open dummy SOCK_STREAM during fork and make that communicate the crash of child process. I would expect this to have much less overhead than redundant buffering of should-not-be-buffered messages.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list