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 in _prettyPrintAppStateTracker #418

Closed
sibelius opened this issue Nov 19, 2017 · 4 comments
Closed

Crash in _prettyPrintAppStateTracker #418

sibelius opened this issue Nov 19, 2017 · 4 comments

Comments

@sibelius
Copy link

sibelius commented Nov 19, 2017

I've got this error while running https://github.com/wix/detox/tree/master/examples/demo-react-native-jest example for ios

yarn test-ios

2017-11-19 21:40:46.143 DemoReactNativeJest[70449:16934573] ☣️ Adding idling resource for queue: <OS_dispatch_queue: com.facebook.react.DevLoadingViewQueue>
2017-11-19 21:40:46.144 DemoReactNativeJest[70449:16934573] ☣️ Adding idling resource for queue: <OS_dispatch_queue: com.facebook.react.PlatformConstantsQueue>
2017-11-19 21:40:46.949 DemoReactNativeJest[70449:16935891] ☣️ Adding idling resource for queue: <OS_dispatch_queue: com.facebook.react.WebSocketModuleQueue>
2017-11-19 21:40:47.217 [info][tid:main][RCTRootView.m:301] Running application DemoReactNativeJest ({
    initialProps =     {
    };
    rootTag = 1;
})
2017-11-19 21:40:47.223 [info][tid:com.facebook.react.JavaScript] Running application "DemoReactNativeJest" with appParams: {"rootTag":1,"initialProps":{}}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF
2017-11-19 21:40:47.247 DemoReactNativeJest[70449:16935891] ☣️ Adding idling resource for queue: <OS_dispatch_queue: com.facebook.react.SourceCodeQueue>
2017-11-19 21:40:47.656 DemoReactNativeJest[70449:16934573] ☣️ DETOX:: Detox Action Sent: ready
2017-11-19 21:40:47.693 DemoReactNativeJest[70449:16934573] ☣️ DETOX:: Detox Action Received: invoke
2017-11-19 21:40:47.693 DemoReactNativeJest[70449:16934573] ☣️ DETOX:: Detox Action Received: currentStatus
2017-11-19 21:40:47.696 DemoReactNativeJest[70449:16934573] ☣️ DETOX:: Detox Action Sent: currentStatusResult
2017-11-19 21:40:48.278 DemoReactNativeJest[70449:16934573] ☣️ DETOX:: Detox Action Sent: invokeResult
2017-11-19 21:40:48.279 DemoReactNativeJest[70449:16934573] ☣️ DETOX:: Detox Action Received: currentStatus
2017-11-19 21:40:48.281 DemoReactNativeJest[70449:16934573] -[GREYAppStateTrackerObject copyWithZone:]: unrecognized selector sent to instance 0x60000044cf90
2017-11-19 21:40:48.287 DemoReactNativeJest[70449:16934573] Uncaught exception: -[GREYAppStateTrackerObject copyWithZone:]: unrecognized selector sent to instance 0x60000044cf90; Stack trace:
0   CoreFoundation                      0x000000010826a1ab __exceptionPreprocess + 171
1   libobjc.A.dylib                     0x0000000106bcdf41 objc_exception_throw + 48
2   CoreFoundation                      0x00000001082eaa34 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3   CoreFoundation                      0x00000001081ed0a8 ___forwarding___ + 1432
4   CoreFoundation                      0x00000001081eca88 _CF_forwarding_prep_0 + 120
5   CoreFoundation                      0x000000010817e860 -[__NSDictionaryM setObject:forKey:] + 768
6   Foundation                          0x000000010667f6e0 -[NSMapTable dictionaryRepresentation] + 268
7   Detox                               0x00000001064c1a83 _prettyPrintAppStateTracker + 155
8   Detox                               0x00000001064c14fe __35-[EarlGreyStatistics currentStatus]_block_invoke + 358
9   CoreFoundation                      0x00000001081f70bf -[__NSArrayM enumerateObjectsWithOptions:usingBlock:] + 223
10  Detox                               0x00000001064c12f8 -[EarlGreyStatistics currentStatus] + 266
11  Detox                               0x00000001064c80b4 -[DetoxManager websocketDidReceiveAction:withParams:withMessageId:] + 1618
12  Detox                               0x00000001064c02bd -[WebSocket receiveAction:] + 488
13  SocketRocket                        0x0000000118842c65 __43-[SRWebSocket _handleFrameWithData:opCode:]_block_invoke.295 + 165
14  EarlGrey                            0x00000001186e5884 __60-[GREYDispatchQueueTracker grey_dispatchAsyncCallWithBlock:]_block_invoke + 36
15  libdispatch.dylib                   0x00000001092d7273 _dispatch_call_block_and_release + 12
16  libdispatch.dylib                   0x00000001092d82b5 _dispatch_client_callout + 8
17  libdispatch.dylib                   0x00000001092e2496 _dispatch_main_queue_callback_4CF + 1260
18  CoreFoundation                      0x000000010822cee9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
19  CoreFoundation                      0x00000001081f1592 __CFRunLoopRun + 2402
20  CoreFoundation                      0x00000001081f09b9 CFRunLoopRunSpecific + 409
21  GraphicsServices                    0x000000010f5ca9c6 GSEventRunModal + 62
22  UIKit                               0x000000010a96b5e8 UIApplicationMain + 159
23  Detox                               0x00000001064c30b3 __WX_UIApplicationMain + 197
24  DemoReactNativeJest                 0x0000000105e2474f main + 111
25  libdyld.dylib                       0x000000010cb8fd81 start + 1
@brunolemos
Copy link

brunolemos commented Nov 20, 2017

I'm having the same issue. The app crashes and the tests timeout. Crash log:

2017-11-20 03:40:07.627 [info][tid:com.facebook.react.JavaScript] Running application "react_native_css_in_js_benchmarks" with appParams: {"rootTag":1,"initialProps":{}}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF
2017-11-20 03:40:07.636 react_native_css_in_js_benchmarks[45731:1413372] ☣️ Adding idling resource for queue: <OS_dispatch_queue: com.facebook.react.SourceCodeQueue>
2017-11-20 03:40:07.704 react_native_css_in_js_benchmarks[45731:1413227] ☣️ DETOX:: Detox Action Sent: ready
2017-11-20 03:40:07.711 react_native_css_in_js_benchmarks[45731:1413227] ☣️ DETOX:: Detox Action Received: invoke
2017-11-20 03:40:07.714 react_native_css_in_js_benchmarks[45731:1413227] ☣️ DETOX:: Detox Action Received: currentStatus
2017-11-20 03:40:07.716 react_native_css_in_js_benchmarks[45731:1413227] -[GREYAppStateTrackerObject copyWithZone:]: unrecognized selector sent to instance 0x604000058bd0
2017-11-20 03:40:07.746 react_native_css_in_js_benchmarks[45731:1413227] Uncaught exception: -[GREYAppStateTrackerObject copyWithZone:]: unrecognized selector sent to instance 0x604000058bd0; Stack trace:
0   CoreFoundation                      0x000000010e31703b __exceptionPreprocess + 171
1   libobjc.A.dylib                     0x000000010cc7cf41 objc_exception_throw + 48
2   CoreFoundation                      0x000000010e3978c4 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3   CoreFoundation                      0x000000010e299f38 ___forwarding___ + 1432
4   CoreFoundation                      0x000000010e299918 _CF_forwarding_prep_0 + 120
5   CoreFoundation                      0x000000010e22b6f0 -[__NSDictionaryM setObject:forKey:] + 768
6   Foundation                          0x000000010c72e6e0 -[NSMapTable dictionaryRepresentation] + 268
7   Detox                               0x000000010c570a43 _prettyPrintAppStateTracker + 155
8   Detox                               0x000000010c5704be __35-[EarlGreyStatistics currentStatus]_block_invoke + 358
9   CoreFoundation                      0x000000010e2a3f4f -[__NSArrayM enumerateObjectsWithOptions:usingBlock:] + 223
10  Detox                               0x000000010c5702b8 -[EarlGreyStatistics currentStatus] + 266
11  Detox                               0x000000010c577074 -[DetoxManager websocketDidReceiveAction:withParams:withMessageId:] + 1618
12  Detox                               0x000000010c56f27d -[WebSocket receiveAction:] + 488
13  SocketRocket                        0x000000011c278c25 __43-[SRWebSocket _handleFrameWithData:opCode:]_block_invoke.295 + 165
14  EarlGrey                            0x000000011c11a1d4 __60-[GREYDispatchQueueTracker grey_dispatchAsyncCallWithBlock:]_block_invoke + 36
15  libdispatch.dylib                   0x0000000112b11273 _dispatch_call_block_and_release + 12
16  libdispatch.dylib                   0x0000000112b122b5 _dispatch_client_callout + 8
17  libdispatch.dylib                   0x0000000112b1c496 _dispatch_main_queue_callback_4CF + 1260
18  CoreFoundation                      0x000000010e2d9d79 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
19  CoreFoundation                      0x000000010e29e422 __CFRunLoopRun + 2402
20  CoreFoundation                      0x000000010e29d849 CFRunLoopRunSpecific + 409
21  EarlGrey                            0x000000011c138ef6 -[GREYRunLoopSpinner grey_drainRunLoopInActiveModeForDrains:] + 326
22  EarlGrey                            0x000000011c138c2d -[GREYRunLoopSpinner spinWithStopConditionBlock:] + 397
23  EarlGrey                            0x000000011c18788e -[GREYUIThreadExecutor executeSyncWithTimeout:block:error:] + 1422
24  EarlGrey                            0x000000011c158912 -[GREYElementInteraction assert:error:] + 2114
25  EarlGrey                            0x000000011c15a26d -[GREYElementInteraction assertWithMatcher:error:] + 125
26  EarlGrey                            0x000000011c15a19e -[GREYElementInteraction assertWithMatcher:] + 62
27  CoreFoundation                      0x000000010e29b32c __invoking___ + 140
28  CoreFoundation                      0x000000010e29b200 -[NSInvocation invoke] + 320
29  Detox                               0x000000010c575d14 +[MethodInvocation invoke:onError:] + 813
30  Detox                               0x000000010c572a39 __35-[TestRunner invoke:withMessageId:]_block_invoke + 139
31  CoreFoundation                      0x000000010e2ba01c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
32  CoreFoundation                      0x000000010e29e7fb __CFRunLoopDoBlocks + 203
33  CoreFoundation                      0x000000010e29e5fb __CFRunLoopRun + 2875
34  CoreFoundation                      0x000000010e29d849 CFRunLoopRunSpecific + 409
35  GraphicsServices                    0x000000011562f9c6 GSEventRunModal + 62
36  UIKit                               0x000000011087427c UIApplicationMain + 159
37  Detox                               0x000000010c572073 __WX_UIApplicationMain + 197
38  react_native_css_in_js_benchmarks   0x000000010beaf28f main + 111
39  libdyld.dylib                       0x0000000112b86d81 start + 1
40  ???                                 0x0000000000000006 0x0 + 6

Here is the full code on branch detox:
https://github.com/brunolemos/react-native-css-in-js-benchmarks/tree/detox

Run: npm run detox

@brunolemos
Copy link

If I run:

it('should find a component', async () => {
    const e = element(by.id('xxx'))
    console.log('xxx -->', e)
    await expect(e).toBeVisible()
  })
})

It does find the element:

    xxx --> Element {
      _originalMatcher: IdMatcher { _call: { type: 'Invocation', value: [Object] } },
      _call: [Function] }

The error happens when trying to run the line await expect(e).toBeVisible().

@LeoNatan LeoNatan changed the title unrecognized selector sent to instance Crash in _prettyPrintAppStateTracker Nov 21, 2017
@ca057
Copy link

ca057 commented Nov 27, 2017

I experienced the same error - thanks for the fast fix!
Apparently it does not seem to work for me: As this fix is not published to npm at the moment, I set up detox locally and linked it into my project. To do so, I followed the contribution guidelines on how to setup detox.
When running my tests with the latest master, I still get the same crash and stack trace as already posted above:

2017-11-27 14:51:28.269 MyAppName[29362:842224] ☣️ DETOX:: Detox Action Received: currentStatus
2017-11-27 14:51:28.271 MyAppName[29362:842224] -[GREYAppStateTrackerObject copyWithZone:]: unrecognized selector sent to instance 0x604000658c90
2017-11-27 14:51:28.276 MyAppName[29362:842640] ☣️ DETOX:: Removing observed timer 94
2017-11-27 14:51:28.278 MyAppName[29362:842640] ☣️ DETOX:: Observing timer: 95 d: 0.001 r: 0
2017-11-27 14:51:28.742 MyAppName[29362:842640] ☣️ DETOX:: Removing observed timer 95
2017-11-27 14:51:28.745 MyAppName[29362:842224] Uncaught exception: -[GREYAppStateTrackerObject copyWithZone:]: unrecognized selector sent to instance 0x604000658c90; Stack trace:
0   CoreFoundation                      0x0000000112cef1ab __exceptionPreprocess + 171
1   libobjc.A.dylib                     0x000000011107af41 objc_exception_throw + 48
2   CoreFoundation                      0x0000000112d6fa34 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3   CoreFoundation                      0x0000000112c720a8 ___forwarding___ + 1432
4   CoreFoundation                      0x0000000112c71a88 _CF_forwarding_prep_0 + 120
5   CoreFoundation                      0x0000000112c03860 -[__NSDictionaryM setObject:forKey:] + 768
6   Foundation                          0x0000000110b2c6e0 -[NSMapTable dictionaryRepresentation] + 268
7   Detox                               0x000000011066ba53 _prettyPrintAppStateTracker + 155
8   Detox                               0x000000011066b4ce __35-[EarlGreyStatistics currentStatus]_block_invoke + 358
9   CoreFoundation                      0x0000000112c7c0bf -[__NSArrayM enumerateObjectsWithOptions:usingBlock:] + 223
10  Detox                               0x000000011066b2c8 -[EarlGreyStatistics currentStatus] + 266
11  Detox                               0x0000000110672084 -[DetoxManager websocketDidReceiveAction:withParams:withMessageId:] + 1618
12  Detox                               0x000000011066a28d -[WebSocket receiveAction:] + 488
13  SocketRocket                        0x000000013126ec31 __43-[SRWebSocket _handleFrameWithData:opCode:]_block_invoke.295 + 165
14  EarlGrey                            0x0000000131110314 __60-[GREYDispatchQueueTracker grey_dispatchAsyncCallWithBlock:]_block_invoke + 36
15  libdispatch.dylib                   0x00000001180dc273 _dispatch_call_block_and_release + 12
16  libdispatch.dylib                   0x00000001180dd2b5 _dispatch_client_callout + 8
17  libdispatch.dylib                   0x00000001180e7496 _dispatch_main_queue_callback_4CF + 1260
18  CoreFoundation                      0x0000000112cb1ee9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
19  CoreFoundation                      0x0000000112c76592 __CFRunLoopRun + 2402
20  CoreFoundation                      0x0000000112c759b9 CFRunLoopRunSpecific + 409
21  EarlGrey                            0x000000013112f4c3 -[GREYRunLoopSpinner grey_drainRunLoopInActiveModeAndCheckCondition:forTime:] + 627
22  EarlGrey                            0x000000013112ee2c -[GREYRunLoopSpinner spinWithStopConditionBlock:] + 588
23  EarlGrey                            0x000000013117d9ce -[GREYUIThreadExecutor executeSyncWithTimeout:block:error:] + 1422
24  EarlGrey                            0x000000013114ea52 -[GREYElementInteraction assert:error:] + 2114
25  EarlGrey                            0x00000001311503ad -[GREYElementInteraction assertWithMatcher:error:] + 125
26  Detox                               0x000000011066eaba __59+[GREYCondition(Detox) detoxConditionForNotElementMatched:]_block_invoke + 63
27  EarlGrey                            0x00000001311497f8 __46-[GREYCondition waitWithTimeout:pollInterval:]_block_invoke + 40
28  EarlGrey                            0x000000013113033f __54-[GREYRunLoopSpinner grey_checkConditionInActiveMode:]_block_invoke + 319
29  CoreFoundation                      0x0000000112c9218c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
30  CoreFoundation                      0x0000000112c7696b __CFRunLoopDoBlocks + 203
31  CoreFoundation                      0x0000000112c7611e __CFRunLoopRun + 1262
32  CoreFoundation                      0x0000000112c759b9 CFRunLoopRunSpecific + 409
33  EarlGrey                            0x00000001311300cc -[GREYRunLoopSpinner grey_checkConditionInActiveMode:] + 364
34  EarlGrey                            0x000000013112ed8a -[GREYRunLoopSpinner spinWithStopConditionBlock:] + 426
35  EarlGrey                            0x00000001311495a7 -[GREYCondition waitWithTimeout:pollInterval:] + 967
36  EarlGrey                            0x00000001311491c8 -[GREYCondition waitWithTimeout:] + 56
37  CoreFoundation                      0x0000000112c7349c __invoking___ + 140
38  CoreFoundation                      0x0000000112c73370 -[NSInvocation invoke] + 320
39  Detox                               0x0000000110670d24 +[MethodInvocation invoke:onError:] + 813
40  Detox                               0x000000011066da49 __35-[TestRunner invoke:withMessageId:]_block_invoke + 139
41  CoreFoundation                      0x0000000112c9218c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
42  CoreFoundation                      0x0000000112c7696b __CFRunLoopDoBlocks + 203
43  CoreFoundation                      0x0000000112c7676b __CFRunLoopRun + 2875
44  CoreFoundation                      0x0000000112c759b9 CFRunLoopRunSpecific + 409
45  GraphicsServices                    0x0000000119f559c6 GSEventRunModal + 62
46  UIKit                               0x0000000115ddf5e8 UIApplicationMain + 159
47  Detox                               0x000000011066d083 __WX_UIApplicationMain + 197
48  MyAppName                          0x000000010fcd958f main + 111
49  libdyld.dylib                       0x0000000118151d81 start + 1
50  ???                                 0x0000000000000006 0x0 + 6

Do you have any further tips for debugging to check if the crash I experience is related to the original bug?
Thanks in advance!

@LeoNatan
Copy link
Contributor

This was fixed and is no longer called. Specifically, dictionaryRepresentation was causing issues and is no longer called. A new version of Detox was released which should include this fix.

@wix wix locked and limited conversation to collaborators Jul 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants