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

Bug 552015

Summary: [console] Streams closed notification send to late if input is connected to file
Product: [Eclipse Project] Platform Reporter: Paul Pazderski <paul-eclipse>
Component: DebugAssignee: Paul Pazderski <paul-eclipse>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: sarika.sinha
Version: 4.12   
Target Milestone: 4.14 M3   
Hardware: All   
OS: All   
See Also: https://git.eclipse.org/r/150922
https://git.eclipse.org/c/platform/eclipse.platform.debug.git/commit/?id=154876b4fe661e138d81eebed0fe2e41da7da86a
https://git.eclipse.org/r/152138
https://git.eclipse.org/c/platform/eclipse.platform.debug.git/commit/?id=cb886eecb5f665d6955c50857c164d50abc2cf88
Whiteboard:
Bug Depends on:    
Bug Blocks: 552030    

Description Paul Pazderski CLA 2019-10-10 18:49:28 EDT
After all connected streams are closed and all console related work is done the TextConsole sends an 'output complete' notification. If the process input is received from interactive user input this notification is send short after program termination. If the process input is connected to a file the notification is not send on program termination but after the console is removed from view.

This can be reproduced by running a program once connected to a file as input and once connected to user input. The IOConsolePage use the 'output complete' notification to set the console read-only after the program ends. If the program was connected to a file as input the console is still writable after termination. If connected to interactive user input the console is read-only after termination.
Comment 1 Eclipse Genie CLA 2019-10-10 18:50:55 EDT
New Gerrit change created: https://git.eclipse.org/r/150922
Comment 3 Sarika Sinha CLA 2019-11-06 06:56:20 EST
https://download.eclipse.org/eclipse/downloads/drops4/I20191105-1800/testresults/html/org.eclipse.debug.tests_ep414I-unit-cen64-gtk3-java11_linux.gtk.x86_64_11.html

testProcessTerminationNotificationWithInputFile	Failure	Test triggered errors. expected:<0> but was:<1>

junit.framework.AssertionFailedError: Test triggered errors. expected:<0> but was:<1>
at junit.framework.Assert.fail(Assert.java:57)
at junit.framework.Assert.failNotEquals(Assert.java:329)
at junit.framework.Assert.assertEquals(Assert.java:78)
at junit.framework.Assert.assertEquals(Assert.java:234)
at junit.framework.TestCase.assertEquals(TestCase.java:401)
at org.eclipse.debug.tests.console.ProcessConsoleTests.tearDown(ProcessConsoleTests.java:85)
at junit.framework.TestCase.runBare(TestCase.java:146)
Comment 4 Paul Pazderski CLA 2019-11-06 07:23:25 EST
Thank you Sarika, I'll investigate. I assume the failure is not directly related to this change.

Related stack trace from log is:

java.io.IOException: Stream Closed
	at java.base/java.io.FileInputStream.readBytes(Native Method)
	at java.base/java.io.FileInputStream.read(FileInputStream.java:279)
	at java.base/sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284)
	at java.base/sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326)
	at java.base/sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
	at java.base/java.io.InputStreamReader.read(InputStreamReader.java:185)
	at java.base/java.io.Reader.read(Reader.java:229)
	at org.eclipse.debug.internal.ui.views.console.ProcessConsole$InputReadJob.run(ProcessConsole.java:788)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Comment 5 Eclipse Genie CLA 2019-11-06 08:40:09 EST
New Gerrit change created: https://git.eclipse.org/r/152138
Comment 6 Paul Pazderski CLA 2019-11-06 08:41:54 EST
If input stream is closed before the InputReadJob had a chance to start it can produce this "Stream Closed" exception.

The change improve this and should fix the test failure.