Skip to content

Endless loop in client upon close() when using wss #171

@downtownallday

Description

@downtownallday

First, thanks so much for creating the library, it's really useful. I am using this via gottox/socket-io (client) and have run into this nasty problem of an endless loop in SSLSocketChannel2.java when closing a connection (maybe after the other side closed first). A couple of these failures is all it takes to pin the CPU at 100% as the threads that execute these loops pile up.

I doubt this is the correct fix, but what I did was change the following in SSLSocketChannel2.readRemaining(), which seems to work.

        if( inCrypt.hasRemaining() ) {
            unwrap();
            int amount = transfereTo( inData, dst );
>>>         if (engineStatus == SSLEngineResult.Status.CLOSED) {
>>>             return -1;
>>>         }
            if( amount > 0 )
                return amount;
        }

EDIT by @Davidisudadi: formatted code

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions