Skip to content
Launch GitLab Knowledge Graph

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

  1. Open app on iPhone 14 Pro
  2. Navigate to Settings → Offline Mode
  3. Toggle "Enable Offline Mode" ON
  4. 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:

  1. AsyncStorage memory issue

    • Allocating 180MB for offline cache
    • iPhone 14 Pro has aggressive memory limits
    • Not releasing memory properly
  2. Sync queue race condition

    • Background sync thread conflicts with UI thread
    • Not using proper locking mechanisms
  3. 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)

  1. Disable offline mode for iPhone 14 Pro:
const isIPhone14Pro = DeviceInfo.getModel().includes('iPhone15,2');
if (isIPhone14Pro) {
  // Hide offline mode setting
  return null;
}
  1. Release hotfix 2.3.1:
    • Remove offline mode for affected devices
    • Add analytics to track impact

Short-term (Week 2)

  1. 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
}
  1. Add proper locking:
import { Mutex } from 'async-mutex';
const mutex = new Mutex();

await mutex.runExclusive(async () => {
  await AsyncStorage.setItem(key, value);
});
  1. 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

  1. Beta release (Oct 12): TestFlight to 100 users
  2. Phased rollout (Oct 15): 10% → 50% → 100%
  3. Monitor crash rates daily
  4. 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

cc: @michael_usanchenko @jean_gabriel @bill_staples