kohlschutter / junixsocket

Unix Domain Sockets in Java 7 and newer (AF_UNIX), AF_TIPC, AF_VSOCK, and more
Apache License 2.0
433 stars 114 forks source link

Bug: AcceptTimeoutTest fails with Oracle JDK11 on openSUSE Leap 15.1 #63

Closed sriemer closed 4 years ago

sriemer commented 5 years ago

I've tried to compile from latest master commit eeeda32b0a6dc2abae6d7f084ec875d7a14fda6a with openSUSE Leap 15.0, Oracle JDK 11.0.2, Maven 3.6.0, and clang but it fails due to multiple issues. I followed https://kohlschutter.github.io/junixsocket/building.html

First issue bug in the C code:

Starting Core 0 with 1 source files...
[ERROR] c/org_newsclub_net_unix_NativeUnixSocket.c:197:22: error: comparison of unsigned enum expression < 0 is always false [-Werror,-Wtautological-compare]
[ERROR]     if(exceptionType < 0 || exceptionType >= kExceptionMaxExcl) {
[ERROR]        ~~~~~~~~~~~~~ ^ ~
[ERROR] 1 error generated.

Fix: Drop the ineffective check.

Then I always get the same javadoc issue (also with JDK12):

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:3.0.1:jar (attach-javadocs) on project junixsocket-native-common: MavenReportException: Error while generating Javadoc: 
[ERROR] Exit code: 1 - javadoc: error - The code being documented uses modules but the packages defined in https://docs.oracle.com/javase/9/docs/api/ are in the unnamed module.
[ERROR] 
[ERROR] Command line was: /usr/java/jdk11/bin/javadoc @options @packages @argfile
[ERROR] 
[ERROR] Refer to the generated Javadoc files in '/data/work/junixsocket_spars/junixsocket-native-common/target/apidocs' dir.

Workaround: Don't care for javadoc, replace it with a simple shell script faking success:

#!/bin/bash
exit 0

Then, the AcceptTimeoutTest fails:

[ERROR] Failures: 
[ERROR]   AcceptTimeoutTest.lambda$testTimeoutAfterDelay$1:74 We should get the same timeout back that we set before ==> expected: <250> but was: <252>
[INFO] 
[ERROR] Tests run: 36, Failures: 1, Errors: 0, Skipped: 0

Workaround: Change timeoutMillis from 250 to 252.

Does anybody else have better workarounds?

@kohlschuetter Can you please look into these issues? TIA

sriemer commented 5 years ago

Better workaround for javadoc: Just compile with:

mvn clean install -Dmaven.javadoc.skip=true
kohlschuetter commented 4 years ago

Partial fix in d6f4ef1493dc99b5fc8c3875a21d53dee4775a83 (negative value for enum).

Regarding the timeout: I don't see why adjusting the timeout by 2 milliseconds would make the test pass reliably, please explain.

javadoc: This should have been fixed through other changes recently, but yes, using mvn clean install -Dmaven.javadoc.skip=true is the "correct" workaround

sriemer commented 4 years ago

Thanks, @kohlschuetter. I can confirm that the AcceptTimeoutTest is the only remaining issue after a test on openSUSE Leap 15.1 with Oracle JDK 11.0.5. Setting the timeout to 252 ms still works. Will look deeper to find the root cause of the test failure.

kohlschuetter commented 4 years ago

Please verify on junixsocket 2.3.0. Thanks!