public inbox for nncp-devel@lists.cypherpunks.ru
Atom feed
From: Sergey Matveev <stargrave@stargrave•org>
To: nncp-devel@lists.cypherpunks.ru
Subject: Re: Areas interaction causes nncp-toss to always exit with error
Date: Sun, 31 Oct 2021 17:01:39 +0300	[thread overview]
Message-ID: <YX6hz8lAWwSIWfe7@stargrave.org> (raw)
In-Reply-To: <877dduee75.fsf@complete.org>

[-- Attachment #1: Type: text/plain, Size: 2943 bytes --]

Greetings!

*** John Goerzen [2021-10-30 10:15]:
>So I'm doing some more tracking down on this issue with nncp-toss
>existing with an error and never advancing certain packets on to their
>destination.

Accidentally I repeated the same behaviour on one of my computers.
"already seen" log message, then "tossing" message and then bad exit
code without exact errors. I send area packet with nncp-file ... area:...,
then remembered that NNCP is not the latest version on that computer,
upgraded it and run nncp-toss, catching that bad behaviour. nncp-file
used an old code with ".seen" packets, but new one does not use ".seen"
extension anymore. So nncp-toss did not see self-seen packet, that will
forcefully remove the packet from self directory after it was sent to
all "subs".

When you run nncp-toss, it has the following code:

-----# 1 [                              src/cmd/nncp-toss/main.go ]-----
 115 			if nodeId == *ctx.SelfId {
 116 				isBad = ctx.Toss(
 117 					node.Id,
 118 					nncp.TTx,
 119 					nice,
 120 					*dryRun, false, true, true, true, true, *noArea,
 121 				) || isBad
 122 			}
---------------------------------- >8 ----------------------------------

calling toss with noFile argument set to true (sigh, I already should
create TossOption struct to pass those arguments more human readably).
Because there is no seen-file, it tries to process the packet as it was
sent from outside. But because noFile is set, it quietly returns no
error:

-----# 2 [                                            src/toss.go ]-----
 242 	case PktTypeFile:
 243 		if noFile {
 244 			return nil
 245 		}
---------------------------------- >8 ----------------------------------

but PktEncRead code below does not expect that pipe won't be filled with
anything, so actually there is error "io: read/write on closed pipe",
that is logged with LogE I added now. Previously it was "unseen".

-----# 3 [                                            src/toss.go ]-----
 684 	case PktTypeArea:
 812 		if area.Prv == nil {
 817 		} else {
 868 			_, _, _, err = PktEncRead(
 869 				&areaNodeOur,
 870 				ctx.Neigh,
 871 				fullPipeR,
 872 				pipeW,
 873 				signatureVerify,
 874 				nil,
 875 			)
 876 			if err != nil {
 877 				ctx.LogE("rx-area-pkt-enc-read2", les, err, logMsg)
 878 				pipeW.CloseWithError(err)
 879 				<-errs
 880 				return err
 881 			}
---------------------------------- >8 ----------------------------------

seen-packet is created when nncp-file/whatever creates outgoing area
packet. In my case it faulted because of different NNCP version.
Probably something similar on your side?

I have completely not looked at NNCP for a long time, sorry. And still
have not enough time to dive in all that error-related issues.

-- 
Sergey Matveev (http://www.stargrave.org/)
OpenPGP: CF60 E89A 5923 1E76 E263  6422 AE1A 8109 E498 57EF

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2021-10-31 14:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-24 17:25 Areas interaction causes nncp-toss to always exit with error John Goerzen
2021-09-26 18:49 ` Sergey Matveev
2021-09-28 16:43   ` John Goerzen
2021-10-30 15:15 ` John Goerzen
2021-10-31 14:01   ` Sergey Matveev [this message]
2021-10-31 22:46     ` John Goerzen
2021-11-01 11:55       ` Sergey Matveev