Skip to content

[MWPW-192702] Fixing issues observed from evaluating the errors in analytics dashboard. #740

Merged
arugupta1992 merged 3 commits into
stagefrom
analyticsIssues
Apr 23, 2026
Merged

[MWPW-192702] Fixing issues observed from evaluating the errors in analytics dashboard. #740
arugupta1992 merged 3 commits into
stagefrom
analyticsIssues

Conversation

@arugupta1992
Copy link
Copy Markdown
Collaborator

@arugupta1992 arugupta1992 commented Apr 15, 2026

@arugupta1992 arugupta1992 added bug fix Something isn't working firefly labels Apr 15, 2026
@aem-code-sync
Copy link
Copy Markdown

aem-code-sync Bot commented Apr 15, 2026

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch and validate page speed.
In case there are problems, just click a checkbox below to rerun the respective action.

  • Re-run PSI checks
  • Re-sync branch
Commits

);
} else {
await this.uploadImgToUnity(href, id, file, file.type, signal);
await this.scanImgForSafety(this.assetId, signal);
Copy link
Copy Markdown
Collaborator Author

@arugupta1992 arugupta1992 Apr 15, 2026

Choose a reason for hiding this comment

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

The recursive call inside setTimeout inside scanImgForSafety is not awaited and its return value is discarded. This means Upload server error|UnityWidget is never logged for any HTTP-level failure from scanImgForSafety — and separately, the entire upload flow incorrectly reports success (Upload Completed|UnityWidget) even when the safety scan is failing in a detached infinite retry loop in the background.

const chunkInfo = { chunkIndex: i, chunkNumber };
failedChunks.add(chunkInfo);
if (onChunkError) onChunkError(chunkInfo, err);
if (err.name !== 'AbortError') {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

A dedicated chunkAbortController is created per upload session. Its signal is merged with the user-cancel signal via AbortSignal.any and passed to all chunks. When any chunk reaches final failure, chunkAbortController.abort() is called before throwing — immediately cancelling all sibling in-flight HTTP requests. AbortErrors in createChunkUploadTasks are excluded from failedChunks so only genuine failures are counted.

const timeout = setTimeout(() => controller.abort(), timeoutMs);
const passedSignal = options.signal || controller.signal;
const mergedOptions = { ...options, signal: passedSignal };
const mergedSignal = options.signal
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Used options.signal || controller.signal — only one signal was ever active. If an external signal was provided, the 60s timeout controller was completely ignored, making timeouts silently broken.

FIx: AbortSignal.any([controller.signal, options.signal]) — both fire correctly. The abort-source check (if (options.signal?.aborted) throw e) re-throws external aborts as AbortError instead of incorrectly converting them to TimeoutError. This means sibling chunk cancellations now correctly propagate as AbortError and are handled silently.

const onSuccessWithAttempt = onSuccess ? (response) => onSuccess(response, attempt) : null;
const onErrorWithAttempt = onError ? (error) => onError(error, attempt) : null;
let response = await this.fetchFromService(url, options, onSuccessWithAttempt, onErrorWithAttempt);
if (!response) {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

With this if fetchFromService returns undefined, the loop delays and retries (or breaks on the final attempt) instead of crashing.

@aem-code-sync aem-code-sync Bot temporarily deployed to analyticsIssues April 21, 2026 07:54 Inactive
@sigadamvenkata
Copy link
Copy Markdown
Collaborator

sigadamvenkata commented Apr 23, 2026

verified some flows as per given notes.
when user in went offline during upload
asset api 500, finalize calls, chunk upload failures
when user cancel upload not log to report etc

screen shots are updated in story. will do through testing in stage from user prospective to make sure rest of positive flows are fine @arugupta1992 @sanjayms01

@arugupta1992 arugupta1992 merged commit be78c2b into stage Apr 23, 2026
5 of 8 checks passed
arugupta1992 added a commit that referenced this pull request Apr 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug fix Something isn't working firefly verified

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants