Fix excessive location uploads (two critical issues)#106
Open
Perlover wants to merge 1 commit intotraccar:mainfrom
Open
Fix excessive location uploads (two critical issues)#106Perlover wants to merge 1 commit intotraccar:mainfrom
Perlover wants to merge 1 commit intotraccar:mainfrom
Conversation
Problem Analysis (from server logs): - 354,527 POST requests in 24 hours - Only 37,090 unique timestamps - Average: 9-10 duplicates per location - Some locations sent up to 22 times over 8+ hours - Location from 08:55:51 sent at: 00:00, 01:50, 03:40, 05:32, 07:44 Root Causes: 1. **Headless Isolate Cache Issue** - Headless tasks run in separate Dart isolates on Android - LocationCache._last (static in-memory) is null in each isolate - When cache is null, _shouldDelete() returns false - Result: NO filtering applied → locations sent every 1-2 seconds - 37k locations/day instead of normal 2k 2. **Locations Not Deleted After Sync** (CRITICAL) - autoSync: false with manual sync() calls - Plugin accumulates locations in database indefinitely - Each sync() resends ALL accumulated locations - Database grows: same location sent 2hrs later, 4hrs later, etc. - Result: 37k × 9 = 354k requests/day Solutions: 1. **Fallback filtering when cache is null** - Check SharedPreferences directly for lastTimestamp - Apply fastestInterval filtering even without in-memory cache - Prevents excessive location generation in headless mode 2. **Explicit location deletion after sync** - Call destroyLocation() immediately after successful sync() - Prevents database accumulation - Each location sent only once Impact: - Before: 354k requests/day (37k locations × 9 duplicates) - After: ~2k requests/day (normal operation) - Reduction: ~99.4% 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Author
|
This is the final commit from Claude with the analysis and fix. I gave him my entire log file from that day for analysis — he went through it and produced this analysis and patch. |
abhinay2022
approved these changes
Oct 25, 2025
rossigee
added a commit
to rossigee/traccar-client
that referenced
this pull request
Feb 25, 2026
…sues) - Fix headless isolate cache issue causing unfiltered location uploads - Add explicit location deletion after sync to prevent accumulation - Reduce from 354k requests/day to ~2k requests/day (99.4% reduction)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem Analysis (from server logs):
Root Causes:
Headless Isolate Cache Issue
Locations Not Deleted After Sync (CRITICAL)
Solutions:
Fallback filtering when cache is null
Explicit location deletion after sync
Impact:
🤖 Generated with Claude Code