Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
jclouds sshj hang with simple config
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  12 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post will appear after it is approved by moderators
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Alex Heneveld  
View profile  
 More options Apr 25 2012, 8:15 am
From: Alex Heneveld <alex.henev...@cloudsoftcorp.com>
Date: Wed, 25 Apr 2012 13:15:43 +0100
Local: Wed, Apr 25 2012 8:15 am
Subject: jclouds sshj hang with simple config

I've been seeing some jclouds hanging, under 1.4.0, in
net.schmizz.sshj.common.Buffer.getNextPowerOf2(Buffer.java:80)

I've boiled it down to a simple test case at
https://gist.github.com/2489273 including logs and stack trace.  Note
the stack trace was some 20m after the test ran.

I think I am using the wrong credentials, based on a log message, but I
think the credentials is confusing so maybe that could be cleaned up.

And I wouldn't expect it to hang doing sftp no matter what I've done
with my credentials!

Thanks.
--A


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Aled Sage  
View profile  
 More options Apr 25 2012, 8:52 am
From: Aled Sage <aled.s...@gmail.com>
Date: Wed, 25 Apr 2012 13:52:32 +0100
Local: Wed, Apr 25 2012 8:52 am
Subject: Re: jclouds sshj hang with simple config

Hi Alex,

The impl of net.schmizz.sshj.common.Buffer.getNextPowerOf2 certainly
looks risky.

protected static int getNextPowerOf2(int i) {
int j = 1;
while (j < i)
j <<= 1;
return j;

}

For any value of i greater than 1073741824, it will spin
forever.Shifting that gives a negative number, and subsequently gives zero.

The value of i is determined by PacketReader:

private int getPacketLength()
throws IOException {
readIntoBuffer(lenBuf, 0, lenBuf.length);

return (int) (lenBuf[0] << 24 & 0xff000000L
| lenBuf[1] << 16 & 0x00ff0000L
| lenBuf[2] << 8 & 0x0000ff00L
| lenBuf[3] & 0x000000ffL);

}

Perhaps if garbage is being sent down the stream then it can get some
inappropriate bytes for the lenBuf?

---
As a quick test, try putting the attached jar at the head of your
classpath. It changes getNextPowerOf2 to:

protected static int getNextPowerOf2(int i) {
int j = 1;
while (j < i) {
j <<= 1;
if (j <= 0) throw new IllegalArgumentException("Cannot get next power of
2; "+i+" is too large");

}
return j;
}

Hopefully then it won't hang, but it will presumably still fail in an
ugly way...

Aled

On 25/04/2012 13:15, Alex Heneveld wrote:

  sshj-patch.jar
8K Download

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Adrian Cole  
View profile  
 More options Apr 25 2012, 10:23 am
From: Adrian Cole <adrian.f.c...@gmail.com>
Date: Wed, 25 Apr 2012 07:23:56 -0700
Local: Wed, Apr 25 2012 10:23 am
Subject: Re: jclouds sshj hang with simple config

great detail, guys.  I think it would be more effective to send this to the
sshj issues list, right?  They use github issues fwiw.

-A
On Apr 25, 2012 5:53 AM, "Aled Sage" <aled.s...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Adrian Cole  
View profile  
 More options Apr 25 2012, 10:39 am
From: Adrian Cole <adrian.f.c...@gmail.com>
Date: Wed, 25 Apr 2012 07:39:23 -0700
Local: Wed, Apr 25 2012 10:39 am
Subject: Re: jclouds sshj hang with simple config

p.s. let us know the issue/pull request link so we can followup. Generally,
sshj will release a new version when asked.

Also, I noticed we are a few revs back on our jsch driver, so will update
this.

cheers!
On Apr 25, 2012 7:23 AM, "Adrian Cole" <adrian.f.c...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Andrew Phillips  
View profile  
 More options Apr 25 2012, 11:15 am
From: Andrew Phillips <aphill...@qrmedia.com>
Date: Wed, 25 Apr 2012 17:15:30 +0200
Local: Wed, Apr 25 2012 11:15 am
Subject: Re: jclouds sshj hang with simple config
Thanks for picking that up, Aled! You may want to raise an issue at

https://github.com/shikhar/sshj

In my experience they're usually pretty responsive...

ap

Quoting Aled Sage <aled.s...@gmail.com>:

--
Andrew Phillips
qrmedia

Unless expressly stated otherwise, this message is confidential.
Access to this e-mail by anyone else is unauthorised. If you are
not an addressee, any disclosure or copying of the contents of
this e-mail or any action taken (or not taken) in reliance on it
is unauthorised and may be unlawful. If you are not an addressee,
please inform the sender immediately.

This message is confidential and may not be redistributed or
broadcast in whole or part in any form, including but not limited
to any form of internet transmission including email, usenet,
newsgroups, www, irc, icq, etc.
All liability for errors and viruses is disclaimed.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alex Heneveld  
View profile  
 More options Apr 25 2012, 11:28 am
From: Alex Heneveld <alex.henev...@cloudsoftcorp.com>
Date: Wed, 25 Apr 2012 16:28:06 +0100
Local: Wed, Apr 25 2012 11:28 am
Subject: Re: jclouds sshj hang with simple config

+1

Nice work Aled, this patch does indeed solve the problem.

I guess there is some guff sent by the server...

I have observed before that sshd isn't fully operational when the VM is
up, takes a bit before it is sensible, but this error occurs repeatedly,
in each retry in my loop, though not in jclouds's retry.  Perhaps
because I am logging in as root when ubuntu is desired...

The test case below now proceeds to try 120 times to ssh in (actually
120 x 40 or something due to jclouds retry -- although I haven't waited
that long!)

--A

On 25/04/2012 16:15, Andrew Phillips wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Aled Sage  
View profile  
 More options Apr 25 2012, 5:20 pm
From: Aled Sage <aled.s...@gmail.com>
Date: Wed, 25 Apr 2012 22:20:16 +0100
Local: Wed, Apr 25 2012 5:20 pm
Subject: Re: jclouds sshj hang with simple config

Issue link is https://github.com/shikhar/sshj/issues/72

I haven't created a pull request yet. I'd like to catch the error higher
up (probably in PacketReader.readPacket) so that it can give a more
meaningful error message, such as "Invalid packet: length %d too long".
I'll hopefully find time tomorrow to look at that...

Aled

On 25/04/2012 15:39, Adrian Cole wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Aled Sage  
View profile  
 More options Apr 26 2012, 6:47 am
From: Aled Sage <aled.s...@gmail.com>
Date: Thu, 26 Apr 2012 11:47:47 +0100
Local: Thurs, Apr 26 2012 6:47 am
Subject: Re: jclouds sshj hang with simple config

Pull request submitted to sshj at
https://github.com/shikhar/sshj/pull/73; issue updated at
https://github.com/shikhar/sshj/issues/72.

Aled

On 25/04/2012 15:39, Adrian Cole wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Adrian Cole  
View profile  
 More options Apr 26 2012, 10:58 am
From: Adrian Cole <adrian.f.c...@gmail.com>
Date: Thu, 26 Apr 2012 07:58:06 -0700
Local: Thurs, Apr 26 2012 10:58 am
Subject: Re: jclouds sshj hang with simple config
<applause>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Andrew Phillips  
View profile  
 More options Apr 26 2012, 1:44 pm
From: Andrew Phillips <aphill...@qrmedia.com>
Date: Thu, 26 Apr 2012 19:44:52 +0200
Local: Thurs, Apr 26 2012 1:44 pm
Subject: Re: jclouds sshj hang with simple config
Cool! Thanks, Aled!

ap


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alex Heneveld  
View profile  
 More options May 22 2012, 1:13 pm
From: Alex Heneveld <alex.henev...@cloudsoftcorp.com>
Date: Tue, 22 May 2012 11:13:38 -0600
Local: Tues, May 22 2012 1:13 pm
Subject: Re: jclouds sshj hang with simple config

sshj 0.8.0 has been released, fixing the power of 2 bug.
this bit me again just now.  :(

pull 648 applies this to 1.4.x

--a

On 26/04/2012 08:58, Adrian Cole wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Adrian Cole  
View profile  
 More options May 22 2012, 2:58 pm
From: Adrian Cole <adrian.f.c...@gmail.com>
Date: Tue, 22 May 2012 11:58:27 -0700
Local: Tues, May 22 2012 2:58 pm
Subject: Re: jclouds sshj hang with simple config

Thx. Cherry picked into master.
On May 22, 2012 11:13 AM, "Alex Heneveld" <alex.henev...@cloudsoftcorp.com>
wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »