RFR JDK-8166890: JShell: locks forever when input is piped

Jan Lahoda jan.lahoda at oracle.com
Mon Oct 10 14:19:19 UTC 2016


HI Shinya,

Thanks for the comments!

On 10.10.2016 15:20, ShinyaYoshida wrote:
> Hi Jan,
>
> Thank you for fixing this!
> Your patch works well on my environment!
> Couldn't we write a test case for this?

I was thinking of that, but wasn't sure how to test this.

>
> Trivial:
>    synchronized (StopDetectingInputStream.this) {
> -     state = StopDetectingInputStream.State.CLOSED;
> +     shutdown();
>    }
>
> Is this synchronized block still necessary?
> Could it be removed because shutdown() is a synchronized method?

Oops, right - I mean to remove it, but forgot. Thanks noticing. Updated 
webrev:
http://cr.openjdk.java.net/~jlahoda/8166890/langtools.01/

Jan

>
> Regards,
> shinyafox(Shinya Yoshida)
>
> 2016-10-10 19:21 GMT+09:00 Jan Lahoda <jan.lahoda at oracle.com
> <mailto:jan.lahoda at oracle.com>>:
>
>     Hi,
>
>     When an input is redirected to jshell, like:
>     echo "1" | jshell
>
>     Then jshell locks, as it waits for the terminal to report the cursor
>     position. Also, when the input is fully read, the
>     StopDetectingInputStream is set to the CLOSED state, but the state
>     may be cleared using setState, causing the readers from the
>     StopDetectingInputStream to wait indefinitely.
>
>     Bug:
>     https://bugs.openjdk.java.net/browse/JDK-8166890
>     <https://bugs.openjdk.java.net/browse/JDK-8166890>
>
>     Webrevs:
>     jdk:
>     http://cr.openjdk.java.net/~jlahoda/8166890/jdk.00/
>     <http://cr.openjdk.java.net/~jlahoda/8166890/jdk.00/>
>     langtools:
>     http://cr.openjdk.java.net/~jlahoda/8166890/langtools.00/
>     <http://cr.openjdk.java.net/~jlahoda/8166890/langtools.00/>
>
>     Any feedback is welcome.
>
>     Thanks,
>         Jan
>
>


More information about the kulla-dev mailing list