Discussion:
[JSch-users] Infinite loop/hang on connect
Adam Fanello
2006-02-28 03:00:41 UTC
Permalink
Hello fellow jsch-users (and author).

I've been using jsch for some time, now at version 0.1.24, and am now
having an occasional hang problem. This software is running on remote
servers... I can't have it hanging! Here's the thread's stack trace
where it gets stuck:

"CommAgent" prio=1 tid=0x4de2b3f8 nid=0x8fa waiting on condition
[0xbddff000..0xbddff65c]
at java.lang.Thread.sleep(Native Method)
at com.jcraft.jsch.Session.write(Unknown Source)
at com.jcraft.jsch.Session.connect(Unknown Source)
at
com.intelio.common.io.SSHConnection.connect(SSHConnection.java:84)
at
com.intelio.common.comm.PayloadTransmitter.sendPackages(PayloadTransmitter.java:253)
at
com.intelio.common.comm.PayloadTransmitter.run(PayloadTransmitter.java:113)
at com.intelio.edge.agent.comm.CommAgent.execute(CommAgent.java:164)
at com.intelio.edge.component.Component.run(Component.java:92)

Apparently the variable "in_kex" never becomes true. I'm not sure about
the interaction here, but apparently its waiting for another thread to
change the value. Without a synchronization or declaring the variable as
volatile, could it be that the value is in fact changing and it just
isn't noticing? It seems to me that the CPU cache would flush
eventually, while this is hanging for hours (until I receive a notice
that files are piling up because the transfer is stuck, and I kill it).

Anyway, I do think that the variable needs to be declared volatile, but
it probably would only solve a short hang, not an infinite one. Any
other ideas?

--
Adam Fanello
Sr. Engineer/Architect
Intelio Technologies, Inc
Ned Miles
2006-02-28 03:51:12 UTC
Permalink
I had a similar problem with the sftp connection that would occur very
occassionally. The workaround I implemented was certainly not an eloquent
one but it has worked. Basically, I created a very simple class that would
start a timer when the connection call was made. If the call had not
returned within some liberal amount of time (say 1 minute) I interupted the
thread and retried the operation. Like I said, not real pretty but it has
done the trick.

-----Original Message-----
From: Adam Fanello
To: jsch-***@lists.sourceforge.net
Sent: 2/27/2006 10:00 PM
Subject: [JSch-users] Infinite loop/hang on connect

Hello fellow jsch-users (and author).

I've been using jsch for some time, now at version 0.1.24, and am now
having an occasional hang problem. This software is running on remote
servers... I can't have it hanging! Here's the thread's stack trace
where it gets stuck:

"CommAgent" prio=1 tid=0x4de2b3f8 nid=0x8fa waiting on condition
[0xbddff000..0xbddff65c]
at java.lang.Thread.sleep(Native Method)
at com.jcraft.jsch.Session.write(Unknown Source)
at com.jcraft.jsch.Session.connect(Unknown Source)
at
com.intelio.common.io.SSHConnection.connect(SSHConnection.java:84)
at
com.intelio.common.comm.PayloadTransmitter.sendPackages(PayloadTransmitt
er.java:253)
at
com.intelio.common.comm.PayloadTransmitter.run(PayloadTransmitter.java:1
13)
at
com.intelio.edge.agent.comm.CommAgent.execute(CommAgent.java:164)
at com.intelio.edge.component.Component.run(Component.java:92)

Apparently the variable "in_kex" never becomes true. I'm not sure about
the interaction here, but apparently its waiting for another thread to
change the value. Without a synchronization or declaring the variable as
volatile, could it be that the value is in fact changing and it just
isn't noticing? It seems to me that the CPU cache would flush
eventually, while this is hanging for hours (until I receive a notice
that files are piling up because the transfer is stuck, and I kill it).

Anyway, I do think that the variable needs to be declared volatile, but
it probably would only solve a short hang, not an infinite one. Any
other ideas?

--
Adam Fanello
Sr. Engineer/Architect
Intelio Technologies, Inc



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting
language
that extends applications into web and mobile media. Attend the live
webcast
and join the prime developer group breaking into this new coding
territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
Adam Fanello
2006-02-28 15:10:27 UTC
Permalink
Thank you for the reply Ned. That isn't the problem in this case. I
already use an Interrupter thread just as you described. It interrupts
one Thread.sleep(10) but is caught within jsch and continues the loop.

--
Adam Fanello
Post by Ned Miles
I had a similar problem with the sftp connection that would occur very
occassionally. The workaround I implemented was certainly not an
eloquent one but it has worked. Basically, I created a very simple
class that would start a timer when the connection call was made. If
the call had not returned within some liberal amount of time (say 1
minute) I interupted the thread and retried the operation. Like I
said, not real pretty but it has done the trick.
-----Original Message-----
From: Adam Fanello
Sent: 2/27/2006 10:00 PM
Subject: [JSch-users] Infinite loop/hang on connect
Hello fellow jsch-users (and author).
I've been using jsch for some time, now at version 0.1.24, and am now
having an occasional hang problem. This software is running on remote
servers... I can't have it hanging! Here's the thread's stack trace
"CommAgent" prio=1 tid=0x4de2b3f8 nid=0x8fa waiting on condition
[0xbddff000..0xbddff65c]
at java.lang.Thread.sleep(Native Method)
at com.jcraft.jsch.Session.write(Unknown Source)
at com.jcraft.jsch.Session.connect(Unknown Source)
at
com.intelio.common.io.SSHConnection.connect(SSHConnection.java:84)
at
com.intelio.common.comm.PayloadTransmitter.sendPackages(PayloadTransmitt
er.java:253)
at
com.intelio.common.comm.PayloadTransmitter.run(PayloadTransmitter.java:1
13)
at
com.intelio.edge.agent.comm.CommAgent.execute(CommAgent.java:164)
at com.intelio.edge.component.Component.run(Component.java:92)
Apparently the variable "in_kex" never becomes true. I'm not sure about
the interaction here, but apparently its waiting for another thread to
change the value. Without a synchronization or declaring the variable as
volatile, could it be that the value is in fact changing and it just
isn't noticing? It seems to me that the CPU cache would flush
eventually, while this is hanging for hours (until I receive a notice
that files are piling up because the transfer is stuck, and I kill it).
Anyway, I do think that the variable needs to be declared volatile, but
it probably would only solve a short hang, not an infinite one. Any
other ideas?
--
Adam Fanello
Sr. Engineer/Architect
Intelio Technologies, Inc
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting
language
that extends applications into web and mobile media. Attend the live
webcast
and join the prime developer group breaking into this new coding
territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
<http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642>
_______________________________________________
JSch-users mailing list
https://lists.sourceforge.net/lists/listinfo/jsch-users
Atsuhiko Yamanaka
2006-02-28 05:37:05 UTC
Permalink
Hi,

+-From: Adam Fanello <***@intelio.com> --
|_Date: Mon, 27 Feb 2006 19:00:41 -0800 ______
|
|Hello fellow jsch-users (and author).
|I've been using jsch for some time, now at version 0.1.24, and am now
|having an occasional hang problem. This software is running on remote
|servers... I can't have it hanging! Here's the thread's stack trace
|where it gets stuck:

|"CommAgent" prio=1 tid=0x4de2b3f8 nid=0x8fa waiting on condition
|[0xbddff000..0xbddff65c]
| at java.lang.Thread.sleep(Native Method)
| at com.jcraft.jsch.Session.write(Unknown Source)
| at com.jcraft.jsch.Session.connect(Unknown Source)

Thank you for your feedback.
I have found a bug, which may cause that problem, and fixed it.
Can you try
http://www.jcraft.com/jsch/0.1.26-rc1.zip

Sincerely,
--
Atsuhiko Yamanaka
JCraft,Inc.
1-14-20 HONCHO AOBA-KU,
SENDAI, MIYAGI 980-0014 Japan.
Tel +81-22-723-2150
+1-415-578-3454
Fax +81-22-224-8773
Skype callto://jcraft/
Adam Fanello
2006-02-28 15:12:42 UTC
Permalink
Thanks Atsuhiko. Since I don't don't know how to reliably replicate the
problem I cannot give a definitive report on the fix, but I'll deploy
this new version and see if it pops up again.

Thanks again,
Adam
Post by Atsuhiko Yamanaka
Hi,
|_Date: Mon, 27 Feb 2006 19:00:41 -0800 ______
|
|Hello fellow jsch-users (and author).
|I've been using jsch for some time, now at version 0.1.24, and am now
|having an occasional hang problem. This software is running on remote
|servers... I can't have it hanging! Here's the thread's stack trace
|"CommAgent" prio=1 tid=0x4de2b3f8 nid=0x8fa waiting on condition
|[0xbddff000..0xbddff65c]
| at java.lang.Thread.sleep(Native Method)
| at com.jcraft.jsch.Session.write(Unknown Source)
| at com.jcraft.jsch.Session.connect(Unknown Source)
Thank you for your feedback.
I have found a bug, which may cause that problem, and fixed it.
Can you try
http://www.jcraft.com/jsch/0.1.26-rc1.zip
Sincerely,
--
Atsuhiko Yamanaka
JCraft,Inc.
1-14-20 HONCHO AOBA-KU,
SENDAI, MIYAGI 980-0014 Japan.
Tel +81-22-723-2150
+1-415-578-3454
Fax +81-22-224-8773
Skype callto://jcraft/
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
JSch-users mailing list
https://lists.sourceforge.net/lists/listinfo/jsch-users
Loading...