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

[Crash] CZWebImage Crash - caused by CZHttpFile.WriteFile threadsafety. #37

Closed
geekaurora opened this issue Jun 1, 2021 · 0 comments
Closed

Comments

@geekaurora
Copy link
Owner

geekaurora commented Jun 1, 2021

Description

CZGithubAppKit - CZWebImage Crash (Force quit 5 times: Data = empty)(First page)

Reason

  • data is empty (non-nil): so can't be transformed to image = nil: triggers assertion
    • Same image downloads: Same URL not cancelled

Details

Write to file wasn't atomic, and no ioQueue.async(flags: .barrier):

In CZDiskCacheManager.setCacheFile(),
data.write(to: fileURL) should be data.write(to: fileURL, options: [.atomic]).

Solution

In CZDiskCacheManager.setCacheFile(),

Others

  • cleanDiskCacheIfNeeded() - only if shouldEnableCachedItemsDict is true.
@geekaurora geekaurora changed the title CZWebImage Crash - after force quit app 5 times. [Crash] CZWebImage Crash - after force quit app 5 times. Jun 1, 2021
@geekaurora geekaurora transferred this issue from geekaurora/CZWebImage Jun 29, 2021
@geekaurora geekaurora changed the title [Crash] CZWebImage Crash - after force quit app 5 times. [Crash] CZWebImage Crash - caused by WriteFile threadsafety. Jun 29, 2021
@geekaurora geekaurora changed the title [Crash] CZWebImage Crash - caused by WriteFile threadsafety. [Crash] CZWebImage Crash - caused by CZHttpFile.WriteFile threadsafety. Jun 29, 2021
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

1 participant