with two debugging sessions, each with multiple threads, should I be able to debug one (non-main) thread doing an accept() and another a connect() ?

I have two debugging sessions,  each with multiple threads, in the same IDE .

Session #1's main Thread #0 does a connect() ( java.net.PlainSocketImpl.connectToAddress(InetAddress address, int port, int timeout) )
while a non-main Thread #3 of Session #2 , marked as a Daemon (detached) thread, is doing an accept() ( via poll() and select() ) , on a
socket bound to the address that Session#1's main thread is trying to connect() to .

But even though I have set a breakpoint just after the poll() in Session #2 ,  at the line marked with an asterisk in
sun/nio/ch/ePollArrayWrapper.class (decompiled source) :

    int poll(long var1) throws IOException {
        this.updated = this.epollWait(this.pollArrayAddress, NUM_EPOLLEVENTS, var1, this.epfd);

*      for(int var3 = 0; var3 < this.updated; ++var3) {
            if(this.getDescriptor(var3) == this.incomingInterruptFD) {

and I step into Session#1's main thread, and see the doConnect() succeeds, and the 'netstat -nautp' command output shows that
Session#1 process has gained a new connection to the address on which Session#2's Thread #3 listens, and that Session#2's process
has gained a new connected socket to Session#1's socket address, the breakpoint is never reached , and both sessions just hang forever .

Is this scenario meant to work or not ?

Is there something I need to do to switch debugging focus from Session#2 Main Thread to its Thread #3 ?  I can't seem to find any way of doing this.

1 comment
Comment actions Permalink

Hi, what IDE version is that on?
I was able to reproduce incorrect sessions switching, see https://youtrack.jetbrains.com/issue/IDEA-142798.
If you switch active session manually (choose correct session tab in debug toolwindow) it should work fine.


Please sign in to leave a comment.