Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Freezing while saving? #24

Open
adib opened this issue May 16, 2014 · 5 comments
Open

Freezing while saving? #24

adib opened this issue May 16, 2014 · 5 comments

Comments

@adib
Copy link
Contributor

adib commented May 16, 2014

Is calling [super saveToURL: ofType saveOperation: error] inside a performAsynchronousFileAccessUsingBlock call a good idea?

My app sometimes freezes at this point and I wonder if there's a re-entrancy issue here:

scuttlebutt__bsmanageddocument_m

I'm on BSManagedDocument 0.3.x commit f7fc8dc

Also the app has a number of documents open concurrently (different package files of course).

@mikeabdullah
Copy link
Collaborator

Can you show me the rest of the stack at this point, please?

@adib
Copy link
Contributor Author

adib commented May 17, 2014

Finally I figured out how to show the full stack traces...

bsmanageddocument_freeze_trace_1

bsmanageddocument_freeze_trace_2

bsmanageddocument_freeze_trace_3

bsmanageddocument_freeze_trace_4

Those were all the threads that were active when the app froze.

At a glance threads 1 and 9 seems to be calling the main thread when this happens. Wonder if the contention is among those two?

@adib
Copy link
Contributor Author

adib commented May 17, 2014

Just thinking out loud, maybe NSDocument's file coordinator is not setup correctly to handle file packages?

@adib
Copy link
Contributor Author

adib commented May 17, 2014

This happens during autosave, NSAutosaveInPlaceOperation

@adib
Copy link
Contributor Author

adib commented May 17, 2014

Apparently the bugger is with file coordination. Although nothing else is supposed to be accessing the file package (and for my case, there shouldn't be any since it's in the apps' Application Support folder and not normally accessible directly by the user), [NSDocument saveToURL: ofType: forSaveOperation: completionHandler: freezes on file coordination and it seems that there's no way to work around it but skipping it altogether.

I have something that's been working OK, will push this out as part of a beta release and see whether there's any negative repercussion for not using NSDocument's save implementation.

Commit: a216aea

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants