Hi @Fredrik_Jonsson , this is a known bug, and it has already been fixed on the master branch. You can safely ignore this log, it doesn’t affect correctness.
Comprehensive Response: Addressing “Memory Tracker’s Counter is Invalid” in TiDB 8.5.1
1. Confirmation of Known Bug
This is a known issue related to TiDB’s memory tracking subsystem. Similar bugs (e.g., memory leaks due to improper memTracker cleanup) were resolved in earlier versions like 7.5.3 and 8.1.1. The master branch includes further refinements to prevent invalid counter states.
2. Explanation & Impact
What It Means: The warning indicates a mismatch between actual memory usage and TiDB’s internal accounting. This occurs when memory allocations are not properly tracked (e.g., a component fails to release or update its memory counter).
Impact:
No Data Corruption: Queries and transactions remain correct.
Operational Risks:
Over/under-estimation of memory usage, potentially leading to unnecessary query cancellations or delayed OOM errors.
Minor performance degradation if memory recycling is inefficient.
3. Reassurance on Stability
Your system’s correctness and stability are unaffected. This is a non-critical, non-deterministic logging issue—not a data integrity flaw. Production clusters with this warning have operated safely while awaiting patches.
4. Recommended Immediate Actions
Monitor Memory Metrics:
Track Process Memory Usage and Goroutines in Grafana.
Check for spikes in tidb_server_maxprocs or frequent memory exceeds quota logs.
Post-Upgrade: Verify resolution via tidb.log and monitor for 24 hours.
6. Monitoring Recommendations
Key Metrics:
TiDB Memory Usage (Grafana dashboard).
Process Resident Memory per TiDB instance.
Query duration outliers (Sudden increases may indicate memory pressure).
Alerts:
Trigger alerts if memory usage exceeds 80% of system capacity.
Flag repeated invalid counter warnings (>10/hour).
Summary
This warning is a harmless accounting glitch in TiDB 8.5.1. While no immediate action is required, plan an upgrade to a patched version for long-term resolution. Monitor memory metrics closely, and rest assured that your data remains safe. For urgent concerns, contact PingCAP Support with logs and Grafana snapshots.