morningman commented on code in PR #69044:
URL: https://github.com/apache/doris/pull/69044#discussion_r4267751666
##########
fe/fe-core/src/main/java/org/apache/doris/common/profile/Profile.java:
##########
@@ -663,11 +681,14 @@ private String getProfileCompletionStateForStorage() {
return SummaryProfile.PROFILE_COMPLETION_STATE_COMPLETE;
}
- private void updateProfileCompletionStateForStorage() {
-
summaryProfile.setProfileCompletionState(getProfileCompletionStateForStorage());
+ private synchronized void updateProfileCompletionStateForStorage() {
+ // Freeze the terminal state before serialization. Concurrent
rendering must not
+ // replace INCOMPLETE with COLLECTING while the storage path is still
unpublished.
+ storageProfileCompletionState = getProfileCompletionStateForStorage();
+
summaryProfile.setProfileCompletionState(storageProfileCompletionState);
}
- private void updateProfileCompletionStateForDisplay() {
+ private synchronized void updateProfileCompletionStateForDisplay() {
Review Comment:
Fixed in 936df2bceb7. The cycle is real: `ProfileManager.getProfile()`
renders under the manager's read lock, while `updateSummary()` and
`clearExecutionProfiles()` hold the Profile monitor and then wait for the
manager's write lock in `pushProfile()` / `removeProfile()`. The two
completion-state helpers now synchronize on a dedicated `completionStateLock`.
Under it they only take the execution profile's report lock and the summary's
info-string lock, and neither of those is held while waiting for the Profile
monitor or a manager lock. `renderingDoesNotWaitForProfileMonitor` renders a
profile while the test holds the Profile monitor: it times out with the
synchronized helpers and passes now. A test that rebuilds the whole cycle would
hang rather than fail, so the test pins the property that breaks it. branch-4.1
and branch-4.2, where this code comes from, have the same deadlock.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]