-
Notifications
You must be signed in to change notification settings - Fork 7
VPLAY-12337 : Crash issue is observed while switch between different … #876
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev_sprint_25_2
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8151,10 +8151,33 @@ void PrivateInstanceAAMP::Stop( bool isDestructing ) | |
| { | ||
| std::lock_guard<std::mutex> guard(mMutexPlaystart); | ||
| waitforplaystart.notify_all(); | ||
| AAMPLOG_WARN("HariPriya Stop: notified PreCache thread, isDestructing=%d", isDestructing); | ||
| } | ||
| if(mPreCachePlaylistThreadId.joinable()) | ||
| { | ||
| mPreCachePlaylistThreadId.join(); | ||
| auto joinStartTime = NOW_STEADY_TS_MS; | ||
|
||
| AAMPLOG_WARN("HariPriya Stop: About to join PreCache thread, isDestructing=%d", isDestructing); | ||
|
|
||
| // Fix for GC deadlock: During GC finalization (isDestructing=true), the PreCache thread | ||
| // may be blocked in network I/O (curl_easy_perform). Using join() would block the main | ||
| // thread indefinitely, causing freeze/crash. Instead, use detach() to let the thread | ||
| // clean up itself. The thread will exit safely once network I/O completes. | ||
| if (isDestructing) | ||
| { | ||
| AAMPLOG_WARN("HariPriya Stop: Detaching PreCache thread (GC path) to avoid blocking, isDestructing=%d", isDestructing); | ||
| mPreCachePlaylistThreadId.detach(); | ||
| } | ||
| else | ||
| { | ||
| // Normal stop path - wait for thread to complete | ||
| mPreCachePlaylistThreadId.join(); | ||
| auto joinDuration = NOW_STEADY_TS_MS - joinStartTime; | ||
| AAMPLOG_WARN("HariPriya Stop: PreCache thread joined after %lld ms, isDestructing=%d", joinDuration, isDestructing); | ||
| } | ||
| } | ||
| else | ||
| { | ||
| AAMPLOG_INFO("HariPriya Stop: PreCache thread not joinable, isDestructing=%d", isDestructing); | ||
| } | ||
|
|
||
| if (mAampCacheHandler) | ||
|
|
@@ -10271,14 +10294,17 @@ void PrivateInstanceAAMP::PreCachePlaylistDownloadTask() | |
| { | ||
| // This is the thread function to download all the HLS Playlist in a | ||
| // differed manner | ||
| AAMPLOG_WARN("PreCachePlaylistDownloadTask: Thread started"); | ||
| int maxWindowForDownload = mPreCacheDnldTimeWindow * 60; // convert to seconds | ||
| int szPlaylistCount = (int)mPreCacheDnldList.size(); | ||
| if(szPlaylistCount) | ||
| { | ||
| // First wait for Tune to complete to start this functionality | ||
| { | ||
| std::unique_lock<std::mutex> lock(mMutexPlaystart); | ||
| AAMPLOG_WARN("PreCachePlaylistDownloadTask: Waiting for playstart notification"); | ||
| waitforplaystart.wait(lock); | ||
|
||
| AAMPLOG_WARN("PreCachePlaylistDownloadTask: Received playstart notification, proceeding"); | ||
| } | ||
| // May be Stop is called to release all resources . | ||
| // Before download , check the state | ||
|
|
@@ -10312,7 +10338,25 @@ void PrivateInstanceAAMP::PreCachePlaylistDownloadTask() | |
| bool ret = false; | ||
| // Using StreamLock to avoid StreamAbstractionAAMP deletion when external player commands or stop call received | ||
| AcquireStreamLock(); | ||
| auto getFileStartTime = NOW_STEADY_TS_MS; | ||
| AAMPLOG_WARN("HariPriya PreCachePlaylistDownloadTask: About to call GetFile (network I/O), state=%d", GetState()); | ||
|
|
||
| // DEBUG: Simulate slow network to reproduce GC deadlock issue | ||
| // Set AAMP_SIMULATE_SLOW_PRECACHE_MS env var to inject delay (e.g., export AAMP_SIMULATE_SLOW_PRECACHE_MS=5000) | ||
| const char* delayEnv = getenv("AAMP_SIMULATE_SLOW_PRECACHE_MS"); | ||
| if (delayEnv) | ||
| { | ||
| int delayMs = atoi(delayEnv); | ||
|
||
| if (delayMs > 0) | ||
| { | ||
| AAMPLOG_WARN("HariPriya PreCachePlaylistDownloadTask: DEBUG - Simulating slow network with %d ms delay", delayMs); | ||
| std::this_thread::sleep_for(std::chrono::milliseconds(delayMs)); | ||
| } | ||
| } | ||
|
Comment on lines
+10344
to
+10355
|
||
|
|
||
| ret = GetFile(newelem.url, newelem.type, &playlistStore, playlistEffectiveUrl, &http_code, &downloadTime, NULL, eCURLINSTANCE_PLAYLISTPRECACHE, true ); | ||
| auto getFileDuration = NOW_STEADY_TS_MS - getFileStartTime; | ||
| AAMPLOG_WARN("HariPriya PreCachePlaylistDownloadTask: GetFile returned after %lld ms, ret=%d, state=%d", getFileDuration, ret, GetState()); | ||
| ReleaseStreamLock(); | ||
| if(ret != false) | ||
| { | ||
|
|
@@ -10337,11 +10381,12 @@ void PrivateInstanceAAMP::PreCachePlaylistDownloadTask() | |
| } | ||
| } | ||
| }while (idx < mPreCacheDnldList.size() && state != eSTATE_STOPPING && state != eSTATE_IDLE && state != eSTATE_ERROR); | ||
| AAMPLOG_WARN("HariPriya PreCachePlaylistDownloadTask: Exiting loop, state=%d, idx=%d, size=%zu", state, idx, mPreCacheDnldList.size()); | ||
| mPreCacheDnldList.clear(); | ||
| CurlTerm(eCURLINSTANCE_PLAYLISTPRECACHE); | ||
| } | ||
| } | ||
| AAMPLOG_WARN("End of PreCachePlaylistDownloadTask "); | ||
| AAMPLOG_WARN("PreCachePlaylistDownloadTask: Thread exiting, state=%d", GetState()); | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -14448,5 +14493,3 @@ void PrivateInstanceAAMP::SetStreamCaps(AampMediaType type, MediaCodecInfo&& cod | |
| if (sink) | ||
| { | ||
| sink->SetStreamCaps(type, std::move(codecInfo)); | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Log messages contain the developer's name 'HariPriya'. This is unprofessional and makes logs harder to search and filter. Remove the name prefix from all log messages (lines 8154, 8159, 8162, 8166, 10328, 10338, 10345, 10370) and use descriptive, context-specific prefixes instead.