Skip to content

Stop dataization on an interrupted thread - #6671

Merged
yegor256 merged 1 commit into
masterfrom
6670
Aug 12, 2026
Merged

Stop dataization on an interrupted thread#6671
yegor256 merged 1 commit into
masterfrom
6670

Conversation

@yegor256

Copy link
Copy Markdown
Member

A test that outlives eo.deadline gets skipped, but its work does not stop: JUnit interrupts the thread and never joins it, and nothing in dataization ever looked at the interrupt flag. PhDefault.take() now checks it and throws the new ExInterrupted on the very next attribute lookup. The flag is read, not cleared, so every later lookup fails the same way and an EO-level try cannot bring the computation back to life.

Without this, every skipped test left a non-daemon junit-timeout-thread spinning for the rest of the fork. They pile up, starve the runner, and then tests that need a few hundred milliseconds start overrunning their wall-clock deadline too and leak threads of their own — which is how the runtime job ends up skipping whole classes at once and getting cancelled at the 30-minute limit. With a 1s deadline, eight endless dataizations used to leave eight live threads behind; now they leave none. ExInterruptedTest reproduces it: without the guard the interrupted thread is still taking attributes when the test gives up on it.

One thing to keep in mind: the deadline is still measured in wall clock under parallel execution, so eo.deadline=1 will keep skipping tests that are merely slow rather than stuck. That value probably wants raising, but it is a separate decision.

Closes #6670

The deadline of a test only interrupts its thread and never joins it,
while nothing in dataization ever polled the interrupt flag. Every test
the deadline skipped therefore left a thread spinning for the rest of
the fork, starving the runner until the whole job was cancelled.

PhDefault.take() now throws ExInterrupted when the current thread
carries the flag. The flag stays up, so every next lookup fails the
same way and no try can resurrect the computation.
Copilot AI lite review requested due to automatic review settings August 12, 2026 14:05
@sonarqubecloud

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR ensures EO dataization stops promptly when a JUnit timeout interrupts the executing thread, preventing runaway computations from leaking long-lived junit-timeout-thread-* threads during eo.deadline-skipped tests.

Changes:

  • Add an interrupt-flag guard in PhDefault.take() that throws ExInterrupted on the next attribute lookup.
  • Introduce ExInterrupted as a dedicated runtime exception for interrupted-thread dataization.
  • Add ExInterruptedTest to reproduce/validate that interrupted attribute lookup terminates the computation thread.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
eo-runtime/src/main/java/org/eolang/PhDefault.java Checks Thread.currentThread().isInterrupted() in take() and aborts dataization by throwing ExInterrupted.
eo-runtime/src/main/java/org/eolang/ExInterrupted.java Adds a new exception type used to terminate interrupted-thread computations.
eo-runtime/src/test/java/org/eolang/ExInterruptedTest.java Adds a regression test ensuring interrupted attribute lookup stops promptly.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +30 to +36
/**
* Ctor.
* @param cause Exception cause
*/
public ExInterrupted(final String cause) {
super(cause);
}
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Performance Analysis

All benchmarks are within the acceptable range. No critical degradation detected (threshold is 100%). Please refer to the detailed report for more information.

Click to see the detailed report
Test Base Score PR Score Change % Change Unit Mode
benchmarks.XslBench.manySheetsOnLargeXmir 908.103 943.364 35.261 3.88% ms/op Average Time

⚠️ Performance loss: benchmarks.XslBench.manySheetsOnLargeXmir is slower by 35.261 ms/op (3.88%)

@github-actions

Copy link
Copy Markdown
Contributor

These counts changed in this branch,
while the lower each one of them, the better:

Metric master branch change
statics 604 605 +1

They are defined in .github/workflows/counts.yml

@github-actions github-actions Bot added the counts Some counts changed in this PR label Aug 12, 2026
@yegor256
yegor256 merged commit 2e9427b into master Aug 12, 2026
31 checks passed
@yegor256
yegor256 deleted the 6670 branch August 12, 2026 14:32
@0crat

0crat commented Aug 12, 2026

Copy link
Copy Markdown

@yegor256 Thanks for the contribution! You've earned +8 points for this: +16 as a basis; -8 for the lack of code review. Please, keep them coming. Your running score is +2882; don't forget to check your Zerocracy account too).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

counts Some counts changed in this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

eo.deadline skips a test but never stops it, leaking one runaway thread per skip

3 participants