What is a 'stream operation'?

Unfortunately it is unclear to me what this is supposed to do. What is a stream operation?

--storage2.stream-operation-timeout duration               how long to spend waiting for a stream operation before canceling (default 30m0s)

I understand it maybe as upload or as download. Or both? Or even more than that? Or something completely different?

It’s for both to prevent stale operations, initiated by uplink. If it’s slow or hanging, the node will kill this connection after the specified timeout.

Thanks. So it does not affect other sending operations like e.g. receving bloom filter, sending orders etc.? It is for timing out uploads and downloads by killing these specific connections?

It’s related to uplink. PUT, GET, GET_AUDIT, GET_REPAIR, PUT_REPAIR. So, only pieces upload/download.

So when it is set to default at 30m and on the debug port I check at /mon/ps with grep -iE "upload|download" | grep -i Endpoint I get entries like:

  [7871441453474153205,5289596714867594412] storj.io/storj/storagenode/piecestore.(*Endpoint).Download() (elapsed: 243.538351ms)
  [7883542548421029374,5301697809814470582] storj.io/storj/storagenode/piecestore.(*Endpoint).Download() (elapsed: 89h9m12.554490609s)
  [7883942939115114609,5302098200508555817] storj.io/storj/storagenode/piecestore.(*Endpoint).Download() (elapsed: 17h28m59.986723314s)
  [7884567385371495032,5302722646764936240] storj.io/storj/storagenode/piecestore.(*Endpoint).Download() (elapsed: 41h25m12.227282952s)
  [7887740656551712344,5305895917945153551] storj.io/storj/storagenode/piecestore.(*Endpoint).Download() (elapsed: 46h35m14.45152404s)
  [7889618950898434373,5307774212291875580] storj.io/storj/storagenode/piecestore.(*Endpoint).Download() (elapsed: 62h52m17.736029851s)

Is this weird? Does it mean there is a connection still open after 89 hours? Or is this endpoint being reused over and over for new connections?
I dont know exactly what I am seeing there.

BTW. The node is on hashstore but I think it is correct that it still reads piecestore?

Quick thought, don’t have time for more right now. It might be that something in your networking stack silently resets connections, so that your node doesn’t know that it is no longer connected. I had this with my previous router during Storj’s large scale tests due to overloading of NAT. But I would expect the timeout on node’s side to actually work…

Obviously it does not seem to work a least for some of the connections. They seem to be stuck.

[5761902038071964129,5267169152746712313] storj.io/storj/storagenode/piecestore.(*Endpoint).Download() (elapsed: 118h28m43.758669865s)

Do you have the same for uploads?

Basically yes but not to such an extreme extent. We see:

[3197721790377013373,8663534094715479748] storj.io/storj/storagenode/piecestore.(*Endpoint).Upload() (elapsed: 36m36.174734598s)

or

[8102403996151702342,5634423582818320003] storj.io/storj/storagenode/piecestore.(*Endpoint).Upload() (elapsed: 41m39.049336816s)

With default 30m on these nodes.

Here is even another one:

[3833851369074791932,7722991178608773607] storj.io/storj/storagenode/piecestore.(*Endpoint).Upload() (elapsed: 4m59.190716111s)

That is significant as stream timeout is set to 30s on this node (unless using --storage2.stream-operation-timeout 0m30s in Docker run command is not correct).

It should be 30 minutes, right? So did you set it to 30s?

The last example is a different node where I had set it to 30 seconds with the added setting to the run command. If the node has applied the command correctly then to my understanding it should be 30 seconds.

Interesting, shared with the team. Please don’t expect a quick response, too much is going on too fast.

Still investigating. What I am seeing in the logs are entries like broken pipe, connection reset by peer or "manager closed: closed: read tcp. These sound like they could result in a such a broken stream that the node does not terminate? Maybe?

These errors are the result of premature connection termination by the uplink—truncation of the long tail. I believe the node should close these connections immediately.

Ok, just to explain what I did during checking. I restarted the node. This of course kills all connections. Then I observed the log with all up and downloads showing well and successfully.
After short time I saw the first connection issue, I think it was an error broken pipe I am not sure but at least one of the errors I had posted.
And when I then did a check the mon/ps upload/downlowd immediately, then I saw exactly 1 that was already over the 30 seconds. So I was assuming it might be the one that showed the error in the log.
Eventually those over the time limits get killed at some point but it is unclear what might be the reason for that.

@Alexey

I am still seeing these:

[1234728980396061027,7862224747474764821] storj.io/common/rpc/rpctracing./piecestore.Piecestore/Download() (elapsed: 94h15m48.598703298s)
  [4990738292421645286,7862224747474764821] storj.io/storj/storagenode/piecestore.(*Endpoint).Download() (elapsed: 94h15m48.59866248s)

I don’t know if it is relevent to this but this is with --storage2.stream-operation-timeout 0m30s

My understanding is that the operation should be cancelled after 30 seconds.

And am I understanding this right that this is not a running download it is a connection that appears to be still open (probably long closed on the remote side)?

Likely yes, asked the team to confirm.

Yes, this doesn’t look right. We have potential fix so it should be on storage nodes in near future.