Nimble icon indicating copy to clipboard operation
Nimble copied to clipboard

Nimble crashes out when accessing Core Data properties in notifications fired off the main thread

Open johnmckerrell opened this issue 3 years ago • 1 comments

  • [x] I have read CONTRIBUTING and have done my best to follow them.

What did you do?

Used toEventuallyNot(postNotifications(..)) wrapping a Core Data operation that occurs on a background context.

What did you expect to happen?

The check to pass.

What actually happened instead?

The test crashed. It appears to be because NotificationCollector is collecting up the notifications, whatever thread they were thrown on, and then accessing them from the main thread.

Environment

List the software versions you're using:

  • Quick: 4.0.0
  • Nimble: 9.2.1
  • Xcode Version: 13.2.1 and 13.3
  • Swift Version: Xcode Default

Please also mention which package manager you used and its version. Delete the other package managers in this list:

  • Carthage: 0.38.0 (Use carthage version in Terminal)

Project that demonstrates the issue

I would like to do this but I did a PR first so I'm going to just go that way first.

johnmckerrell avatar Mar 25 '22 20:03 johnmckerrell

Have to admit, since posting this I remembered that the reason we were getting a crash 💥 was because we were passing the following argument:

-com.apple.CoreData.ConcurrencyDebug 1

Still, I don't think it hurts to have Nimble be a bit more safe with the notification threads.

johnmckerrell avatar Mar 27 '22 15:03 johnmckerrell

Bumping this to the next (major?) release in favor of getting async/await support out the door sooner.

younata avatar Oct 31 '22 21:10 younata