On 3/25/18 12:11 PM, Alan Bateman wrote:


On 25/03/2018 19:13, Ivan Gerasimov wrote:
:

In the code above, newfd was obtained from a call to accept() a few lines before this check. So, the Java code has no way of being aware of this socket, and it will never be closed unless we do it right here, before returning -1.

The SocketImpl's fd is set with this code:
  (*env)->SetIntField(env, socketFdObj, IO_fd_fdID, fd);

If there is any possibility of returning without a pending exception it will be registered with the cleaner.

Okay.
In the patched TwoStacksPlainSocketImp.c there is no setting FileDescriptor.fd from JNI left, so that the code will be safer in this aspect.

At this point, I think we have to treat all code calling NET_SocketClose as a suspect until the regression is tracked down.

-Alan


--
With kind regards,
Ivan Gerasimov

Reply via email to