Open cffan opened 9 years ago
It might relate to this JVM bug: http://bugs.java.com/bugdatabase/view_bug.do?bug_id=6403933
I tried to call key.selectNow() but it does not fix the problem. However, close the current selector and create a new one solves this problem.
The JVM bug may very well be the same, as OS X/iOS networking is very similar to Linux, since they both are based on Berkeley networking.
On Sun, Oct 25, 2015 at 6:18 PM Steve notifications@github.com wrote:
It might relate to this JVM bug: http://bugs.java.com/bugdatabase/view_bug.do?bug_id=6403933
I tried to call key.selectNow() but it does not fix the problem. However, close the current selector and create a new one solves this problem.
— Reply to this email directly or view it on GitHub https://github.com/google/j2objc/issues/645#issuecomment-150997395.
This can be reproduced using the following test code:
When running this piece of code in Java, it outputs
and then blocks.
If it is translated to objc, it loops forever. If you comment out these two lines, it will block as in Java.
So I guess the SelectionKey.cancel or SocketChannel.close() is not translated properly so that the SelectionKey is not removed.