🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #44468

Re: Batched ARTICLE commands

#44468
From: Curt Welch
Date: Sat, 26 Feb 2000 00:00
172 lines
9337 bytes
Andrew Gierth <andrew@erlenstar.demon.co.uk> wrote:

We both have a good understanding of the reality of all this, but I'd
like to go further into my views on this semantic issue. I think it shbould
be important to those people updating the RFC (which you seem to be a part
of).

> But to say that the current RFC
> requires that it work is nonsense - the RFC is simply silent on the
> issue. [of pipelining commands]

I think you are wrong there.  You are right that it doesn't discuss
the issue, but I think by not discussing it, it manages to clearly
require that pipeling be supported.  I'll demonstrate.

To start with, the RFC defines the protocol to work on top of a reliable
data stream protocol and gives TCP/IP as the example.  This clearly defines
the protocol to be working with a stream of characters that have NO
boundries between commands, and no guarantee that groups of characters sent
by the client (i.e. a command) will arrive in those same groups(packets) at
the server.

It goes on to define a COMMAND (in so many words) as a byte stream ending
in CR LF.  So the server must parse this incomming byte stream and convert
the stream into a stream of COMMANDS, but looking for the CR LF terminator
characters.

The rest of the RFC defines the responses that the server MUST give
for all COMMANDS -- including how to respond to invalid commands.

So, by all this, if the client sends the byte stream:

   M O D E <SP> R E A D E R <CR> <LF> C R A P <CR> <LF>

then the server is REQUIRIED by the RFC to parse that as two commands, and
resond in the correct fashion to _both_ of them.

If the server decides to ignore the "CRAP" -- i.e. drop it on the
floor and pretend it did not receive it, then it has clearly in my mind
has violated the RFC.

Nowhere in the RFC does it talk about the timing of this interaction.
Nowhere does it give any hint or implication that it would be OK for
the server to just ignore characters in the incomming "reliable data
stream".

So, the RFC defines the protocol on top of a data stream which has NO
association between what the client and server are sending to each other,
it says nothing about the timing, and it defines a language with symantics
which have no requirements for the client and server to stay in-sync (with
the exception of the IHAVE and POST commands).

So, I claim that the server is required by the current RFC to reconginze
this:

    M O D E <SP> R E A D E R <CR> <LF> C R A P <CR> <LF>

as two commands.  Please show me where it says it's ok for the server
to drop the CRAP?  If you can't, then I claim that this is straight
forward proof that the RFC requires the server to support pipelining
of commands by the client.  This follows because there's no way that
a server can follow the RFC (as written), and not support pipelining.

The only thing that even hints at a requirement for the client to wait
for a response before sending the next command is the vague discription
of NEWS EXCHANGE state:

   "The client host and server host SHOULD then exchange commands
    and responses (respectively) until the connection is closed or
    aborted."

Some people I suspect might argue that an "exchange" here is defined
as the client sending a command, and then _waiting_ for a response, before
starting the next exchange.  But I think it's just as fair to read
that as the client sends command(s), and the server responds to them.

So, in my mind, we have an RFC that defines (though a bit indirectly)
that pipelining must be supported by the server.  But yet, we have
servers which are clearly broken (inn for example) which will read-ahead
data from the stream, and then toss it out when it starts a new
process (nnrpd) to continue the parsing of the data.

There is NOTHING in the RFC to imply this might happen.  And there is
plenty in the RFC that implies this WON'T happen.  So I see this is
a weakness in the RFC that should be addressed.

And example of how this might cause probelms...

A client author decides to do a "MODE READER" followed by a "DATE" command
on start up.  He sends both before reading the results.

On many servers (like mine, and Typhoon) which don't have the inn broken
behavior, this will work fine.  The client in my mind has clearly followed
the RFC.  He sent a perfictly formated data stream to the client as
specified and the server responds as required.

But then, when someone tries to use this client on a broken server (inn),
it hangs on starup waiting for the response to the second command which
never comes.

This is very clearly a inn application bug.  The TCP stack didn't drop the
characters, it gave them to innd as requested.  Innd just failed to pass
those characters on to nnrpd as required by the RFC.

You do understand that the characters aren't just "lost" on the handoff
don't you?  i.e., it's not OK to expect a Unix application to loose
characters from a TCP stream just becaue it forks a new process to read the
stream?  This is simply an implementation bug where INND reads the stream,
and then, in complete violation of the RFC, throws the characters away.

So, I argue that the RFC, by saying nothing, supports the concept of
pipelined commands.  And because at least one very popular implementation
of the protocol (inn) fails to follow the RFC, we have a breakdown in
the intended function of the RFC -- i.e. to create a standard which people
can follow when developing applications which will allow them to
interoperate without trouble.

So, either we need to change the RFC to document this INN bug as acceptable
behavior (which from what you say seems to be what they did with SMTP
because of a similar bug in sendmail), or consider it incorrect, and just
understand that this is just one of the many "bugs" NNTP authors have to
deal with when writing real-world applications.

>  Curt> I think it would be wise to add that to the RFC -- i.e. that
>  Curt> pipelining of commands (by _clients_) should not be allowed
>  Curt> after the mode reader command.
>
>  Curt> It strikes me as a bit odd to do it for AUTHINFO, but I guess
>  Curt> you are thinking that some servers might fork off different
>  Curt> processes depending on whether the authenticated user had feed
>  Curt> vs read permisssion?
>
> That, plus the fact that authinfo exchanges can be non-trivial if
> SASL is involved; the server may respond to AUTHINFO with a challenge.

Ah, ok.  Didn't know about that SASL stuff...

> POST is another command that can't be pipelined, of course.

and likewise IHAVE.

But POST and IHAVE can't be because of logical protocol reasons --- i.e.
the client has to wait for the response before it can know what will
be acceptable next in the data stream.  The RFC clearly implies that
already.  Nothing else really needs to be said there.  What it doesn't
imply (or even hint at) is that that pipelining might be a problem at the
MODE READER command.

Do you see the point I'm making here?

The problem is that by the very nature of the protocol, many people think
of it as a command->response->command->response type of a thing.  They
assume that clients won't send two commands before waiting for a response.
And in most cases, they are correct, this is how most clients use it.

But, the RFC, as written, implies that it is valid for a client to pipeline
commands.  And this creates the problem that a server author may falsely
assume clients won't pipeline commands (or because of the nature of the
protocol, just never think about the posibility).  And a client author,
on the other hand, may decide to take advantage of the pipeline features
of the protocol to improve performance.  And, because it really is valid,
this client will work fine with some servers, but break on others that
didn't actually follow the RFC.

So the RFC has a problem.  Granted, it's a small problem, and only one of
many small problems, but it's a problem none the less.

-- 
Curt Welch                                            http://CurtWelch.Com/
curt@kcwc.com                          Webmaster for http://NewsReader.Com/

Technical Details
Message-ID: <20000225234216.661$0Y@newsreader.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
References: <220220000104304154%planb@newsreaders.com> <240220000054115493%planb@newsreaders.com> <20000225004139.313$nK@newsreader.com> <250220001158002643%planb@newsreaders.com> <20000225125610.123$Ow@newsreader.com> <yl6itzdjb0r.fsf@independence.ecn.ou.edu> <20000225162640.211$2M@newsreader.com> <87n1opgdej.fsf@erlenstar.demon.co.uk> <20000225180328.114$Ys@newsreader.com> <87zosog8kl.fsf@erlenstar.demon.co.uk>

Show Full Headers
Complete Article Headers
Message-ID: <20000225234216.661$0Y@newsreader.com>
Subject: Re: Batched ARTICLE commands
Date: Sat, 26 Feb 2000 00:00:00 +0000
From: curt@kcwc.com (Curt Welch)
References: <220220000104304154%planb@newsreaders.com> <240220000054115493%planb@newsreaders.com> <20000225004139.313$nK@newsreader.com> <250220001158002643%planb@newsreaders.com> <20000225125610.123$Ow@newsreader.com> <yl6itzdjb0r.fsf@independence.ecn.ou.edu> <20000225162640.211$2M@newsreader.com> <87n1opgdej.fsf@erlenstar.demon.co.uk> <20000225180328.114$Ys@newsreader.com> <87zosog8kl.fsf@erlenstar.demon.co.uk>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
X-Deja-AN: 590146777
X-Face: "p}G*1KH{+F7EYGKLb>ogDguabZ+%,?^epeFB!nzu`)`$=QcvL1KF6<0GH!Tbc!Sqo[|tV5 %IW48mQf3K=Ci&gZ7]]aazx@]Y-nq!r5{yH/#,?@lDdUDvOfByB2hVW0.@OM%{l/{cT'{w
X-User: Curt@NewsReader.Com
Organization: NewsReader.Com
X-Url: http://CurtWelch.Com/
Newsgroups: news.software.nntp