Skip to content

fix: resolve race conditions and memory leaks in useEffect data fetching#158

Open
vrutank14t7 wants to merge 1 commit intoc2siorg:mainfrom
vrutank14t7:fix/race-condition-abort-controller
Open

fix: resolve race conditions and memory leaks in useEffect data fetching#158
vrutank14t7 wants to merge 1 commit intoc2siorg:mainfrom
vrutank14t7:fix/race-condition-abort-controller

Conversation

@vrutank14t7
Copy link
Copy Markdown

Closes #157

Problem

When stepping through GDB rapidly, multiple concurrent axios requests
fire without cancellation. A delayed response can overwrite fresh UI
data with stale data. Also causes memory leak when component unmounts
mid-request.

Affected Files

  • Stack.jsx
  • BreakPoints.jsx
  • Functions.jsx
  • MemoryMap.jsx

Fix

  • Added AbortController to all 4 components
  • Cleanup function cancels inflight requests on unmount
  • Guard clause prevents API calls when refresh is false
  • Removed duplicate outer async functions

Testing

  • No console.log statements ✅
  • No duplicate functions ✅
  • Cleanup function returns controller.abort() ✅

- Add AbortController to Stack, BreakPoints, Functions, MemoryMap
- Cancel inflight requests on component unmount or rapid refresh
- Add guard clause to prevent API calls when refresh is false
- Remove duplicate outer async functions that were never called
- Prevents stale data overwriting fresh UI state on rapid user actions
- Eliminates memory leak warnings on unmounted components
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.

[Bug] race condition and memory leak in useEffect data fetching

1 participant