pinterest / PINCache

Fast, non-deadlocking parallel object cache for iOS, tvOS and OS X
Apache License 2.0
2.66k stars 361 forks source link

Fix a race between -[removeAllObjects] and -[removeObjectForKey:] which could cause an item to not be removed #296

Closed mjbshaw closed 3 years ago

mjbshaw commented 3 years ago

This fixed #295

garrettmoon commented 3 years ago

Great writeup in the issue and fix, thank you! Would you mind checking to see if the Carthage error is related to your change? Seems to be tvOS specific?

mjbshaw commented 3 years ago

I don't think the Carthage error is related. Running make carthage locally on master also fails:

$ git clone https://github.com/pinterest/PINCache.git
Cloning into 'PINCache'...
remote: Enumerating objects: 42, done.
remote: Counting objects: 100% (42/42), done.
remote: Compressing objects: 100% (30/30), done.
remote: Total 3811 (delta 12), reused 24 (delta 7), pack-reused 3769
Receiving objects: 100% (3811/3811), 13.96 MiB | 11.82 MiB/s, done.
Resolving deltas: 100% (2142/2142), done.
$ cd PINCache
$ make carthage
carthage update --no-use-binaries --no-build
*** Fetching PINOperation
*** Checking out PINOperation at "1.2.1"
carthage build --no-skip-current
*** xcodebuild output can be found in /var/folders/d_/hj61jd596lx70cd65k9f8gk8009nf7/T/carthage-xcodebuild.3xheOw.log
*** Building scheme "PINOperation-macOS" in PINOperation.xcodeproj
*** Building scheme "PINOperation-watchOS" in PINOperation.xcodeproj
*** Building scheme "PINOperation-tvOS" in PINOperation.xcodeproj
Build Failed
    Task failed with exit code 1:
    /usr/bin/xcrun lipo -create /Users/mjbshaw/Library/Caches/org.carthage.CarthageKit/DerivedData/12.1_12A7403/PINOperation/1.2.1/Build/Intermediates.noindex/ArchiveIntermediates/PINOperation-tvOS/IntermediateBuildFilesPath/UninstalledProducts/appletvos/PINOperation.framework/PINOperation /Users/mjbshaw/Library/Caches/org.carthage.CarthageKit/DerivedData/12.1_12A7403/PINOperation/1.2.1/Build/Products/Release-appletvsimulator/PINOperation.framework/PINOperation -output /tmp/PINCache/Carthage/Build/tvOS/PINOperation.framework/PINOperation

This usually indicates that project itself failed to compile. Please check the xcodebuild log for more details: /var/folders/d_/hj61jd596lx70cd65k9f8gk8009nf7/T/carthage-xcodebuild.3xheOw.log
make: *** [carthage] Error 1
garrettmoon commented 3 years ago

Ah, indeed you are correct. I've fixed it in master. Do you mind rebasing?

mjbshaw commented 3 years ago

Done. All checks pass now. Thanks for fixing that!