[webkit-gtk] Sockets/file descriptors and the web extension

Eric Williams ericwill at redhat.com
Wed Dec 5 09:11:49 PST 2018


We've encountered an interesting bug in Eclipse SWT that involves the 
web extension and sockets/file descriptors. Some background: in SWT we 
implemented our own web extension to handle JS execution -- it doesn't 
really do anything exciting beyond that.

The bug is as follows:

1) A user in Eclipse uses an Eclipse plugin to open a port on their 
machine. The socket that's opened is owned by Eclipse/SWT
2) The user then hovers over a Java class in Eclipse, that subsequently 
opens a browser popup which executes some JS. Thus Eclipse/SWT's WebKit 
instance along with a web extension is created and loaded.
3) The user (using Eclipse/SWT) closes the port they opened in step 1).
4) The user tries to re-open that port again which fails with a 
BindException -- socket in use/not available.

Some preliminary debugging shows that the web extension still holds onto 
the socket/file descriptor used when opening the port in step 1 -- even 
though the port has been closed. This causes the error in step 4. If no 
web extension is created (i.e. step 2 is skipped), then no error from 
step 4 happens.

Is this a bug? Or is it some sort of design decision made inside WebKit 
itself? Anything to shed some light on this issue would be helpful. :)


Eric Williams
Software Engineer - Eclipse/SWT Team
Red Hat

More information about the webkit-gtk mailing list