Skip to content

Fix Windows Defender status retrieval under Java-25 or later#3994

Merged
HannesWell merged 1 commit intoeclipse-platform:masterfrom
HannesWell:fix-win-defender-java25
May 10, 2026
Merged

Fix Windows Defender status retrieval under Java-25 or later#3994
HannesWell merged 1 commit intoeclipse-platform:masterfrom
HannesWell:fix-win-defender-java25

Conversation

@HannesWell
Copy link
Copy Markdown
Member

@HannesWell HannesWell commented May 10, 2026

In recent Java versions Process.isAlive() seems to report the termination of a process a little bit later then before, relative to the time when the process output reader is closed, which leads to false errors about process time-out.

Fixes errors like:

!MESSAGE Failed to obtain 'WinDefend' service state
!STACK 0
java.io.IOException: Process timed-out and it was attempted to forcefully terminate it
	at org.eclipse.ui.internal.WindowsDefenderConfigurator.runProcess(WindowsDefenderConfigurator.java:395)
	at org.eclipse.ui.internal.WindowsDefenderConfigurator.runPowershell(WindowsDefenderConfigurator.java:369)
	at org.eclipse.ui.internal.WindowsDefenderConfigurator.isWindowsDefenderServiceRunning(WindowsDefenderConfigurator.java:302)
	at org.eclipse.ui.internal.WindowsDefenderConfigurator.runExclusionCheck(WindowsDefenderConfigurator.java:159)
	at org.eclipse.ui.internal.WindowsDefenderConfigurator.lambda$0(WindowsDefenderConfigurator.java:106)
	at org.eclipse.core.runtime.jobs.Job$2.run(Job.java:187)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

I cannot yet tell why, because I haven’t investigated the details yet.

CC @merks and @azoitl
Does this also help for

@HannesWell HannesWell changed the title Fix Windows Defender exclusion check when running with Java-25 or later Fix Windows Defender exclusion check when running on Java-25 May 10, 2026
@HannesWell HannesWell changed the title Fix Windows Defender exclusion check when running on Java-25 Fix Windows Defender status check when running on Java-25 May 10, 2026
@HannesWell HannesWell changed the title Fix Windows Defender status check when running on Java-25 Fix Windows Defender status retrieval under Java-25 or later May 10, 2026
Fixes errors like:
'''
Failed to obtain 'WinDefend' service state
java.io.IOException: Process timed-out and it was attempted to
forcefully terminate it
'''
@HannesWell HannesWell force-pushed the fix-win-defender-java25 branch from 82e6506 to ac4d0af Compare May 10, 2026 07:17
Copy link
Copy Markdown
Contributor

@merks merks left a comment

Choose a reason for hiding this comment

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

It's not so easy to test without a build, I see zero risk in this producing worse behavior given If the process has already terminated then this method returns immediately with the value {@code true}. So it should exactly deal with the case of it taking a while for isAlive to return false, and in the worst case taking 5 second longer to pop up a failure message...

@github-actions
Copy link
Copy Markdown
Contributor

Test Results

   867 files  ±0     867 suites  ±0   55m 8s ⏱️ + 2m 23s
 7 988 tests ±0   7 745 ✅ ±0  243 💤 ±0  0 ❌ ±0 
20 466 runs  ±0  19 811 ✅ ±0  655 💤 ±0  0 ❌ ±0 

Results for commit ac4d0af. ± Comparison against base commit 195df72.

@merks
Copy link
Copy Markdown
Contributor

merks commented May 10, 2026

@HannesWell

If we merge this today, I can more easily test tomorrow's I-build...

@HannesWell
Copy link
Copy Markdown
Member Author

It's not so easy to test without a build,

The check is performed even in a secondary Eclipse, if you remove the inDevelopmentMode() test at

I see zero risk in this producing worse behavior given If the process has already terminated then this method returns immediately with the value {@code true}. So it should exactly deal with the case of it taking a while for isAlive to return false, and in the worst case taking 5 second longer to pop up a failure message...

Absolutely agree. And since it runs asynchronously in a job, its almost free.
So yes lets submit this now so that more I-build users can test this tomorrow.

@HannesWell HannesWell merged commit 83a1f72 into eclipse-platform:master May 10, 2026
18 checks passed
@HannesWell HannesWell deleted the fix-win-defender-java25 branch May 10, 2026 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants