We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When running a project built with Thread Sanitizer enabled, the following data race is detected sometimes:
================== WARNING: ThreadSanitizer: data race (pid=33711) Read of size 2 at 0x7b3c00085f3c by thread T25: * #0 -[AFRKURLConnectionOperation state] AFRKURLConnectionOperation.m:133 (project:x86_64+0x10011c51c) #1 -[AFRKURLConnectionOperation isFinished] AFRKURLConnectionOperation.m:499 (project:x86_64+0x100114326) #2 __NSOQSchedule_f <null>:8182160 (Foundation:x86_64+0x3c632) #3 _dispatch_client_callout <null>:8182160 (libdispatch.dylib:x86_64+0x2b05b) Previous write of size 2 at 0x7b3c00085f3c by thread T11 (mutexes: write M660194180576176032): * #0 -[AFRKURLConnectionOperation setState:] AFRKURLConnectionOperation.m:417 (project:x86_64+0x10011290c) #1 -[AFRKURLConnectionOperation finish] AFRKURLConnectionOperation.m:547 (project:x86_64+0x10011578e) #2 -[AFRKURLConnectionOperation connectionDidFinishLoading:] AFRKURLConnectionOperation.m:772 (project:x86_64+0x10011aa0b) #3 __65-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]_block_invoke <null>:8182160 (CFNetwork:x86_64+0x29268) #4 __NSThread__start__ <null>:8182160 (Foundation:x86_64+0x31130) Issue is caused by frames marked with "*". Location is heap block of size 240 at 0x7b3c00085f20 allocated by main thread: #0 calloc <null>:8182176 (libclang_rt.tsan_iossim_dynamic.dylib:x86_64+0x46be2) #1 class_createInstance <null>:8182176 (libobjc.A.dylib:x86_64+0xfba0) #2 -[UIImageView(AFRKNetworking) setImageWithURL:placeholderImage:] UIImageView+AFRKNetworking.m:92 (project:x86_64+0x10026300c) #3 -[ShowDetailsController tableView:cellForRowAtIndexPath:] ShowDetailsController.m:130 (project:x86_64+0x10004cfd7) #4 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] <null>:8182176 (UIKit:x86_64+0x194ab1) #5 start <null>:8182176 (libdyld.dylib:x86_64+0x465c) Mutex M660194180576176032 is already destroyed. Thread T25 (tid=1351743, running) is a GCD worker thread Thread T11 (tid=1347018, running) created by thread T2 at: #0 pthread_create <null>:8182240 (libclang_rt.tsan_iossim_dynamic.dylib:x86_64+0x28f4d) #1 -[NSThread start] <null>:8182240 (Foundation:x86_64+0x30c4c) #2 dispatch_once <null>:8182240 (libclang_rt.tsan_iossim_dynamic.dylib:x86_64+0x64464) #3 +[AFRKURLConnectionOperation networkRequestThread] once.h:84 (project:x86_64+0x10010dcf4) #4 -[AFRKURLConnectionOperation start] AFRKURLConnectionOperation.m:511 (project:x86_64+0x100114554) #5 -[RKObjectRequestOperation execute] RKObjectRequestOperation.m:521 (project:x86_64+0x100213454) #6 __77-[RKObjectRequestOperation initWithHTTPRequestOperation:responseDescriptors:]_block_invoke RKObjectRequestOperation.m:330 (project:x86_64+0x10020f8e1) #7 __45-[RKOperationStateMachine setExecutionBlock:]_block_invoke_2 RKOperationStateMachine.m:175 (project:x86_64+0x10021e8f7) #8 __tsan::invoke_and_release_block(void*) <null>:8182240 (libclang_rt.tsan_iossim_dynamic.dylib:x86_64+0x637fb) #9 _dispatch_client_callout <null>:8182240 (libdispatch.dylib:x86_64+0x2b05b) SUMMARY: ThreadSanitizer: data race AFRKURLConnectionOperation.m:133 in -[AFRKURLConnectionOperation state] ==================
Adding an explicit state getter (with lock guard) seems to fix the issue:
- (AFRKOperationState)state { AFRKOperationState state; [self.lock lock]; state = _state; [self.lock unlock]; return state; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
When running a project built with Thread Sanitizer enabled, the following data race is detected sometimes:
Adding an explicit state getter (with lock guard) seems to fix the issue:
The text was updated successfully, but these errors were encountered: