[Prior 1] dlt_user: fix deadlock by stopping threads before locking dlt_mutex - #915
Open
minminlittleshrimp wants to merge 2 commits into
Open
minminlittleshrimp wants to merge 2 commits into
minminlittleshrimp wants to merge 2 commits into
Conversation
Collaborator
Author
|
Hello @santhoshsivanhere |
Collaborator
Author
|
Discussion has been made, split this into 3 PRs.
|
minminlittleshrimp
force-pushed
the
fix-dlt-user-deadlock
branch
3 times, most recently
from
September 21, 2026 17:13
463f644 to
d9f4aa7
Compare
minminlittleshrimp
force-pushed
the
fix-dlt-user-deadlock
branch
from
September 21, 2026 17:34
d9f4aa7 to
21a15b6
Compare
dlt_free() held dlt_mutex while calling dlt_stop_threads(), but the housekeeper thread needs dlt_mutex to proceed (e.g. inside dlt_user_log_check_user_message). Since pthread_mutex_lock is not a cancellation point, pthread_cancel could not interrupt the blocked housekeeper, causing pthread_join to deadlock. - Move dlt_stop_threads() before dlt_mutex_lock() in dlt_free() - Add cooperative exit check at top of housekeeper loop (~500ms latency) - On MSYS2/MinGW: cooperative wait (1s) + pthread_cancel fallback - On Linux/other: pthread_cancel directly (no added latency) - Reset dlt_user_housekeeper_exit_requested in dlt_start_threads() to prevent stale flag from previous dlt_free() cycle - Guard CLOCK_MONOTONIC for MSYS2/MinGW in condattr and clock_gettime - Add pthread_condattr_destroy() after pthread_cond_init() Signed-off-by: LUU QUANG MINH <Minh.LuuQuang@vn.bosch.com>
Replace 'SpacesInParens: Never' (clang-format 16+) with 'SpacesInParentheses: false' (clang-format 14 compatible). Signed-off-by: LUU QUANG MINH <Minh.LuuQuang@vn.bosch.com>
minminlittleshrimp
force-pushed
the
fix-dlt-user-deadlock
branch
from
September 21, 2026 17:35
21a15b6 to
c68c8b6
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
dlt_user: fix deadlock by stopping threads before locking dlt_mutex
dlt_free() held dlt_mutex while calling dlt_stop_threads(), but the
housekeeper thread needs dlt_mutex to proceed (e.g. inside
dlt_user_log_check_user_message). Since pthread_mutex_lock is not a
cancellation point, pthread_cancel could not interrupt the blocked
housekeeper, causing pthread_join to deadlock.
to prevent stale flag from previous dlt_free() cycle
Signed-off-by: LUU QUANG MINH Minh.LuuQuang@vn.bosch.com