Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 451205

Summary: StandardVMType.parseLibraryInfo doesn't wait for output from LibraryDetector process
Product: [Eclipse Project] JDT Reporter: Alan Staves <alan.staves>
Component: DebugAssignee: Sarika Sinha <sarika.sinha>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: Michael_Rennie, sarika.sinha, simeon.danailov.andreev
Version: 4.4   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard: stalebug

Description Alan Staves CLA 2014-11-12 11:22:55 EST
There is a race condition in StandardVMType.generateLibraryInfo method which can result in the following messages being logged and a null info object being returned:

!ENTRY org.eclipse.jdt.launching 4 4 2014-11-12 16:08:09.933
!MESSAGE Failed to retrieve default libraries for .......

Being a race condition it is difficult to reproduce when running Eclipse but with use of a couple of breakpoints it is quite straight-forward:

1) place a breakpoint on the Debug.newProcess... line in StandardVMType.generateLibraryInfo (e.g. line 627)
2) place a breakpoint on the synchronized(this) line in OutputStreamMonitor.read (e.g. line 153)
3) Debug Eclipse and open the preference page: Java->Installed JREs

The breakpoint in generateLibraryInfo should be hit first, keep stepping this thread and when step the into the line in parseLibraryInfo "text = streamsProxy.getOutputStreamMonitor().getContents();" you will get an empty string returned because the OutputStreamMonitor is stopped on the second breakpoint and has not had the chance to update its fContents field with the output of the LibraryDetector.
Comment 1 Eclipse Genie CLA 2019-01-18 19:32:58 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 2 Sarika Sinha CLA 2019-01-20 23:12:13 EST
@Seimon, Do you want to look at this?
Comment 3 Simeon Andreev CLA 2019-01-21 02:46:41 EST
Pretty sure this is a duplicate of bug 536943.

We have added waiting for the process output to actually be read by the reader thread, see:

https://git.eclipse.org/c/platform/eclipse.platform.debug.git/commit/?id=343e367fc843c77c4cbc5ea46093506eb9602a47
https://git.eclipse.org/c/jdt/eclipse.jdt.debug.git/commit/?id=33c8f2ccb73d4ef00166cd3699d92cc9badba25f

I think this should be fixed for any normal conditions. So probably close as duplicate.
Comment 4 Alan Staves CLA 2019-01-21 06:04:32 EST
I would agree that 536943 was a duplicate of the bug I raised 4 years earlier :-)