Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(42)

Issue 6123058: code review 6123058: ssh: fix deadlock (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
14 years, 5 months ago by agl1
Modified:
14 years, 5 months ago
Reviewers:
kardia
CC:
albert.strasheim, golang-dev
Visibility:
Public.

Description

ssh: fix deadlock The code was taking locks in the wrong order. Fixes issue 3570.

Patch Set 1 #

Patch Set 2 : diff -r af839935547f https://agl%40golang.org@code.google.com/p/go.crypto/ #

Patch Set 3 : diff -r 306e41c8d097 https://agl%40golang.org@code.google.com/p/go.crypto/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+26 lines, -16 lines) Patch
M ssh/channel.go View 1 3 chunks +26 lines, -16 lines 0 comments Download

Messages

Total messages: 9
agl1
14 years, 5 months ago (2012-04-26 14:55:51 UTC) #1
albert.strasheim
LGTM At least according to the test. Before the patch I could reproduce the hang, ...
14 years, 5 months ago (2012-04-26 16:02:01 UTC) #2
agl1
Hello fullung@gmail.com (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://agl%40golang.org@code.google.com/p/go.crypto/
14 years, 5 months ago (2012-04-26 16:05:33 UTC) #3
agl1
*** Submitted as http://code.google.com/p/go/source/detail?r=bd78e6211ff8&repo=crypto *** ssh: fix deadlock The code was taking locks in the ...
14 years, 5 months ago (2012-04-26 16:05:42 UTC) #4
kardia
I do NOT think this is good. Ok as a stop-gap only. This solution is ...
14 years, 5 months ago (2012-04-26 16:32:15 UTC) #5
agl1
On Thu, Apr 26, 2012 at 12:32 PM, <kardianos@gmail.com> wrote: > This solution is acceptable ...
14 years, 5 months ago (2012-04-26 16:36:08 UTC) #6
kardia
> On Thu, Apr 26, 2012 at 12:32 PM,<kardianos@gmail.com> wrote: >> This solution is acceptable ...
14 years, 5 months ago (2012-04-26 16:50:34 UTC) #7
agl1
On Thu, Apr 26, 2012 at 12:50 PM, Daniel <kardianos@gmail.com> wrote: > If I understand ...
14 years, 5 months ago (2012-04-26 16:59:55 UTC) #8
kardia
14 years, 5 months ago (2012-04-26 17:24:49 UTC) #9
Thanks for taking time to reply. I missed assigning the windowAdjustment 
to zero condition. I'll try to read more throughly :/.

Thanks again,
-Daniel


On 04/26/2012 09:59 AM, Adam Langley wrote:
> On Thu, Apr 26, 2012 at 12:50 PM, Daniel<kardianos@gmail.com>  wrote:
>> If I understand correctly, each read from the server channel will result in
>> a packet to the client. This seems unnecessary, especially if the use case
>> is for a terminal where single charters are being read.
>
> Well, at the TCP layer, the server will be ACKing the client's packets
> and we can't do much about that. (At best you get to save a few
> because of TCP delayed ACK.)
>
> In the SSH code we have this:
>
>
> windowAdjustment = uint32(len(c.pendingData)-c.length) - c.myWindow
> if windowAdjustment<  uint32(len(c.pendingData)/2) {
> »·······windowAdjustment = 0
> }
>
> uint32(len(c.pendingData)-c.length) is how much space we actually have
> in the buffer and c.myWindow is how much window space the client
> thinks is remaining. So, that's the amount of extra window that we
> *could* give to the client. If that's less than half of the buffer
> size, we don't bother sending any extra window.
>
> So for the case where the server is reading byte-by-byte, we'll only
> send window adjustments very rarely. (Only every 16K reads with
> default sizes.)
>
> Over high bandwidth-delay-product links, the buffer would have to be
> larger to allow the flow to reach full TCP speeds and it might be
> suitable to tweak that limit (i.e. if windowAdjustment>  16KB, always
> send an adjustment, even if our buffer is 4MB). But I didn't write
> that in because I haven't hit it and have no basis for what the limit
> should be.
>
>
> Cheers
>
> AGL
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b