Cache fails to store large files
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 38/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- objective-c
- Domain
- mobile-dev
Research direction
Start with SPTPersistentCache's storeDataSync:forKey:ttl:locked:withCallback:onQueue: method and inspect the NSMutableData allocation using rawDataLength. Reproduce the failure with data over 100MB, then verify that large data can be cached successfully and that the write remains atomic. No specific file or test is mentioned.
Written by the indexing model from the issue text.
Description
Whenever we try to save large files (>100MB, actual size depends on device capabilities) to cache, nothing happens except console log message like
*** mach_vm_map(size=997462016) failed (error code=3)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
The problem is in SPTPersistentCache method
- (NSError *)storeDataSync:(NSData *)data
forKey:(NSString *)key
ttl:(NSUInteger)ttl
locked:(BOOL)isLocked
withCallback:(SPTPersistentCacheResponseCallback)callback
onQueue:(dispatch_queue_t)queue
The following code does not work for large rawDataLength
NSMutableData *rawData = [NSMutableData dataWithCapacity:rawDataLength];
One way to handle large amounts of data is to fill temporary file with relatively small blocks of data first and then writing it atomically to target filePath
- Dominant language
- Objective-C
- Stars
- 1.2k
- Forks
- 74
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from spotify/SPTPersistentCache
-
Difficulty 1/5 Under an hour Newbie friendliness 55/100
spotify/SPTPersistentCache#125 · 1 reaction ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
spotify/SPTPersistentCache#105 · 2 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
spotify/SPTPersistentCache#102 ·
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
spotify/SPTPersistentCache#99 · 3 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
All issues in spotify/SPTPersistentCache
Similar issues
-
Suzhou subway logo OpenIcons Metro Public Transport
Difficulty 1/5 Under an hour Newbie friendliness 75/100
organicmaps/organicmaps#13617 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
objective-see/LuLu#925 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
noah-nuebling/mac-mouse-fix#2054 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
obsproject/obs-studio#13918 ·