-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Fixed issue where transaction sample elapsed time was incorrectly inflated when a thread was stopped #6770
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Fixed issue where transaction sample elapsed time was incorrectly inflated when a thread was stopped #6770
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -252,6 +252,14 @@ public static boolean isFromTransactionController(SampleResult res) { | |
| public void triggerEndOfLoop() { | ||
| if(!isGenerateParentSample()) { | ||
| if (res != null) { | ||
| // See BUG 55816 / GitHub issue #6496 | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This comment is incorrect: Please describe the actual case, for example: "The loop ends early, so the time since the last child sample ended counts as idle time, as it does in
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed |
||
| // When the thread is stopped mid-transaction (e.g. during ramp-down), | ||
| // we must account for the time elapsed since the last child sample ended | ||
| // as pause/idle time, so it is not counted in the transaction elapsed time. | ||
| if (!isIncludeTimers()) { | ||
| long processingTimeOfLastChild = res.currentTimeInMillis() - prevEndTime; | ||
| pauseTime += processingTimeOfLastChild; | ||
| } | ||
| res.setIdleTime(pauseTime + res.getIdleTime()); | ||
| res.sampleEnd(); | ||
| res.setSuccessful(TRUE.equals(JMeterContextService.getContext().getVariables().get(JMeterThread.LAST_SAMPLE_OK))); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setEndTime(start + elapsedTimeMs)sets an end time in the future without waiting for it. The child then appears to finish after the transaction'scurrentTimeInMillis(), andTransactionSampler.setTransactionDone()can compute a negative idle time. Either make the fixed elapsed time explicit withsetStampAndTime(start, elapsedTimeMs)and assert the resulting idle time too, or add a comment that the test relies on this.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed