MINOR: Update Trogdor ConnectionStressWorker status at the end of execution#6445
MINOR: Update Trogdor ConnectionStressWorker status at the end of execution#6445cmccabe merged 4 commits intoapache:trunkfrom stanislavkozlovski:minor-improve-trogdor-connection-stress-worker-status
Conversation
| doneFuture.complete(""); | ||
| workerExecutor.shutdownNow(); | ||
| workerExecutor.awaitTermination(1, TimeUnit.DAYS); | ||
| synchronized (ConnectionStressWorker.this) { |
There was a problem hiding this comment.
Even though calling updateStatus() here is thread-safe, I think that using the lock here acts as a memory barrier and allows us to access the latest values of the variables. I very well might be wrong though and this may be superfluous
There was a problem hiding this comment.
It's not thread-safe without the synchronized, since we're accessing variables that need synchronization. But let's move the synchronized keyword into ConnectionStressWorker#updateStatus, as described above, since that's a bit cleaner
| * Update the worker's status. | ||
| * This method should be called inside a lock on the ConnectionStressWorker object | ||
| */ | ||
| private void updateStatus(long lastTimeMs) { |
There was a problem hiding this comment.
This function should be synchronized since it accesses totalConnections, totalFailedConnections, etc. which are only ever accessed under the lock.
|
Thanks, @stanislavkozlovski . Great find. I left a few comments. |
…dBugs IS2_INCONSISTENT_SYNC warning
| this.totalConnections = 0; | ||
| this.totalFailedConnections = 0; | ||
| this.startTimeMs = TIME.milliseconds(); | ||
| synchronized (ConnectionStressWorker.this) { |
There was a problem hiding this comment.
Had to add this here otherwise we got a FindBugs warning
IS | Inconsistent synchronization of org.apache.kafka.trogdor.workload.ConnectionStressWorker.nextReportTime; locked 66% of time
-- | --
| Bug type IS2_INCONSISTENT_SYNC (click for details) In class org.apache.kafka.trogdor.workload.ConnectionStressWorkerField org.apache.kafka.trogdor.workload.ConnectionStressWorker.nextReportTimeSynchronized 66% of the timeUnsynchronized access at ConnectionStressWorker.java:[line 107]Synchronized access at ConnectionStressWorker.java:[line 124]Synchronized access at ConnectionStressWorker.java:[line 162]
IS | Inconsistent synchronization of org.apache.kafka.trogdor.workload.ConnectionStressWorker.startTimeMs; locked 50% of time
| Bug type IS2_INCONSISTENT_SYNC (click for details) In class org.apache.kafka.trogdor.workload.ConnectionStressWorkerField org.apache.kafka.trogdor.workload.ConnectionStressWorker.startTimeMsSynchronized 50% of the timeUnsynchronized access at ConnectionStressWorker.java:[line 104]Synchronized access at ConnectionStressWorker.java:[line 120]
IS | Inconsistent synchronization of org.apache.kafka.trogdor.workload.ConnectionStressWorker.totalConnections; locked 66% of time
| Bug type IS2_INCONSISTENT_SYNC (click for details) In class org.apache.kafka.trogdor.workload.ConnectionStressWorkerField org.apache.kafka.trogdor.workload.ConnectionStressWorker.totalConnectionsSynchronized 66% of the timeUnsynchronized access at ConnectionStressWorker.java:[line 102]Synchronized access at ConnectionStressWorker.java:[line 120]Synchronized access at ConnectionStressWorker.java:[line 120]
IS | Inconsistent synchronization of org.apache.kafka.trogdor.workload.ConnectionStressWorker.totalFailedConnections; locked 50% of time
| Bug type IS2_INCONSISTENT_SYNC (click for details) In class org.apache.kafka.trogdor.workload.ConnectionStressWorkerField org.apache.kafka.trogdor.workload.ConnectionStressWorker.totalFailedConnectionsSynchronized 50% of the timeUnsynchronized access at ConnectionStressWorker.java:[line 103]Synchronized access at ConnectionStressWorker.java:[line 120]
(see IS2_INCONSISTENT_SYNC in http://findbugs.sourceforge.net/bugDescriptions.html)
|
LGTM |
|
Failed test is |
* apache/trunk: MINOR: Retain public constructors of classes from public API (apache#6455) KAFKA-8118; Ensure ZK clients are closed in tests, fix verification (apache#6456) KAFKA-7813: JmxTool throws NPE when --object-name is omitted KAFKA-8114: Wait for SCRAM credential propagation in DelegationTokenEndToEndAuthorizationTest (apache#6452) KAFKA-8111; Set min and max versions for Metadata requests (apache#6451) KAFKA-7855: Kafka Streams Maven Archetype quickstart fails to compile out of the box (apache#6194) MINOR: Update code to not use deprecated methods (apache#6434) MINOR: Update Trogdor ConnectionStressWorker status at the end of execution (apache#6445) KAFKA-8091; Use commitSync to check connection failure in listener update test (apache#6450) KAFKA-7027: Add an overload build method in scala (apache#6373) MINOR: Fix typos in LogValidator (apache#6449) KAFKA-7502: Cleanup KTable materialization logic in a single place (apache#6174) KAFKA-7730; Limit number of active connections per listener in brokers (KIP-402) KAFKA-8091; Remove unsafe produce from dynamic listener update test (apache#6443) MINOR: Fix JavaDocs warnings (apache#6435) MINOR: Better messaging for invalid fetch response (apache#6427) MINOR: Use Java 8 lambdas in KStreamImplTest (apache#6430)
…cution (apache#6445) Reviewers: Colin P. McCabe <cmccabe@apache.org>
I was testing this worker locally and found that it would not report correct numbers after it shutting down due to the
durationMspassing.Status before patch:
Status after patch: