Subject: Re: I-D Action:draft-ietf-tsvwg-sctp-strrst-08.txt

From: "t.petch" <[email-masked]>
Date: Wed, 1 Dec 2010 10:13:46 +0100

Um; I was expecting perhaps a little more on race conditions.

I had a more complex race condition in mind, which will work, I have
convinced myself of that, provided everyone expects it to:-)

A appl requests a reset of streams 2 and 3
A sends Incoming SSN Reset Request Parameter for streams 2 and 3 and starts
timer
A receives Outgoing SSN Reset Request Parameter for streams 1 and 2 with zero
Stream Reset Request Sequence Number
A sends ACK and  has a think about what to do .....
 - waits for Outgoing SSN Reset Request Parameter for streams 2 and 3?
 - resets streams 1 and 2?
 - raises an event for streams 1 and 2?

Meanwhile,
B appl requests a reset of streams 1 and 2
B sends Outgoing SSN Reset Request Parameter for streams 1 and 2 and starts
timer
B receives Incoming SSN Reset Request Parameter for streams 2 and 3
B has timer running so must wait

Therefore
A must reset streams 1 and 2 and send Stream Reset Response Parameter to let B
proceed
B receives Stream Reset Response Parameter and stops timer
B can and must now send Outgoing SSN Reset Request Parameter for streams 2 and 3
with non-zero Stream Reset Request Sequence Number and starts timer
A receives Outgoing SSN Reset Request Parameter for streams 2 and 3 with
non-zero Stream Reset Request Sequence Number and stops timer
A resets streams 2 and 3 and sends Stream Reset Response Parameter
B receives Stream Reset Response Parameter and stops timer

A appl and B appl both receive events, one for reset of streams 1 and 2, the
other for streams 2 and 3 (which may puzzle them).

Of course, a slightly different scenario would be for both A and B to select the
same streams, say 1 and 3 (perhaps as a result of an application level event) in
which case, the scope for getting it wrong is even greater; when A receives
Outgoing SSN Reset Request Parameter with zero Stream Reset Request Sequence
Number, it might send an Error - Bad Sequence Number, which could really confuse
B

Tom Petch

----- Original Message -----
From: <[email-masked]>
To: <[email-masked]>
Cc: <[email-masked]>
Sent: Monday, November 29, 2010 6:30 PM
Subject: I-D Action:draft-ietf-tsvwg-sctp-strrst-08.txt

> A New Internet-Draft is available from the on-line Internet-Drafts
directories.
> This draft is a work item of the Transport Area Working Group Working Group of
the IETF.
>
>
> Title           : Stream Control Transmission Protocol (SCTP) Stream
Reconfiguration
> Author(s)       : R. Stewart, et al.
> Filename        : draft-ietf-tsvwg-sctp-strrst-08.txt
> Pages           : 31
> Date            : 2010-11-29
>
> Many applications that use SCTP want the ability to "reset" a stream.
> The intention of resetting a stream is to set the numbering sequence
> of the stream back to 'zero' with a corresponding notification to the
> upper layer that this has been performed.  The applications that want
> this feature want it so that they can "re-use" streams for different
> purposes but still utilize the stream sequence number so that the
> application can track the message flows.  Thus, without this feature,
> a new use of an old stream would result in message numbers greater
> than expected unless there is a protocol mechanism to "reset the
> streams back to zero".  This document also includes methods for
> resetting the transport sequence numbers, adding additional streams
> and resetting all stream sequence numbers.
>
> A URL for this Internet-Draft is:
> http://www.ietf.org/internet-drafts/draft-ietf-tsvwg-sctp-strrst-08.txt
>
> Internet-Drafts are also available by anonymous FTP at:
> ftp://ftp.ietf.org/internet-drafts/
>
> Below is the data which will enable a MIME compliant mail reader
> implementation to automatically retrieve the ASCII version of the
> Internet-Draft.
>

---

From: Randy Stewart <[email-masked]>
Date: Wed, 1 Dec 2010 09:09:30 -0800

Tom:

Some comments in-line...

> - raises an event for streams 1 and 2?

Each implementation has to keep a queue of stream reset actions. Basically consider..

A user does

stream-reset (2,3)
followed by
stream-reset (4,5)

the reset of 2/3 will not be finished when the socketoption (thats how we did it anyway) is
called on 4-5.. thus the implementation has to keep a queue of requests that have not been sent.

So its always possible to queue a stream reset.

As to your scenario...

There would be nothing stopping A of responding right away to the Outgoing Reset request. The
incoming request is outstanding, but it can respond to the outgoing request.. which it would.

> B has timer running so must wait

On the other side, B sends his request and then gets the request for the incoming.
It then adds this to its queue of things to do... and waits its response..

It gets A's reset response.. and then processes its queue sending the
outgoing reset request for 2/3.

> A must reset streams 1 and 2 and send Stream Reset Response Parameter to let B

It of course would.. there is nothing stopping it from doing so unless of
course it deny's the request (which is allowed).

> other for streams 2 and 3 (which may puzzle them).

Well thats true... but App's are going to have to either coordinate there
reset requests or be able to handle getting a reset on 1/2 followed by
another reset 2/3...

> Number, it might send an Error - Bad Sequence Number, which could really confuse

Why would it do that?

In this scenario you have exactly the race condition that I mentioned in the
new version of the document. When B goes to process the "queued" request for 1/3 it
finds they are both already at 1/3... so it could easily send the "success - no action required" in
response.

The sequence number is unique to each side. I.e. Side A has a number it is sending and a different
number it is expecting from B..

I.e. (lets use different numbers than 0)

A;

Next_sending_SReset = 1
Next_Expected_SReset_from_peer = 10

B would have:

Next_sending_SReset = 10
Next_Expected_SReset_from_peer = 1

So A does

-----In-Reset(1/3)OSeq=1------->

B does:

<----Reset(1/3)OSeq=10,RSeq=0)-----

Now

A would do reset 1/3 and do

-----Reset-Response(Seq=10)------>

B would now find its queued request and do either (per the draft)

-----Reset-Response(Seq=1)-sucess:nothing to do---->
<or>
-----Reset(1/3)OSeq=11, RSeq=1)----->

Its choice...

R

>> implementation to automatically retrieve the ASCII version of the

-----
Randall Stewart
[email-masked]

---

From: "t.petch" <[email-masked]>
Date: Wed, 1 Dec 2010 18:20:14 +0100

My previous, somewhat lengthy, worked example was intended to show that yes, it
works, but that care is needed and that perhaps more description is needed in
the I-D.

Quoting from the I-D
"When a peer endpoint requests a Incoming SSN Reset Request it is
   possible that the local endpoint has just sent an Outgoing SSN Reset
   Request on the same stream and has not yet received a response.  In
   such a case the local endpoint SHOULD silently discard the request
   and continue processing any other request found in the Stream Reset
   Chunk."
This will I think fail.  If the local endpoint silently discards the request,
then peer endpoint will never receive a Stream Reset Response Parameter
and the peer will timeout, perhaps taking down the association.  So while it
can work, I do not think that the I-D has it quite right.

Tom Petch

----- Original Message -----
From: "Randy Stewart" <[email-masked]>
To: "t.petch" <[email-masked]>
Cc: "Michael Tuexen" <[email-masked]>; <[email-masked]>
Sent: Wednesday, December 01, 2010 6:09 PM
Subject: Re: I-D Action:draft-ietf-tsvwg-sctp-strrst-08.txt

Tom:

Some comments in-line...

> - raises an event for streams 1 and 2?

Each implementation has to keep a queue of stream reset actions. Basically
consider..

A user does

stream-reset (2,3)
followed by
stream-reset (4,5)

the reset of 2/3 will not be finished when the socketoption (thats how we did it
anyway) is
called on 4-5.. thus the implementation has to keep a queue of requests that
have not been sent.

As to your scenario...

There would be nothing stopping A of responding right away to the Outgoing Reset
request. The
incoming request is outstanding, but it can respond to the outgoing request..
which it would.

> B has timer running so must wait

On the other side, B sends his request and then gets the request for the
incoming.
It then adds this to its queue of things to do... and waits its response..

Why would it do that?

In this scenario you have exactly the race condition that I mentioned in the
new version of the document. When B goes to process the "queued" request for 1/3
it
finds they are both already at 1/3... so it could easily send the "success - no
action required" in
response.

The sequence number is unique to each side. I.e. Side A has a number it is
sending and a different
number it is expecting from B..

A;

Next_sending_SReset = 1

B would have:

Next_sending_SReset = 10

So A does

B does:

Now

Its choice...

R

---

From: Randy Stewart <[email-masked]>
Date: Thu, 2 Dec 2010 06:49:16 -0800

> can work, I do not think that the I-D has it quite right.

Ahhh.. good point.. what I should have said is ... if the 
stream reset is exactly the same.. and thinking a bit more on this
it should also really still respond with a  "nothing to do" ...

So discarding is probably wrong.. instead its either

a) If it overlap's but is not exact queue an outgoing request and ack the incoming request.
b) If it is an exact overlap to what has already been sent out ack it with a nothing-to-do.

I will put this down as a LC update.. for the final spin ;-)

R

-----
Randall Stewart
[email-masked]

---

From: "t.petch" <[email-masked]>
Date: Fri, 3 Dec 2010 18:37:37 +0100

---- Original Message -----
From: "Randy Stewart" <[email-masked]>
To: "t.petch" <[email-masked]>
Cc: "Michael Tuexen" <[email-masked]>; <[email-masked]>
Sent: Thursday, December 02, 2010 3:49 PM

a) If it overlap's but is not exact queue an outgoing request and ack the
incoming request.
b) If it is an exact overlap to what has already been sent out ack it with a
nothing-to-do.

<tp>
Yup; I look forward to the text (and some more dry running:-). One aspect I am
unclear on is just when the reset takes place; presumably after
sending/receiving the Stream Reset Response Parameter to the Outgoing SSN Reset
Request Parameter so that the 'stream receiver' resets before the 'stream
sender'; is this correct?

Also;

After B4, suggest

" When sending a Incoming SSN Reset Request, there is a possibility that
   the peer has just reset or is in the process of resetting some or all of the
same
   streams via an Outgoing SSN Request..."

E4 needs to refer to E2

Tom Petch

</tp>

R

>> B can and must now send Outgoing SSN Reset Request Parameter for streams 2
and
> 3

-----
Randall Stewart
[email-masked]

---

From: Randy Stewart <[email-masked]>
Date: Fri, 3 Dec 2010 10:58:20 -0800

> sender'; is this correct?

So generally a sender of a outgoing type reset does:

1) Send the Outgoing reset
2) Stop all SSN assignment (if any is happening) holding off until the stream resets
3) Get the response back from the peer (acking the request).
4) Now go ahead and reset the outgoing numbers and allow sending again.

You have to do this in order to make sure the receiver is happy.. otherwise it
might get a stream-seq=0 before it has process the reset... and that would most
likely mean an abort of the connection (if the implementation has mis-order protection
in stream processing... which many do.. at least they did at the last inter-op ;-d)

>   streams via an Outgoing SSN Request..."

Thanks...

I will update it ;-)

-----
Randall Stewart
[email-masked]