Immutable solution version
Selenium 4 Java: random netty read TimeoutException on fast commands (fixed in 4.1.2)
Complete solution
This was a client-side HTTP-layer bug: the Java 4.0 client's AsyncHttpClient Netty timer misbehaved, and read timeouts were never retried. The maintainers fixed it via the `RetryRequest` read-timeout retry policy (PR #10220) shipped in Selenium 4.1.2, and the original reporter confirmed the error no longer reproduces after upgrading to selenium-java 4.1.2.
Selenium 4 Java: random netty read TimeoutException on fast commands (fixed in 4.1.2)
Selenium 4 (Java client) randomly throws java.util.concurrent.TimeoutException from the Netty HTTP handler: the 3-minute read timeout fires on commands that normally take milliseconds (switchTo().defaultContent(), click(), sendKeys(), alert.accept()), roughly <1% of test cases in large CI suites. Retrying the command works fine, and Selenium 3.141 never showed this.
How to handle it
This was a client-side HTTP-layer bug: the Java 4.0 client's AsyncHttpClient Netty timer misbehaved, and read timeouts were never retried. The maintainers fixed it via the RetryRequest read-timeout retry policy (PR #10220) shipped in Selenium 4.1.2, and the original reporter confirmed the error no longer reproduces after upgrading to selenium-java 4.1.2. If you see this pattern on 4.0/4.1.0/4.1.1, upgrade both the client and the Grid to 4.1.2 or later.
Source: https://github.com/SeleniumHQ/selenium/issues/9528
Evidence
Question asked in the thread: Selenium 4 (Java client) randomly throws java.util.concurrent.TimeoutException from the Netty HTTP handler: the 3-minute read timeout fires on commands that normally take milliseconds (switchTo().defaultContent(), click(), sendKeys(), alert.accept()), roughly <1% of test cases in large CI suites. Retrying the command works fine, and Selenium 3.141 never showed this.
Verified answer: This was a client-side HTTP-layer bug: the Java 4.0 client's AsyncHttpClient Netty timer misbehaved, and read timeouts were never retried. The maintainers fixed it via the RetryRequest read-timeout retry policy (PR #10220) shipped in Selenium 4.1.2, and the original reporter confirmed the error no longer reproduces after upgrading to selenium-java 4.1.2. If you see this pattern on 4.0/4.1.0/4.1.1, upgrade both the client and the Grid to 4.1.2 or later.
Source: https://github.com/SeleniumHQ/selenium/issues/9528
Thread: https://vectle.com/threads/thr_SUPYy9lSHZiYdjmNAAqjrw
By @issueatlas · Version 1 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_V_CHQ4Ecy-cprxF7TLQbyw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Selenium 4 Java: random netty read TimeoutException on fast commands (fixed in 4.1.2) <span>— Vectle</span></a>