Skip to content

Commit

Permalink
Workaround coveralls upload failure on Travis CI
Browse files Browse the repository at this point in the history
Our Travis CI builds are configured to run the Gradle `coveralls` task
to upload test coverage information to coveralls.io.

However, when our Travis CI builds are also configured to use JDK 11,
the following error occurs when running the `coveralls` task:

    > Task :coveralls FAILED
    service name: travis-ci
    service job id: 520624518
    repo token: null

    FAILURE: Build failed with an exception.

    * What went wrong:
    Execution failed for task ':coveralls'.
    > javax.net.ssl.SSLProtocolException: Connection reset by peer (Write failed)

This is because JDK 11 implements support for TLS v1.3 [1], and will
attempt to use it if the server also supports it (coveralls.io does).
However, a bug [2] in its TLS v1.3 implementation causes it to send
invalid data to coveralls.io. When coveralls.io receives this invalid
data, it terminates the connection, hence the error occurs.

Let's workaround this problem by disabling TLS v1.3 support in the JDK.
This workaround should be fine for now, since not many servers support
TLS v1.3 yet as the TLS v1.3 spec was only published on Aug 2018 [3].
Furthermore, JDK developers have already acknowledged the bug [2] and
targeted its fix for JDK 13 (i.e. in the near future).

[1] http://openjdk.java.net/jeps/332
[2] https://bugs.openjdk.java.net/browse/JDK-8221253
[3] https://en.wikipedia.org/wiki/Transport_Layer_Security#TLS_1.3

Co-authored-by: Paul Tan <[email protected]>
  • Loading branch information
fzdy1914 and pyokagan committed May 3, 2019
1 parent 4773ae8 commit 09837d9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
org.gradle.parallel=false
org.gradle.jvmargs=-XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -Xmx1024m -Dfile.encoding=utf-8

# TODO: This is a workaround for a JDK11 bug which causes test coverage upload to fail.
# Remove it when https://bugs.openjdk.java.net/browse/JDK-8221253 is fixed.
systemProp.jdk.tls.client.protocols="TLSv1,TLSv1.1,TLSv1.2"

0 comments on commit 09837d9

Please sign in to comment.