-
Notifications
You must be signed in to change notification settings - Fork 25k
Closed
Labels
Resolution: LockedThis issue was locked by the bot.This issue was locked by the bot.
Description
On last react-native 0.43.2 Xcode find data race. This can affect layout performance
Explain what you did, what you expected to happen, and what actually happens.
Reproduction Steps and Sample Code
Run RN project with on ThreadSanitizer in Xcode. Display any view with a bridge.
Get next console log
==================
WARNING: ThreadSanitizer: data race (pid=91001)
Read of size 1 at 0x7d380005e328 by thread T30:
#0 -[RCTBatchedBridge isBatchActive] RCTBatchedBridge.m:1099 (Test:x86_64+0x1036ce8fc)
#1 -[RCTUIManager setNeedsLayout] RCTUIManager.m:1205 (Test:x86_64+0x1038c3bd3)
#2 __45-[RCTUIManager setAvailableSize:forRootView:]_block_invoke RCTUIManager.m:439 (Test:x86_64+0x1038ac4c1)
#3 __tsan::invoke_and_release_block(void*) <null>:3352480 (libclang_rt.tsan_iossim_dynamic.dylib:x86_64+0x6043b)
#4 _dispatch_client_callout <null>:3352480 (libdispatch.dylib:x86_64+0x2b05b)
Previous write of size 1 at 0x7d380005e328 by thread T25:
#0 -[RCTBatchedBridge handleBuffer:batchEnded:] RCTBatchedBridge.m:934 (Test:x86_64+0x1036c9b02)
#1 -[RCTBatchedBridge _processResponse:error:] RCTBatchedBridge.m:914 (Test:x86_64+0x1036c93ca)
#2 __69-[RCTBatchedBridge _actuallyInvokeAndProcessModule:method:arguments:]_block_invoke RCTBatchedBridge.m:884 (Test:x86_64+0x1036c85ed)
#3 __65-[RCTJSCExecutor _executeJSCall:arguments:unwrapResult:callback:]_block_invoke RCTJSCExecutor.mm:662 (Test:x86_64+0x103752b08)
#4 -[RCTJSCExecutor executeBlockOnJavaScriptQueue:] RCTJSCExecutor.mm:798 (Test:x86_64+0x1037541da)
2017-04-13 10:49:13.400 Test[91001:14246437] [BCRLocalizationModule] Translating Tag ios_appsearch_guests_love_filter_facilities
#5 -[RCTJSCExecutor _executeJSCall:arguments:unwrapResult:callback:] RCTJSCExecutor.mm:599 Test:x86_64+0x103750c20)
#6 -[RCTJSCExecutor _callFunctionOnModule:method:arguments:returnValue:unwrapResult:callback:] RCTJSCExecutor.mm:571 (Test:x86_64+0x10374ff06)
#7 -[RCTJSCExecutor callFunctionOnModule:method:arguments:callback:] RCTJSCExecutor.mm:576 (Test:x86_64+0x1037501c4)
#8 -[RCTBatchedBridge _actuallyInvokeAndProcessModule:method:arguments:] RCTBatchedBridge.m:880 (Test:x86_64+0x1036c8431)
#9 __57-[RCTBatchedBridge enqueueJSCall:method:args:completion:]_block_invoke RCTBatchedBridge.m:764 (Test:x86_64+0x1036c42e5)
#10 __40-[RCTBatchedBridge dispatchBlock:queue:]_block_invoke RCTBatchedBridge.m:662 (Test:x86_64+0x1036c1d7f)
2017-04-13 10:49:13.430 Test[91001:14246437] [BCRLocalizationModule] Translating Tag ios_explore_hello
#11 -[RCTJSCExecutor executeBlockOnJavaScriptQueue:] RCTJSCExecutor.mm:798 (Test:x86_64+0x1037541da)
#12 __NSThreadPerformPerform <null>:3352480 (Foundation:x86_64+0x6de50)
#13 __NSThread__start__ <null>:3352480 (Foundation:x86_64+0x30fb0)
Location is heap block of size 216 at 0x7d380005e2c0 allocated by main thread:
#0 calloc <null>:3352512 (libclang_rt.tsan_iossim_dynamic.dylib:x86_64+0x44222)
#1 class_createInstance <null>:3352512 (libobjc.A.dylib:x86_64+0xfba0)
#2 -[RCTBridge setUp] RCTBridge.m:297 (Test:x86_64+0x1036d7ad3)
#3 -[RCTBridge initWithDelegate:bundleURL:moduleProvider:launchOptions:] RCTBridge.m:192 (Test:x86_64+0x1036d5eb2)
#4 -[RCTBridge initWithDelegate:launchOptions:] RCTBridge.m:165 (Test:x86_64+0x1036d57c4)
#5 -[RNBridgeProvider bridge] RNBridgeProvider.m:48 (Test:x86_64+0x103ba4831)
#6 -[BCRectNativeFactory createTestViewViewController] BCRectNativeFactory.m:42 (Test:x86_64+0x103b89594)
#7 -[BCReactNativeTestHelper testController] BCReactNativeTestHelper.m:31 (Test:x86_64+0x1001c19c6)
#8 __64+[BCViewControllerMenuItemFactory createReactNativeTestMenuItem]_block_invoke BCViewControllerMenuItemFactory.m:241 (Test:x86_64+0x101aa52ee)
#9 -[BCTabbarMoreViewController openItem:] BCTabbarMoreViewController.m:146 (Test:x86_64+0x1000bb4fa)
#10 -[BCTabbarMoreViewController tableView:didSelectRowAtIndexPath:] BCTabbarMoreViewController.m:139 (Test:x86_64+0x1000bb3a6)
#11 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] <null>:3352512 (UIKit:x86_64+0x17edcc)
#12 start <null>:3352512 (libdyld.dylib:x86_64+0x465c)
Thread T30 (tid=14254905, running) created by thread T-1
[failed to restore the stack]
Thread T25 (tid=14246437, running) created by main thread at:
#0 pthread_create <null>:3352560 (libclang_rt.tsan_iossim_dynamic.dylib:x86_64+0x2689d)
#1 -[NSThread start] <null>:3352560 (Foundation:x86_64+0x30acc)
#2 -[RCTJSCExecutor initWithUseCustomJSCLibrary:] RCTJSCExecutor.mm:246 (Test:x86_64+0x1037450ca)
#3 -[RCTJSCExecutor init] RCTJSCExecutor.mm:236 (Test:x86_64+0x103744d59)
#4 -[RCTBatchedBridge initModulesWithDispatchGroup:] RCTBatchedBridge.m:322 (Test:x86_64+0x1036b9661)
#5 -[RCTBatchedBridge start] RCTBatchedBridge.m:129 (Test:x86_64+0x1036b3487)
#6 -[RCTBridge setUp] RCTBridge.m:298 (Test:x86_64+0x1036d7b58)
#7 -[RCTBridge initWithDelegate:bundleURL:moduleProvider:launchOptions:] RCTBridge.m:192 (Test:x86_64+0x1036d5eb2)
#8 -[RCTBridge initWithDelegate:launchOptions:] RCTBridge.m:165 (Test:x86_64+0x1036d57c4)
#9 -[RNBridgeProvider bridge] RNBridgeProvider.m:48 (Test:x86_64+0x103ba4831)
#10 -[BCRectNativeFactory createTestViewViewController] BCRectNativeFactory.m:42 (Test:x86_64+0x103b89594)
#11 -[BCReactNativeTestHelper testController] BCReactNativeTestHelper.m:31 (Test:x86_64+0x1001c19c6)
#12 __64+[BCViewControllerMenuItemFactory createReactNativeTestMenuItem]_block_invoke BCViewControllerMenuItemFactory.m:241 (Test:x86_64+0x101aa52ee)
#13 -[BCTabbarMoreViewController openItem:] BCTabbarMoreViewController.m:146 (Test:x86_64+0x1000bb4fa)
2017-04-13 10:49:13.443 Test[91001:14246437] [BCRLocalizationModule] Translating Pluralized Tag ios_reviews_subheader_share_photos_done for 3
#14 -[BCTabbarMoreViewController tableView:didSelectRowAtIndexPath:] BCTabbarMoreViewController.m:139 (Test:x86_64+0x1000bb3a6)
#15 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] <null>:3352560 (UIKit:x86_64+0x17edcc)
#16 start <null>:3352560 (libdyld.dylib:x86_64+0x465c)
SUMMARY: ThreadSanitizer: data race RCTBatchedBridge.m:1099 in -[RCTBatchedBridge isBatchActive]
==================
Thread info:
thread #34: tid = 0xd98339, 0x00000001115cde90 libclang_rt.tsan_iossim_dynamic.dylib`__tsan_on_report, queue = 'com.facebook.react.ShadowQueue', stop reason = Data race detected
{
"all_addresses_are_same" : true,
"description" : "Data race",
"instrumentation_class" : "ThreadSanitizer",
"issue_type" : "data-race",
"location_description" : "Location is a 216-byte heap object at 0x7d380005e2c0",
"locs" : [
{
"address" : 0,
"file_descriptor" : 0,
"index" : 0,
"size" : 216,
"start" : 137679472026304,
"suppressable" : 0,
"thread_id" : 28,
"trace" : [
4586185251,
4711140257,
4520749780,
4520742579,
4520740805,
4525783090,
4525671829,
4465084871
],
"type" : "heap"
}
],
"memory_address" : 137679472026408,
"mops" : [
{
"address" : 137679472026408,
"index" : 0,
"is_atomic" : false,
"is_write" : false,
"size" : 1,
"thread_id" : 34,
"trace" : [
4520712445,
4522765268,
4522669250,
4586300476,
4742209628
]
},
{
"address" : 137679472026408,
"index" : 1,
"is_atomic" : false,
"is_write" : true,
"size" : 1,
"thread_id" : 26,
"trace" : [
4520692483,
4520690635,
4520687086,
4521253641,
4521259483,
4521245729,
4521242375,
4521243077
]
}
],
"mutexes" : [
],
"report_count" : 0,
"sleep_trace" : [
],
"stacks" : [
],
"stop_description" : "Data race detected",
"summary" : "Data race in -[RCTBatchedBridge isBatchActive] at 0x7d380005e2c0",
"threads" : [
{
"index" : 0,
"name" : "",
"parent_thread_id" : 0,
"running" : 1,
"thread_id" : 34,
"thread_os_id" : 14254905,
"trace" : [
]
},
{
"index" : 1,
"name" : "",
"parent_thread_id" : 28,
"running" : 1,
"thread_id" : 26,
"thread_os_id" : 14246437,
"trace" : [
4586064030,
4639357645,
4521197771,
4521196890,
4520625762,
4520600712,
4520749913,
4520742579
]
},
{
"index" : 2,
"name" : "",
"parent_thread_id" : 28,
"running" : 1,
"thread_id" : 28,
"thread_os_id" : 91001,
"trace" : [
]
}
],
"unique_tids" : [
]
}
Solution
Lock write of this variable
Additional Information
- React Native version: 0.43.2
- Platform: iOS
- Development Operating System: macOS 10.12
- Dev tools: Xcode 4.3, iPhone 7 Simulator with iOS 10.3
Metadata
Metadata
Assignees
Labels
Resolution: LockedThis issue was locked by the bot.This issue was locked by the bot.