commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Konrad Garus (JIRA)" <>
Subject [jira] [Commented] (NET-466) Regression: TelnetInputStream#available() blocks
Date Mon, 23 Jul 2012 18:07:35 GMT


Konrad Garus commented on NET-466:

The issue disappears as soon as I disable the reader thread.

Here are relevant stacktraces from the lock-up:

{code}"Thread-0" daemon prio=10 tid=0x00007f721c61a000 nid=0x3dea runnable [0x00007f7218ee7000]
   java.lang.Thread.State: RUNNABLE
	at Method)
	- locked <0x00000007d70f7510> (a
	- locked <0x00000007d70fbab0> (a

   Locked ownable synchronizers:
	- None

"main" prio=10 tid=0x00007f721c00d000 nid=0x3dd0 waiting for monitor entry [0x00007f7223c29000]
   java.lang.Thread.State: BLOCKED (on object monitor)
	- waiting to lock <0x00000007d70fbab0> (a
	- locked <0x00000007d70fe320> (a [I)
	- locked <0x00000007d7100498> (a
	at com.example.Main.main(

   Locked ownable synchronizers:
	- None
> Regression: TelnetInputStream#available() blocks
> ------------------------------------------------
>                 Key: NET-466
>                 URL:
>             Project: Commons Net
>          Issue Type: Bug
>          Components: Telnet
>    Affects Versions: 3.1
>            Reporter: Martin Oberhuber
>            Priority: Critical
>             Fix For: 3.1
> When testing with Commons Net 3.1 for Eclipse
, I found that our telnet client blocks when the ReaderThread is running and waiting for new
data. Investigation shows that our code blocks on TelnetInputStream#available().
> This regression is due to the code introduced for NET-437 "TelnetInputStream doesn't
support non-blocking IO when reader thread is not enabled":
> TelnetInputStream#available() now calls super.available() which is declared as "synchronized"
on BufferedInputStream in JDK 1.6.0_21 at least. But at the same time, the telnet ReaderThread
has already the Monitor on BufferedInputStream and doesn't give it up while sitting in read0().
> This seems to be exactly the situation that the comment before TelnetInputStream#close()
warns about:
>     // Cannot be synchronized.  Will cause deadlock if run() is blocked
>     // in read because BufferedInputStream read() is synchronized.
> This is a severe issue since it violates the specification and use of available().

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message