iOS app crashes on iPhone 14 Pro with offline mode enabled
Bug Report
Description
iOS app crashes immediately when offline mode is enabled on iPhone 14 Pro devices.
Environment
- Device: iPhone 14 Pro, iPhone 14 Pro Max
- iOS Version: 17.0, 17.1
- App Version: 2.3.0
- Frequency: 100% reproduction rate
- Impact: ~8% of iOS user base (iPhone 14 Pro users)
Steps to Reproduce
- Open app on iPhone 14 Pro
- Navigate to Settings → Offline Mode
- Toggle "Enable Offline Mode" ON
- App crashes immediately
Crash Log
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000010
Triggered by Thread: 0
Thread 0 Crashed:
0 OfflineStorage 0x000000010423c4f8 -[AsyncStorageManager saveData:] + 120
1 RecommendationService 0x000000010425a3dc -[RecommendationService cacheRecommendations:] + 348
2 UIKit 0x00000001a8e5c7b8 -[UIApplication _run] + 828
Root Cause Analysis
Initial findings:
-
AsyncStorage memory issue
- Allocating 180MB for offline cache
- iPhone 14 Pro has aggressive memory limits
- Not releasing memory properly
-
Sync queue race condition
- Background sync thread conflicts with UI thread
- Not using proper locking mechanisms
-
Database schema issue
- WatermelonDB migration fails on new devices
- Schema version mismatch
Affected Features
-
✅ Offline recommendation caching: CRASHES -
✅ Offline reading mode: CRASHES -
⚠️ Sync when online: Untested (can't reach feature)
Impact Metrics
- Crash rate: 8.2% of iOS sessions
- Affected users: ~24,000 users
- App Store rating: Dropped from 4.6 to 4.1
- Support tickets: 340 in past week
Proposed Fix
Immediate (This week)
- Disable offline mode for iPhone 14 Pro:
const isIPhone14Pro = DeviceInfo.getModel().includes('iPhone15,2');
if (isIPhone14Pro) {
// Hide offline mode setting
return null;
}
-
Release hotfix 2.3.1:
- Remove offline mode for affected devices
- Add analytics to track impact
Short-term (Week 2)
- Fix memory allocation:
// Chunk large data writes
const CHUNK_SIZE = 10 * 1024 * 1024; // 10MB chunks
for (let i = 0; i < data.length; i += CHUNK_SIZE) {
await AsyncStorage.setItem(key, data.slice(i, i + CHUNK_SIZE));
await new Promise(resolve => setTimeout(resolve, 100)); // Release event loop
}
- Add proper locking:
import { Mutex } from 'async-mutex';
const mutex = new Mutex();
await mutex.runExclusive(async () => {
await AsyncStorage.setItem(key, value);
});
- Database migration fix:
await database.write(async () => {
await database.unsafeResetDatabase();
await migrateDatabase();
});
Testing Plan
-
Test on iPhone 14 Pro simulator -
Test on physical iPhone 14 Pro device -
Test with large offline cache (100MB+) -
Test background sync scenarios -
Memory profiling with Instruments
Rollout Plan
- Beta release (Oct 12): TestFlight to 100 users
- Phased rollout (Oct 15): 10% → 50% → 100%
- Monitor crash rates daily
- Rollback if crash rate > 2%
Related Issues
- Relates to: #7 (closed) (offline mode implementation)
- Relates to: #6 (closed) (AI recommendations - offline caching)
- Blocked by: #3 (closed) (data sync implementation)
Priority: CRITICAL - 8% crash rate Type: Bug