jetty-load-generator icon indicating copy to clipboard operation
jetty-load-generator copied to clipboard

ReportListener incorrectly reports getSentBytesRate and getReceivedBytesRate

Open lachlan-roberts opened this issue 10 months ago • 3 comments

The sentBytes and recvBytes fields on ReportListener.Report are set by ReportListener.onComplete by using the ConnectionStatistics instance.

However at the time onComplete is called the ConnectionStatistics has not been updated.

I can see at the time ReportListener.onComplete is called that both sentBytes and recvBytes are 0.

And then after I wait for reportListener.whenComplete().join() I can manually inspect the ConnectionStatistics and it has correct values (bytes in/out=2264849/2579828).

lachlan-roberts avatar Apr 22 '24 02:04 lachlan-roberts

@lachlan-roberts ConnectionStatistics updates the values when the connection is closed.

Trying to update the values when a connection is open is racy and likely the value will be stale -- that's why it is done at connection close.

We have https://github.com/jetty/jetty.project/issues/5826 to track this.

sbordet avatar Apr 22 '24 07:04 sbordet

@sbordet I understand that, I'm not saying we need live connection statistics for this, but there is probably some race where ReportListener is trying to get the stats before the connection is closed.

lachlan-roberts avatar Apr 22 '24 10:04 lachlan-roberts

@sbordet I confimed that ReportListener#onComplete(LoadGenerator generator) is called before any of the connections are closed with ReportListener#onClosed(Connection).

lachlan-roberts avatar Apr 23 '24 04:04 lachlan-roberts