Skip to content

Reduce false Firefox NS_BINDING_ABORTED health-check failures on cold starts#4

Open
Copilot wants to merge 3 commits into
mainfrom
copilot/debug-expense-keeper-requests
Open

Reduce false Firefox NS_BINDING_ABORTED health-check failures on cold starts#4
Copilot wants to merge 3 commits into
mainfrom
copilot/debug-expense-keeper-requests

Conversation

Copilot AI commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Firefox was reporting NS_BINDING_ABORTED for GET /health and GET /ml/docs because client-side AbortController timeouts were too aggressive during backend/ML cold start windows. This updates health probe timing to reduce premature cancellation while preserving the existing wake/retry flow.

  • Health-check timeout alignment (Login flow)

    • Increased /health probe timeout from 5s → 15s for both initial and retry checks.
    • Increased /ml/docs probe timeout from 8s → 15s for both initial and retry checks.
  • ML probe timeout alignment (Predict flow)

    • Increased /ml/docs probe timeout from 8s → 15s for both initial and retry checks.
  • Behavioral impact

    • Fewer client-aborted probes during Render cold starts.
    • Lower incidence of false-negative “server unavailable” states caused by short frontend abort windows.
// Before
const timeoutId = setTimeout(() => controller.abort(), 8000);

// After
const timeoutId = setTimeout(() => controller.abort(), 15000);

@vercel

vercel Bot commented Jun 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
expense-keeper Ready Ready Preview, Comment Jun 9, 2026 5:52pm

@SumeetDUTTA SumeetDUTTA marked this pull request as ready for review June 9, 2026 17:29
Copilot AI review requested due to automatic review settings June 9, 2026 17:29

Copilot AI left a comment

Copy link
Copy Markdown

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 adjusts frontend AbortController timeout windows used by /health and /ml/docs probes to reduce false “server unavailable” states (notably Firefox NS_BINDING_ABORTED) during backend/ML cold starts, while keeping the existing wake + retry behavior.

Changes:

  • Increased ML probe timeout (/ml/docs) to 15s in both Predict and Login flows (initial + retry).
  • Increased backend health probe timeout (/health) to 15s in the Login flow (initial + retry).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
frontend/src/pages/Predict.jsx Extends /ml/docs abort timeout from 8s to 15s for initial + retry ML readiness checks.
frontend/src/pages/Login.jsx Extends /ml/docs and /health abort timeouts to 15s for initial + retry readiness checks during login/signup.
Comments suppressed due to low confidence (5)

frontend/src/pages/Predict.jsx:96

  • Same timer-cleanup issue in the retry probe: if the retry fetch throws before reaching clearTimeout(retryTimeoutId), the timeout remains scheduled. Use try/finally so the timeout is always cleared.
						const retryController = new AbortController();
						const retryTimeoutId = setTimeout(() => retryController.abort(), 15000); // 15s timeout

						const retryResponse = await fetch('/ml/docs', {
							method: 'GET',
							signal: retryController.signal
						});

frontend/src/pages/Login.jsx:146

  • clearTimeout(timeoutId) is only executed if fetch('/ml/docs', ...) resolves; if fetch throws (abort/network), the timeout stays scheduled. Wrap the fetch in a try/finally so the timer is always cleared.
				const controller = new AbortController();
				const timeoutId = setTimeout(() => controller.abort(), 15000); // 15s timeout for ML server

				const response = await fetch('/ml/docs', {
					method: 'GET',
					signal: controller.signal
				});

frontend/src/pages/Login.jsx:177

  • Same timer-cleanup issue in the ML retry probe: if the retry fetch throws before clearTimeout(retryTimeoutId), the timeout remains pending. Use try/finally so the timeout is always cleared.
						const retryController = new AbortController();
						const retryTimeoutId = setTimeout(() => retryController.abort(), 15000); // 15s timeout

						const retryResponse = await fetch('/ml/docs', {
							method: 'GET',
							signal: retryController.signal
						});

frontend/src/pages/Login.jsx:220

  • clearTimeout(timeoutId) is only reached when the backend health fetch resolves successfully; if it throws (abort/network error), the timeout remains scheduled. Wrap the fetch in a try/finally so the timer is always cleared.
				const controller = new AbortController();
				const timeoutId = setTimeout(() => controller.abort(), 15000); // 15s timeout

				const response = await fetch(`/health`, {
					method: 'GET',
					signal: controller.signal
				});

frontend/src/pages/Login.jsx:251

  • Same timer-cleanup issue in the backend retry probe: if the retry fetch throws before clearTimeout(retryTimeoutId), the timeout remains scheduled. Use try/finally so the timer is always cleared.
						const retryController = new AbortController();
						const retryTimeoutId = setTimeout(() => retryController.abort(), 15000); // 15s timeout

						const retryResponse = await fetch(`/health`, {
							method: 'GET',
							signal: retryController.signal
						});

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

Comment thread frontend/src/pages/Predict.jsx Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

Comment thread frontend/src/pages/Predict.jsx Outdated
Comment thread frontend/src/pages/Predict.jsx Outdated
Comment thread frontend/src/pages/Login.jsx Outdated
Comment thread frontend/src/pages/Login.jsx Outdated
Comment thread frontend/src/pages/Login.jsx Outdated
Comment thread frontend/src/pages/Login.jsx Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@SumeetDUTTA SumeetDUTTA left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

done

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.

3 participants