Cache Troubleshooting¶
Solutions for common caching issues.
Low Cache Hit Rate¶
Symptoms¶
- Cache stats show low hit rate (<50%)
- Builds not faster than expected
- Same files rebuilding repeatedly
Diagnosis¶
Common Causes¶
Non-Deterministic Inputs¶
Builds that include timestamps, random values, or machine-specific paths:
Solution: Remove non-deterministic inputs or normalize them.
Environment Differences¶
Different compilers or flags between machines:
Solution: Standardize build environments.
Missing Dependencies¶
Implicit dependencies not declared in build files:
Solution: Declare all dependencies properly.
Compiler Version Changes¶
Different compiler versions produce different artifacts.
Solution: Use consistent compiler versions across team/CI.
Cache Not Working¶
Symptoms¶
- Every build is a cache miss
- Cache stats show 0% hit rate
- Cache directory empty or not growing
Diagnosis¶
Common Causes¶
Caching Disabled¶
Solution:
Permission Issues¶
Solution:
Disk Full¶
Solution:
Remote Cache Issues¶
Cannot Connect¶
Solutions:
- Check firewall rules
- Verify server is running
- Check network connectivity
- Use
automode for fallback
Authentication Failures¶
Solutions:
- Verify token is correct
- Check token hasn't expired
- Contact cache administrator
Slow Remote Cache¶
Solutions:
# Increase timeouts
export RNINJA_CACHE_CONNECT_TIMEOUT=10
export RNINJA_CACHE_REQUEST_TIMEOUT=60
# Or use local-first
export RNINJA_CACHE_PULL_POLICY=on_miss
Cache Corruption¶
Symptoms¶
- Build errors mentioning cache
- Inconsistent build results
- Health check failures
Diagnosis¶
Solution¶
# Try garbage collection first
rninja -t cache-gc
# If still broken, clear cache
rm -rf ~/.cache/rninja
# Rebuild
rninja
Build Produces Wrong Results¶
Symptoms¶
- Build succeeds but output is incorrect
- Different results with/without cache
- Stale artifacts being used
Diagnosis¶
# Build without cache
RNINJA_CACHE_ENABLED=0 rninja -t clean && RNINJA_CACHE_ENABLED=0 rninja
# Compare to cached build
rninja -t clean && rninja
Common Causes¶
Undeclared Dependencies¶
File changes not detected because dependency not declared.
Solution: Add missing dependencies to build file.
Order-Dependent Builds¶
Build depends on execution order.
Solution: Make build deterministic.
Emergency Fix¶
# Disable caching temporarily
RNINJA_CACHE_ENABLED=0 rninja
# Report issue at github.com/neul-labs/rninja/issues
Cache Too Large¶
Symptoms¶
- Disk space warnings
- Cache using excessive storage
Diagnosis¶
Solutions¶
# Set size limit
export RNINJA_CACHE_MAX_SIZE=5G
# Run garbage collection
rninja -t cache-gc
# Set age limit
export RNINJA_CACHE_MAX_AGE=604800 # 7 days
Performance Issues¶
Cache Slower Than Expected¶
Check Cache Location¶
Check Cache Health¶
Builds Slower with Cache¶
Rare, but possible with:
- Very fast builds (cache overhead > build time)
- Slow disk
- Network cache latency
Solution:
Debugging Tools¶
Enable Debug Logging¶
Cache Statistics¶
Health Check¶
Getting Help¶
If issues persist:
-
Collect information:
-
Check GitHub Issues: github.com/neul-labs/rninja/issues
-
Open new issue with:
- rninja version
- Operating system
- Steps to reproduce
- Cache stats output