On Ubuntu 22.04 with Linux 6.5, it was observed that when the server gets the SSL records containing the client handshake finished message and the first HTTP GET request in ONE read operation, the latter SSL record is never processed.
Commit 89eaf410dd8fe3845fa6fb0de3469b55da0205cb should have fixed this, but it turned out that when SSLSocketChannel2#processHandshake() is called from SSLSocketChannel2#write(), the second SSL record containing the HTTP GET request is stashed away, but never retrieved, since the calling code in WebSocketServer#doWrite() has no provisions for this, only WebSocketServer#doRead() does.
Change SSLSocketChannel2#processHandshake() to only read from the socket when called from SSLSocketChannel#read(), to ensure that when two SSL records are read, the second one is processed as well.
Related Issue
Fixes #1418
Motivation and Context
Our integration tests which locally connect a WebSocketClient to a WebSocketServer were sporadically failing when run on Ubuntu 22.04 with Linux 6.5 (this never occurred in Ubuntu 20.04 with Linux 5.14).
With this change, the tests run reliably. We have verified from detailed java.net debug logs that when two SSL records are retrieved in one read, they are now both processed.
How Has This Been Tested?
Tested with our internal integration tests.
Types of changes
[x] Bug fix (non-breaking change which fixes an issue)
[ ] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to change)
Checklist:
[x] My code follows the code style of this project.
[ ] My change requires a change to the documentation.
[ ] I have updated the documentation accordingly.
[ ] I have added tests to cover my changes.
[x] All new and existing tests passed. (Issue256Test#runReconnectSocketClose[0] fails before and after this change)
Description
On Ubuntu 22.04 with Linux 6.5, it was observed that when the server gets the SSL records containing the client handshake finished message and the first HTTP GET request in ONE read operation, the latter SSL record is never processed.
Commit 89eaf410dd8fe3845fa6fb0de3469b55da0205cb should have fixed this, but it turned out that when SSLSocketChannel2#processHandshake() is called from SSLSocketChannel2#write(), the second SSL record containing the HTTP GET request is stashed away, but never retrieved, since the calling code in WebSocketServer#doWrite() has no provisions for this, only WebSocketServer#doRead() does.
Change SSLSocketChannel2#processHandshake() to only read from the socket when called from SSLSocketChannel#read(), to ensure that when two SSL records are read, the second one is processed as well.
Related Issue
Fixes #1418
Motivation and Context
Our integration tests which locally connect a WebSocketClient to a WebSocketServer were sporadically failing when run on Ubuntu 22.04 with Linux 6.5 (this never occurred in Ubuntu 20.04 with Linux 5.14).
With this change, the tests run reliably. We have verified from detailed java.net debug logs that when two SSL records are retrieved in one read, they are now both processed.
How Has This Been Tested?
Tested with our internal integration tests.
Types of changes
Checklist: