Skip to content

Comments

DELIA-69998-[Stress][Sercomm RTK ES1]: tr69hostif crash seen in devic…#360

Open
Vismalskumar0 wants to merge 1 commit intosupport/1.2.9from
feature/DELIA-69998
Open

DELIA-69998-[Stress][Sercomm RTK ES1]: tr69hostif crash seen in devic…#360
Vismalskumar0 wants to merge 1 commit intosupport/1.2.9from
feature/DELIA-69998

Conversation

@Vismalskumar0
Copy link
Contributor

DELIA-69998-[Stress][Sercomm RTK ES1]: tr69hostif crash seen in device boot-up during CDL migration/Reboot test

Reason for change:Fix SIGSEGV crashes caused by uninitialized variables.Initialize pthread_t variable to 0 to prevent pthread_join from being called on uninitialized thread IDs when pthread_create fails

…e boot-up during CDL migration/Reboot test

DELIA-69998-[Stress][Sercomm RTK ES1]: tr69hostif crash seen in device boot-up during CDL migration/Reboot test

Reason for change:Fix SIGSEGV crashes caused by uninitialized variables.Initialize pthread_t variable  to 0 to prevent pthread_join from being called on uninitialized thread IDs when pthread_create fails
@Vismalskumar0 Vismalskumar0 requested a review from a team as a code owner February 13, 2026 10:28
Copilot AI review requested due to automatic review settings February 13, 2026 10:28
Copy link
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 aims to prevent tr69hostif boot-time crashes by avoiding pthread_join() on uninitialized thread identifiers, and adds an early-exit path when shutdown has been triggered.

Changes:

  • Initialize parodus_init_tid to 0 to avoid using an uninitialized pthread_t when pthread_create fails.
  • Return early from main() after the GLib main loop exits if shutdown was triggered.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

#if defined(PARODUS_ENABLE)
// Parodus Init Thread
pthread_t parodus_init_tid;
pthread_t parodus_init_tid =0;
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

pthread_t is an opaque type and POSIX doesn’t guarantee that "0" is an invalid thread ID. Using = 0 plus if (parodus_init_tid) relies on a non-portable sentinel and can still be wrong on some platforms/toolchains. Safer approach: track a separate bool/atomic<bool> flag for successful pthread_create (or wrap thread lifecycle) and only pthread_join when that flag is set; alternatively initialize with pthread_t{} and use an explicit created flag rather than comparing the ID to 0.

Suggested change
pthread_t parodus_init_tid =0;
pthread_t parodus_init_tid{};

Copilot uses AI. Check for mistakes.
Comment on lines +534 to +535
if (isShutdownTriggered)
return 0;
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

Reading isShutdownTriggered here introduces a data race: it’s written from exit_gracefully() (shutdown thread) but read in main() without any synchronization, which is undefined behavior in C++. Consider making it std::atomic<bool> (or protect reads/writes with the existing mutex), and clarify whether returning here is intended since it now skips all thread joins/cleanup and isn’t mentioned in the PR description.

Suggested change
if (isShutdownTriggered)
return 0;

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant