Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 877369
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T11:35:47+00:00 2026-05-15T11:35:47+00:00

I have an NSOperation which fetches some objects from a core data persistent store

  • 0

I have an NSOperation which fetches some objects from a core data persistent store and sums up a few totals. Sometimes an object is deleted while the operation in in progress, so a core data fault exception occurs. I try/catch the exception while summing to ignore it because I just want to skip objects that cannot be faulted in.

However, when one of these fault exceptions occurs (and I swallow it) there is a crash after the invocation returns in [NSInvocation invoke]. It’s a bad memory access when dereferencing the value in r10 which according to GDB on a successful run points to one of these:

(gdb) x 0x38388348
0x38388348 <OBJC_IVAR_$_NSInvocation._retdata>:     0x00000008

If a fault exception occured a value of 0x02 is in the register which causes the crash.

A quick google search tells me that r10 should be saved by the callee, meaning it is not being restored by whatever code is changing it when this exception occurs.

Can anybody explain this? I’m not an expert when it comes to these kinds of low-level details

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T11:35:48+00:00Added an answer on May 15, 2026 at 11:35 am

    I think you’re asking the wrong question. A Cocoa application should never throw an exception under normal operation. You need to address the cause of that exception before doing anything else.

    You should not be accessing a single managed object context from multiple threads, or if you are you need to lock it very carefully. Multithreaded access to one context is highly dangerous, and can lead to the kind of behavior you are observing. From the “Multi-Threading with Core Data” section of the Core Data Programming Guide:

    If you want to work with a managed
    object across different threads, you
    must lock its context (see NSLocking).
    If you try to pass actual objects,
    share contexts between threads, and so
    on, you must be extremely careful
    about locking (and as a consequence
    you are likely to negate any benefit
    you may otherwise derive from
    multi-threading). Working with a
    managed object across different
    threads is therefore strongly
    discouraged, as described in “General
    Guidelines.”

    It is recommended that you use a separate managed object context for your background thread (with the same persistent store and managed object model), and do all of the reads you need for your summation operation there.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 464k
  • Answers 464k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Using standard sockets to communicate will be portable among different… May 16, 2026 at 1:11 am
  • Editorial Team
    Editorial Team added an answer setContentView(webview) is not possible, are you sure you're passing the… May 16, 2026 at 1:11 am
  • Editorial Team
    Editorial Team added an answer I agree with gnibbler that this is a job for… May 16, 2026 at 1:11 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.