Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust keepAlive for test under JDK 9 [ci: last-only] #10732

Open
wants to merge 3 commits into
base: 2.13.x
Choose a base branch
from

Conversation

som-snytt
Copy link
Contributor

@som-snytt som-snytt commented Mar 27, 2024

Fixes scala/scala-dev#864

The test waits for the pool thread to terminate instead of interrupting it, probably to ensure that the thread wasn't planning on issuing spurious reports of exceptional circumstances.

The existing test used the default FJP available under JDK 8, which has a default keep-alive of 60 seconds, or one year in DX time.

This commit reflectively creates a FJP under JDK 9+ with a short keep-alive, or uses a simple thread pool executor otherwise.

@scala-jenkins scala-jenkins added this to the 2.13.15 milestone Mar 27, 2024
@som-snytt som-snytt force-pushed the sd/864-concur branch 2 times, most recently from 436d7a7 to e9f8ec6 Compare March 28, 2024 01:34
@som-snytt som-snytt marked this pull request as ready for review March 29, 2024 16:14
@som-snytt
Copy link
Contributor Author

@lrytz this is quite tiresome. My review is that it should skip the test on JDK 8, but the twist is that the offending sub-test should be split into a separate test file with java: jdk9+.

Copy link
Member

@lrytz lrytz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is quite tiresome

I bet..!

LGTM in general.

Comment on lines 1090 to 1110
new ExecutionContextExecutorService {
// Members declared in scala.concurrent.ExecutionContext
def reportFailure(cause: Throwable): Unit = report(null, cause)

// Members declared in java.util.concurrent.Executor
def execute(r: Runnable): Unit = fjp.execute(r)

// Members declared in java.util.concurrent.ExecutorService
def awaitTermination(x$1: Long, x$2: java.util.concurrent.TimeUnit): Boolean = ???
def invokeAll[T](x$1: java.util.Collection[_ <: java.util.concurrent.Callable[T]], x$2: Long, x$3: java.util.concurrent.TimeUnit): java.util.List[java.util.concurrent.Future[T]] = ???
def invokeAll[T](x$1: java.util.Collection[_ <: java.util.concurrent.Callable[T]]): java.util.List[java.util.concurrent.Future[T]] = ???
def invokeAny[T](x$1: java.util.Collection[_ <: java.util.concurrent.Callable[T]], x$2: Long, x$3: java.util.concurrent.TimeUnit): T = ???
def invokeAny[T](x$1: java.util.Collection[_ <: java.util.concurrent.Callable[T]]): T = ???
def isShutdown(): Boolean = fjp.isShutdown
def isTerminated(): Boolean = fjp.isTerminated
def shutdown(): Unit = fjp.shutdown()
def shutdownNow(): java.util.List[Runnable] = fjp.shutdownNow()
def submit(r: Runnable): java.util.concurrent.Future[_] = fjp.submit(r)
def submit[T](task: Runnable, res: T): java.util.concurrent.Future[T] = fjp.submit(task, res)
def submit[T](task: java.util.concurrent.Callable[T]): java.util.concurrent.Future[T] = fjp.submit(task)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does ExecutionContext.fromExecutorService(fjp, report(null, _)) not work as expected here?

@som-snytt som-snytt force-pushed the sd/864-concur branch 3 times, most recently from 78ff43a to 5986bc0 Compare April 9, 2024 15:30
@som-snytt
Copy link
Contributor Author

the previous failure was spurious, so rebased.

@SethTisue SethTisue added the internal not resulting in user-visible changes (build changes, tests, internal cleanups) label Apr 9, 2024
@som-snytt
Copy link
Contributor Author

I wonder if the spurious errors are due to using a spuriously ancient JDK.

[info] [info] compiling 1 Scala source and 1 Java source to /tmp/sbt_3b38204f/target/classes ...
[info] #
[info] # A fatal error has been detected by the Java Runtime Environment:
[info] #
[info] #  SIGBUS (0x7) at pc=0x00007f62579ddfad, pid=21674, tid=0x00007f61f7afc700
[info] #
[info] # JRE version: OpenJDK Runtime Environment (8.0_332-b09) (build 1.8.0_332-8u332-ga-1~deb9u1-b09)
[info] # Java VM: OpenJDK 64-Bit Server VM (25.332-b09 mixed mode linux-amd64 compressed oops)
[info] # Problematic frame:
[info] # C  [libzip.so+0x4fad]
[info] #
[info] # Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
[info] #
[info] # An error report file with more information is saved as:
[info] # /tmp/sbt_3b38204f/hs_err_pid21674.log
[info] Compiled method (nm)   72113   85     n 0       java.util.zip.ZipFile::getEntry (native)
[info]  total in heap  [0x00007f6248b12b90,0x00007f6248b12f00] = 880
[info]  relocation     [0x00007f6248b12cb8,0x00007f6248b12d00] = 72
[info]  main code      [0x00007f6248b12d00,0x00007f6248b12f00] = 512
[info] #
[info] # If you would like to submit a bug report, please visit:
[info] #   http://bugreport.java.com/bugreport/crash.jsp
[info] # The crash happened outside the Java Virtual Machine in native code.
[info] # See problematic frame for where to report the bug.
[info] #
[error] x apiinfo/circular-structure 
[error]  Cause of test exception: {line 4}  Command failed

@som-snytt som-snytt changed the title Adjust keepAlive for test under JDK 9 Adjust keepAlive for test under JDK 9 [ci: last-only] Apr 11, 2024
@som-snytt
Copy link
Contributor Author

This might also be intermittent

# starting 45 tests in presentation
...............X.............................
!!  1 - presentation/doc                          [output differs][duration 8.90s]
% diff /home/jenkins/workspace/scala-2.13.x-validate-main/test/files/presentation/doc.check /home/jenkins/workspace/scala-2.13.x-validate-main/test/files/presentation/doc-presentation.log
@@ -1 +1,3 @@
 reload: Base.scala, Class.scala, Derived.scala
+Unexpected Derived class comment:None
+Unexpected foo method comment:None

@som-snytt
Copy link
Contributor Author

/rebuild

@lrytz
Copy link
Member

lrytz commented Apr 15, 2024

Yes, presentation/doc failing with None happens from time to time; probably worth a scala-dev ticket.

@som-snytt
Copy link
Contributor Author

it's already known, infamously, as "the less famous flaky test".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal not resulting in user-visible changes (build changes, tests, internal cleanups)
Projects
None yet
4 participants