Skip to content

🐛 FileHandler actor's append(line:) method crashes on some devices #5667

@keremerkan

Description

@keremerkan

Describe the bug

I am getting rare crashes from some users. The problem starts with PaywallEventsManager.track(featureEvent:) which seems to call PaywallEventStore.store(_:) and that calls FileHandler.append(line:). Perhaps due to insufficient space or some other problem, this method crashes at line 81 on self.fileHandle.write(line.asData)

The issue can happen both in background or while the app is open. I see crashes from iOS 15 and 18, so perhaps it affects all iOS versions.

Platform

iOS

SDK version

RevenueCat 5.44.0

SDK integration method

Swift Package Manager

StoreKit version

StoreKit 2 (default on versions >=5.0.0)

OS version

iOS 15-18

Xcode version

26.0

Device and/or simulator

Device

Environment

Production

How widespread is the issue

Rare, perhaps 1%

Debug logs

Last Exception Backtrace:
0   CoreFoundation                	0x18f2880c0 __exceptionPreprocess + 164 (NSException.m:249)
1   libobjc.A.dylib               	0x18c721abc objc_exception_throw + 88 (objc-exception.mm:356)
2   Foundation                    	0x18e07054c _NSFileHandleRaiseOperationExceptionWhileReading + 272 (NSFileHandle.m:72)
3   Foundation                    	0x18de6a8ac -[NSConcreteFileHandle writeData:] + 300 (NSFileHandle.m:905)
4   MyApp                       	0x101233f28 FileHandler.append(line:) + 20 (FileHandler.swift:81)
5   MyApp                       	0x101233f28 protocol witness for FileHandlerType.append(line:) in conformance FileHandler + 20 (/<compiler-generated>:77)
6   MyApp                       	0x101233f28 PaywallEventStore.store(_:) + 144 (PaywallEventStore.swift:50)
7   MyApp                       	0x1012b23ad specialized PaywallEventsManager.track(featureEvent:) + 1 (PaywallEventsManager.swift:50)
8   MyApp                       	0x1012a12a1 <deduplicated_symbol> + 1
9   MyApp                       	0x100dce341 <deduplicated_symbol> + 1
10  MyApp                       	0x100eff831 <deduplicated_symbol> + 1
11  MyApp                       	0x100dce6bd <deduplicated_symbol> + 1
12  MyApp                       	0x100e3c591 specialized thunk for @escaping @isolated(any) @callee_guaranteed @async () -> (@out A) + 1
13  MyApp                       	0x100dce6bd <deduplicated_symbol> + 1
14  libswift_Concurrency.dylib    	0x19abd1241 completeTaskWithClosure(swift::AsyncContext*, swift::SwiftError*) + 1 (Task.cpp:537)

Steps to reproduce

I myself cannot reproduce the problem.

Other information

Additional context

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions