jetty-load-generator
jetty-load-generator copied to clipboard
ReportListener incorrectly reports getSentBytesRate and getReceivedBytesRate
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 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 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.
@sbordet I confimed that ReportListener#onComplete(LoadGenerator generator)
is called before any of the connections are closed with ReportListener#onClosed(Connection)
.