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

TMDiskCache trash directory creation on the calling thread #68

Merged
merged 1 commit into from
Dec 13, 2014

Conversation

napoapo77
Copy link
Contributor

Having the trash directory creation happening asynchronously leads to a race condition and potential crash on slower hardware.
One of my test cases run against iPhone 4 failed consistently in TMDiskCache.m line 205 with Cocoa error 4 because the temp directory was not yet created when consumed for the first time.
This is one time, quick operation and the temp directory has to be readily available when sharedTrashURL returns control on the calling thread?

@ejensen
Copy link
Contributor

ejensen commented Nov 14, 2014

+1 I'm also seeing removal failures on older hardware due to this issue.

@bonebox
Copy link

bonebox commented Nov 26, 2014

I'm also seeing this error when using the latest AWS iOS SDK 2.0. (2.0.12) which is using TMCache 1.2.2.

@irace irace added the duplicate label Dec 4, 2014
@irace
Copy link
Contributor

irace commented Dec 4, 2014

Need to look closer but I think this might be a duplicate of #69

@irace irace added the bug label Dec 4, 2014
@napoapo77
Copy link
Contributor Author

I guess 69 tries to solve the very same issue, but is prone to deadlock if the calling thread is the same sharedTrashQueue one.
Here it does not make any difference what calling thread you use to instantiate the sharedTrashURL.

BTW I have also noticed one more place where object instantiation happens asynchronously and although that might be alright in practice when the object creation is well ahead of first usage and/or the hardware is decent, it eventually bombs for older hardware and/or automated tests.

@napoapo77
Copy link
Contributor Author

Will find the other place and post a separate pull request for you guys to have a look.

irace added a commit that referenced this pull request Dec 13, 2014
TMDiskCache trash directory creation on the calling thread
@irace irace merged commit 87d54d4 into TumblrArchive:master Dec 13, 2014
@irace
Copy link
Contributor

irace commented Dec 13, 2014

Thanks for your contribution, this has been released as part of TMCache 1.2.3.

@napoapo77
Copy link
Contributor Author

Glad I could help and happy TMCache is well supported and maintained!

@irace
Copy link
Contributor

irace commented Dec 14, 2014

@napoapo77 Thanks, we're definitely going to try to be better maintainers going forward.

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

Successfully merging this pull request may close these issues.

4 participants