Skip to content

<TextView>: Intermittent crash in [NSTextStorage dealloc] during AutoRelease  #357

@tom-un

Description

@tom-un

Issue

There is an intermittent crash in [NSTextStorage dealloc] during the drain of an AutoRelease pool. It happens intermittently most often during the [RNTesterSnapshotTests testTextExample] test.

The NSTextStorage object being released was owned by RCTTextView objects.

2020-05-11 13:50:34.285967-0700 RNTester-macOSIntegrationTests-Runner[72779:2414902] [General] An uncaught exception was raised
2020-05-11 13:50:34.294847-0700 RNTester-macOSIntegrationTests-Runner[72779:2414902] [General] *** -[NSConcretePointerArray pointerAtIndex:]: attempt to access pointer at index 166 beyond bounds 166
2020-05-11 13:50:34.295194-0700 RNTester-macOSIntegrationTests-Runner[72779:2415404] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSConcretePointerArray pointerAtIndex:]: attempt to access pointer at index 166 beyond bounds 166'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007fff3177fd07 __exceptionPreprocess + 250
	1   libobjc.A.dylib                     0x00007fff6a4a35bf objc_exception_throw + 48
	2   Foundation                          0x00007fff33d6876c -[NSConcretePointerArray removePointerAtIndex:] + 0
	3   UIFoundation                        0x00007fff626914f8 _NSRemoveDirtyLayoutManager + 98
	4   UIFoundation                        0x00007fff62691325 -[NSLayoutManager dealloc] + 33
	5   CoreFoundation                      0x00007fff316a1485 __RELEASE_OBJECTS_IN_THE_ARRAY__ + 118
	6   CoreFoundation                      0x00007fff316a13c8 -[__NSArrayM dealloc] + 279
	7   UIFoundation                        0x00007fff626b982e -[NSTextStorage dealloc] + 102
	8   UIFoundation                        0x00007fff626b97b4 -[NSConcreteTextStorage dealloc] + 91
	9   libobjc.A.dylib                     0x00007fff6a4b4054 _ZN19AutoreleasePoolPage12releaseUntilEPP11objc_object + 134
	10  libobjc.A.dylib                     0x00007fff6a498dba objc_autoreleasePoolPop + 175
	11  libdispatch.dylib                   0x00007fff6b5f1641 _dispatch_last_resort_autorelease_pool_pop + 27
	12  libdispatch.dylib                   0x00007fff6b5f764a _dispatch_lane_invoke + 479
	13  libdispatch.dylib                   0x00007fff6b600c09 _dispatch_workloop_worker_thread + 596
	14  libsystem_pthread.dylib             0x00007fff6b84ba3d _pthread_wqthread + 290
	15  libsystem_pthread.dylib             0x00007fff6b84ab77 start_wqthread + 15
)
2020-05-11 13:50:34.295371-0700 RNTester-macOSIntegrationTests-Runner[72779:2414902] [General] (
	0   CoreFoundation                      0x00007fff3177fd07 __exceptionPreprocess + 250
	1   libobjc.A.dylib                     0x00007fff6a4a35bf objc_exception_throw + 48
	2   Foundation                          0x00007fff33d6876c -[NSConcretePointerArray removePointerAtIndex:] + 0
	3   UIFoundation                        0x00007fff626914f8 _NSRemoveDirtyLayoutManager + 98
	4   UIFoundation                        0x00007fff62691325 -[NSLayoutManager dealloc] + 33
	5   CoreFoundation                      0x00007fff316a1485 __RELEASE_OBJECTS_IN_THE_ARRAY__ + 118
	6   CoreFoundation                      0x00007fff316a13c8 -[__NSArrayM dealloc] + 279
	7   UIFoundation                        0x00007fff626b982e -[NSTextStorage dealloc] + 102
	8   UIFoundation                        0x00007fff626b97b4 -[NSConcreteTextStorage dealloc] + 91
	9   RNTester-macOSIntegrationTests      0x000000010727ad74 -[RCTTextView .cxx_destruct] + 52
	10  libobjc.A.dylib                     0x00007fff6a49f5e4 _ZL27object_cxxDestructFromClassP11objc_objectP10objc_class + 83
	11  libobjc.A.dylib                     0x00007fff6a4987e0 objc_destructInstance + 94
	12  libobjc.A.dylib                     0x00007fff6a498748 _objc_rootDealloc + 62
	13  AppKit                              0x00007fff2e9d86b2 -[NSResponder dealloc] + 166
	14  AppKit                              0x00007fff2e9d650a -[NSView dealloc] + 151
	15  libobjc.A.dylib                     0x00007fff6a4b4054 _ZN19AutoreleasePoolPage12releaseUntilEPP11objc_object + 134
	16  libobjc.A.dylib                     0x00007fff6a498dba objc_autoreleasePoolPop + 175
	17  CoreFoundation                      0x00007fff316c1c45 _CFAutoreleasePoolPop + 22
	18  CoreFoundation                      0x00007fff31702e69 __CFRunLoopRun + 2062
	19  CoreFoundation                      0x00007fff31701ffe CFRunLoopRunSpecific + 462
	20  Foundation                          0x00007fff33d962a8 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212
	21  RNTester-macOSIntegrationTests      0x000000010725f149 -[RCTTestRunner runTest:module:initialProps:configurationBlock:expectErrorBlock:] + 5433
	22  RNTester-macOSIntegrationTests      0x000000010725d8a5 -[RCTTestRunner runTest:module:] + 117
	23  RNTester-macOSIntegrationTests      0x0000000107012489 -[RNTesterLoadAllPages internalTestRunner] + 105
	24  CoreFoundation                      0x00007fff316e5a6c __invoking___ + 140
	25  CoreFoundation                      0x00007fff316e5911 -[NSInvocation invoke] + 303
	26  XCTest                              0x000000010032fcc6 __24-[XCTestCase invokeTest]_block_invoke_2.214 + 65
	27  XCTest                              0x00000001003bdcb7 -[XCTMemoryChecker _assertInvalidObjectsDeallocatedAfterScope:] + 51
	28  XCTest                              0x000000010033abae -[XCTestCase assertInvalidObjectsDeallocatedAfterScope:] + 116
	29  XCTest                              0x000000010032fc56 __24-[XCTestCase invokeTest]_block_invoke.208 + 204
	30  XCTest                              0x00000001003a3da0 -[XCTestCase(Failures) performFailableBlock:testCaseRun:shouldInterruptTest:] + 57
	31  XCTest                              0x00000001003a3cbd -[XCTestCase(Failures) _performTurningExceptionsIntoFailuresInterruptAfterHandling:block:] + 96
	32  XCTest                              0x000000010032f707 __24-[XCTestCase invokeTest]_block_invoke + 1120
	33  XCTest                              0x00000001003ab54c -[XCUITestContext performInScope:] + 117
	34  XCTest                              0x000000010032f1e4 -[XCTestCase testContextPerformInScope:] + 156
	35  XCTest                              0x000000010032f29a -[XCTestCase invokeTest] + 137
	36  XCTest                              0x0000000100331079 __26-[XCTestCase performTest:]_block_invoke_2 + 43
	37  XCTest                              0x00000001003a3da0 -[XCTestCase(Failures) performFailableBlock:testCaseRun:shouldInterruptTest:] + 57
	38  XCTest                              0x00000001003a3cbd -[XCTestCase(Failures) _performTurningExceptionsIntoFailuresInterruptAfterHandling:block:] + 96
	39  XCTest                      libc++abi.dylib:         0x0000000100330f90 __26-[XCTestCase performTest:]_block_invoke.342 + 88
	40  XCTest                              0x00000001003b5380 +[XCTContext runInContextForTestCase:block:] + 219
	41  XCTest                              0x0000000100330703 -[XCTestCase performTest:] + 668
	42  XCTest                              0x00000001003828e3 -[XCTest runTest] + 57
	43  XCTest                              0x000000010032ada3 __27-[XCTestSuite performTest:]_block_invoke + 365
	44  XCTest                              0x000000010032a4cd -[XCTestSuite _performProtectedSectionForTest:testSection:] + 54
	45  XCTest                              0x000000010032a7ca -[XCTestSuite performTest:] + 355
	46  XCTest                              0x00000001003828e3 -[XCTest runTest] + 57
	47  XCTest                              0x000000010032ada3 __27-[XCTestSuite performTest:]_block_invoke + 365
	48  XCTest                              0x000000010032a4cd -[XCTestSuite _performProtectedSectionForTest:testSection:] + 54
	49  XCTest                              0x000000010032a7ca -[XCTestSuite performTest:] + 355
	50  XCTest                              0x00000001003828e3 -[XCTest runTest] + 57
	51  XCTest                              0x000000010032ada3 __27-[XCTestSuite performTest:]_block_invoke + 365
	52  XCTest                              0x000000010032a4cd -[XCTestSuite _performProtectedSectionForTest:testSection:] + 54
	53  XCTest                              0x000000010032a7ca -[XCTestSuite performTest:] + 355
	54  XCTest                              0x00000001003828e3 -[XCTest runTest] + 57
	55  XCTest                              0x00000001003cf886 __44-[XCTTestRunSession runTestsAndReturnError:]_block_invoke + 171
	56  XCTest                              0x00000001003cf982 __44-[XCTTestRunSession runTestsAndReturnError:]_block_invoke.84 + 118
	57  XCTest                              0x00000001003516a7 -[XCTestObservationCenter _observeTestExecutionForBlock:] + 594
	58  XCTest                              0x00000001003cf644 -[XCTTestRunSession runTestsAndReturnError:] + 623
	59  XCTest                              0x000000010030da40 -[XCTestDriver runTestsAndReturnError:] + 458
	60  XCTest                              0x00000001003b16c8 _XCTestMain + 2473
	61  RNTester-macOSIntegrationTests-Runn 0x0000000100000e8a _XCTRunnerRunTests + 258
	62  RNTester-macOSIntegrationTests-Runn 0x0000000100000d88 _XCTRunnerRunTests + 0
	63  libdyld.dylib                       0x00007fff6b64acc9 start + 1
	64  ???                                 0x0000000000000005 0x0 + 5
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions