Skip to content

RDKEMW-19034: [support/8.5.3.0] Xconf thread should wait Indefinitely for the NTP indicator#374

Merged
shibu-kv merged 1 commit into
support/1.8.5from
feature/RDKEMW-19034
May 26, 2026
Merged

RDKEMW-19034: [support/8.5.3.0] Xconf thread should wait Indefinitely for the NTP indicator#374
shibu-kv merged 1 commit into
support/1.8.5from
feature/RDKEMW-19034

Conversation

@yogeswaransky
Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings May 26, 2026 04:57
@yogeswaransky yogeswaransky requested a review from a team as a code owner May 26, 2026 04:57
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds an optional (compile-time) boot-time gate to the xconf worker thread so it can wait for an NTP “sync indicator” file before attempting the initial xconf fetch (to avoid TLS failures when system time isn’t yet valid).

Changes:

  • Introduces NTP sync gating helpers (waitForNTPSyncDir, waitForNTPSync) using inotify + select for low-CPU waiting and interruptible shutdown.
  • Adds platform-specific paths/macros for the NTP indicator file and its parent directory.
  • Hooks the NTP wait into getUpdatedConfigurationThread() before entering the main fetch loop.
Comments suppressed due to low confidence (1)

source/xconf-client/xconfclient.c:1045

  • stopFetchRemoteConfiguration is read under xcThreadMutex here, but it is written elsewhere without consistently taking the same mutex (e.g., stopXConfClient()/uninitXConfClient()). That makes the shutdown check a data race and can cause the new indefinite NTP wait to miss shutdown and hang on pthread_join. Consider making stopFetchRemoteConfiguration an atomic_bool or enforcing a single mutex for all reads/writes.
    {
        pthread_mutex_lock(&xcThreadMutex);
        bool shouldStop = stopFetchRemoteConfiguration;
        pthread_mutex_unlock(&xcThreadMutex);

Comment on lines +1000 to +1005
/*
* Most likely cause: NTP_SYNC_DIR does not exist yet (e.g. /tmp/systimemgr
* is created by systimemgr at startup). Wait up to 30 minutes for the
* directory to appear.
*/
T2Warning("inotify_add_watch on %s failed with errno=%d, waiting for directory\n", NTP_SYNC_DIR, errno);
Comment on lines +919 to +923
{
pthread_mutex_lock(&xcThreadMutex);
bool shouldStop = stopFetchRemoteConfiguration;
pthread_mutex_unlock(&xcThreadMutex);

Comment on lines +1071 to +1076
if (ret == 0)
{
continue; /* timeout, loop back to check shutdown flag */
}

ssize_t len = read(ifd, buf, sizeof(buf));
Comment on lines +1120 to +1125
#if defined(NTP_SYNC_INDICATION)
pthread_mutex_unlock(&xcThreadMutex);
if (!waitForNTPSync())
{
T2Warning("Proceeding without NTP sync confirmation\n");
}
@yogeswaransky yogeswaransky changed the title RDKEMW-18410: Xconf thread should wait Indefinitely for the NTP indicator RDKEMW-19034: [support/8.5.3.0] Xconf thread should wait Indefinitely for the NTP indicator May 26, 2026
@shibu-kv shibu-kv merged commit f4c1d94 into support/1.8.5 May 26, 2026
8 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators May 26, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants