⬆️ ⬇️

Recovery of iPhoto when the import hangs

I have a hobby - photography.

For cataloging by chance I use a full-time Epplovo program called iPhoto.



This thing is not bug-free, one way or another all the time it is trying to completely lose or damage the photo-library, but in the absence of good alternatives, it is necessary to use it.



Recently I ran into a problem: the camera was incorrectly removed during the import and, as a result, the “import” slider appeared in iPhoto and the program heroically refused to finish correctly:

')





Fast googling showed that the problem is very common, but everyone is advised to do a “force quit” with the subsequent restoration of the library. Once I lost almost a hundred photos, so I decided to look for other alternatives to the solution.



I admit that this text will help someone.







I will describe successively my steps, if suddenly someone notices an error in my reflections - please correct.



  1. Repeated, deeper googling

    Repeated search showed that this problem may occur due to 2 reasons: damage to access rights on the disk and incorrectly mounted disk from which the import was performed, as a result of which it remains on the list, however, access to it cannot be made.
  2. Create backup

    Just in case, I decided to make a copy of the library. The Time Machine copy was made about a week ago and since then there have been some changes in it. Simple file duplication failed. The system swore dirtyly that the file is being used and refused to duplicate the library. Then it was decided to make a ZIP, but not through the Finder, but through the console. The process was launched - it's time to move on to other steps.
  3. Access Recovery

    Once they write that this may be a problem - you need to try. Analysis of the disk utility of access rights and disk check showed that everything is in perfect order. Ok, move on.
  4. Manual import cancel

    At this stage, all iPhoto was studied for the presence of the cherished button “cancel import”, but pressing the “cancel” button in the interface yielded nothing.
  5. Search for false mounted drives

    Since I don’t trust the disk utility GUI in this question, the “diskutil list” spell was entered in the console. The output of the team showed that the anomalies are not noticed and at first glance everything is fine



  6. Search import process

    The course of my thinking was simple - if you complete the import process, then iPhoto most likely will not close, but simply finish the import. The probability of crash is, of course, preserved, but it is rather small compared to the loss of images through the “force quit”.

    Through a regular system monitoring utility, I tried to find the import process. Failed. At the same time, while studying detailed information about the process, iPhoto found that the import was performed using one of the QuickTime components, but restarting QuickTime did not give anything, besides the import was a separate thread in the process, not a separate process, so pid could not be obtained.

    At the same time, interesting details surfaced - iPhoto kept several video files open, the source codes of which were already lost, which means that if the work was forced to end, these files would most likely be lost. Motivation increased

  7. Attempt to replace imports

    There remained one more interface solution - to import a large file into iPhoto in order to start importing again. iPhoto turned out to be smarter and just launched parallel imports.
  8. Pause / Restore

    Since my hopes for saving the library (it’s not just about files, but also about structure) were rapidly melting, and ZIP was successfully created by that time - I decided to try using a third-party file manager to pause the process and then start it again. The rainbow wheel was spinning for a long time, but it did not lead to anything concrete.
  9. Soft attempt to complete the application

    At one of the forums, it was read that if you send iPhoto a signal different from SIGKILL and the like, it still correctly finishes the work without damaging the media library. Read - done, the following signals were sent to the application in direct order:

    • SIGCHLD (child status has changed)
    • SIGSTP (stop signal generated from keyboard)
    • SIGALRM (real-time timer expired)


    On the last iPhoto, seconds 7 turned the rainbow wheel and collapsed.





After the reboot, the entire media library remained in a healthy state, did not have to recover and try to revive it. All photos and videos found in “open streams and files” were in place, including previews of all sizes and originals.



I hope these studies will help someone next time to keep their photo library in order.

Source: https://habr.com/ru/post/181910/



All Articles