ftchirou / PredicateKit

🎯 PredicateKit allows Swift developers to write expressive and type-safe predicates for CoreData using key-paths, comparisons and logical operators, literal values, and functions.
MIT License
408 stars 19 forks source link

Lib crashes randomly with signal SIGABRT #22

Open srenrd opened 11 months ago

srenrd commented 11 months ago

The lib crashes randomly on Line 335: return try context.fetch(request) in public func result() throws -> [Entity]

It seemed like it started after upgrading to xCode 15.

PS. I'm using it for SwiftUI.

ftchirou commented 11 months ago

Hey @srenrd! Thank you for reporting this. Please could you provide a small sample project reproducing the issue? Thank you.

srenrd commented 11 months ago

Hi, I've tried to recreate this bug in a new project, but without success. It is far to random. During a day of development i get this crash 0-2 times. However it does seem like large data sets and SwiftUI navigationLink plays a part in the crash.

I'll keep investigating and report back with further details.

srenrd commented 4 months ago

Hi again. I've managed to catch a bit of info on this. As described before, it seems totally random when this happens. But it is always the same line of code that crashes.

It happens when the .result() is called.

App(14673,0x305b87000) malloc: Non-aligned pointer 0x6000006f6b20 being freed (2) App(14673,0x305b87000) malloc: *** set a breakpoint in malloc_error_break to debug

Screenshot 2024-06-07 at 10 24 30
ftchirou commented 4 months ago

I wonder if this is concurrency related. Do you get any errors/warnings when you pass the CoreData concurrency debug arguments on launch to your app?

-com.apple.CoreData.ConcurrencyDebug 1