calabash / calabash-ios

Calabash for iOS
Other
1.81k stars 369 forks source link

calabash ios server crash #1363

Closed reallyyun closed 6 years ago

reallyyun commented 6 years ago

I'm set up calabash on my app, and run the sample code for cucumber, always got error Errno::ECONNREFUSED: (Connection refused - Connection refused - connect(2) for "127.0.0.1" port 37265 (127.0.0.1:37265))

Finally I found the this is because of calabash-ios server is crashed.
My steps to reproduce the crash:

  1. run the app from xcode
  2. go to calabash-ios console
  3. type server_version, server information retrived
  4. type labels to show all labels on current page I see calabash ios server crash in xcode

lldb) thread backtrace

* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=2, address=0x7fff5e6f9fd8)
  * frame #0: 0x000000010650b9da CoreFoundation`CFBasicHashFindBucket + 634
    frame #1: 0x00000001065342dd CoreFoundation`CFSetGetValue + 125
    frame #2: 0x00000001030b310f Foundation`-[NSObject(NSKeyValueCoding) valueForKey:] + 192
    frame #3: 0x00000001175f1a3a AccessibilityUtilities`__57-[NSObject(UIAccessibilitySafeCategory) safeValueForKey:]_block_invoke + 30
    frame #4: 0x00000001175f1e4b AccessibilityUtilities`-[NSObject(UIAccessibilitySafeCategory) _accessibilityPerformSafeValueKeyBlock:withKey:onClass:] + 32
    frame #5: 0x00000001175f179b AccessibilityUtilities`-[NSObject(UIAccessibilitySafeCategory) safeValueForKey:] + 196
    frame #6: 0x0000000117c496d5 UIKit`-[UINavigationBarAccessibility accessibilityIdentifier] + 103
    frame #7: 0x0000000117c497ca UIKit`-[UINavigationBarAccessibility accessibilityIdentifier] + 348
 frame #8: 0x0000000117c497ca UIKit`-[UINavigationBarAccessibility accessibilityIdentifier] + 348
    frame #9: 0x0000000117c497ca UIKit`-[UINavigationBarAccessibility accessibilityIdentifier] + 348
    frame #10: 0x0000000117c497ca UIKit`-[UINavigationBarAccessibility accessibilityIdentifier] + 348
...
     frame #130825: 0x00000001065385cc CoreFoundation`__invoking___ + 140
    frame #130826: 0x000000010653841e CoreFoundation`-[NSInvocation invoke] + 286
    frame #130827: 0x0000000100d919f1 Myapp`-[LPInvoker invokeAndCoerce](self=0x00007fd40deefe30, _cmd="invokeAndCoerce") at LPInvoker.m:907
    frame #130828: 0x0000000100d8c483 Myapp`+[LPInvoker invokeZeroArgumentSelector:withTarget:](self=0x00000001018cd648, _cmd="invokeZeroArgumentSelector:withTarget:", selector="accessibilityIdentifier", target=0x00007fd40dd4ca70) at LPInvoker.m:131
    frame #130829: 0x0000000100d9e8e2 Myapp`+[LPJSONUtils dictionary:setObjectforKey:whenTarget:respondsTo:](self=0x00000001018cd918, _cmd="dictionary:setObjectforKey:whenTarget:respondsTo:", dictionary=0x00007fd41028a270, key=0x000000010176beb0, target=0x00007fd40dd4ca70, selector="accessibilityIdentifier") at LPJSONUtils.m:59
    frame #130830: 0x0000000100d9fe04 Myapp`+[LPJSONUtils dictionaryByEncodingView:](self=0x00000001018cd918, _cmd="dictionaryByEncodingView:", object=0x00007fd40dd4ca70) at LPJSONUtils.m:223
    frame #130831: 0x0000000100d9f536 Myapp`+[LPJSONUtils jsonifyObject:fullDump:](self=0x00000001018cd918, _cmd="jsonifyObject:fullDump:", object=0x00007fd40dd4ca70, dump=NO) at LPJSONUtils.m:130
    frame #130832: 0x0000000100d9f1d8 Myapp`+[LPJSONUtils jsonifyObject:](self=0x00000001018cd918, _cmd="jsonifyObject:", object=0x00007fd40dd4ca70) at LPJSONUtils.m:118
    frame #130833: 0x0000000100d580d2 Myapp`-[LPQueryAllOperation performWithTarget:error:](self=0x00007fd40dd5e610, _cmd="performWithTarget:error:", target=0x00007fd40dd4ca70, error=0x00007fff5eef7050) at LPQueryAllOperation.m:83
    frame #130834: 0x0000000100d5c171 Myapp`-[LPQueryOperation performWithTarget:error:](self=0x00007fd40dd5e610, _cmd="performWithTarget:error:", target=0x00007fd40dd4ca70, error=0x00007fff5eef7050) at LPQueryOperation.m:13
    frame #130835: 0x0000000100d705dd Myapp`-[LPMapRoute applyOperation:toViews:error:](self=0x00007fd40dc1de90, _cmd="applyOperation:toViews:error:", operation=0x00007fd410132f70, views=0x00007fd410059240, error=0x00007fff5eef7298) at LPMapRoute.m:111
    frame #130836: 0x0000000100d70cd3 Myapp`-[LPMapRoute JSONResponseForMethod:URI:data:](self=0x00007fd40dc1de90, _cmd="JSONResponseForMethod:URI:data:", method=0x00007fd40dd6d480, path=0x00007fd40ddb55a0, data=0x00007fd40dee68c0) at LPMapRoute.m:143
    frame #130837: 0x0000000100d575cf Myapp`-[LPRouter httpResponseOnMainThreadForMethod:URI:](self=0x00007fd40de85360, _cmd="httpResponseOnMainThreadForMethod:URI:", method=0x00007fd40dd6d480, path=0x00007fd40ddb55a0) at LPRouter.m:195
    frame #130838: 0x00000001065385cc CoreFoundation`__invoking___ + 140
    frame #130839: 0x000000010653841e CoreFoundation`-[NSInvocation invoke] + 286
    frame #130840: 0x00000001030e57a7 Foundation`__NSThreadPerformPerform + 283
    frame #130841: 0x0000000106575301 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    frame #130842: 0x000000010656b22c CoreFoundation`__CFRunLoopDoSources0 + 556
    frame #130843: 0x000000010656a6e3 CoreFoundation`__CFRunLoopRun + 867
    frame #130844: 0x000000010656a0f8 CoreFoundation`CFRunLoopRunSpecific + 488
    frame #130845: 0x0000000109303ad2 GraphicsServices`GSEventRunModal + 161
    frame #130846: 0x0000000103f7cf09 UIKit`UIApplicationMain + 171
    frame #130847: 0x0000000100dcab8f Myapp`main(argc=1, argv=0x00007fff5eef8578) at main.m:16
    frame #130848: 0x000000010860692d libdyld.dylib`start + 1
    frame #130849: 0x000000010860692d libdyld.dylib`start + 1

Enviroment

xcode-select --print-path
/Applications/Xcode.app/Contents/Developer

xcodebuild -version
Xcode 9.2
Build version 9C40b

calabash-ios version
/Users/xxu/.rvm/gems/ruby-2.4.1/gems/edn-1.1.1/lib/edn/core_ext.rb:97: warning: constant ::Bignum is deprecated
0.21.4

calabash-ios 0.21.4> server_version
{
                  "device_family" => "iPhone",
                        "outcome" => "SUCCESS",
                    "server_port" => 37265,
                      "simulator" => "CoreSimulator 494.33 - Device: iPhone 6+ 9.3 - Runtime: iOS 9.3 (13E233) - DeviceType: iPhone 6 Plus",
                       "app_name" => "xxxxxx",
                    "app_version" => "4718",
              "screen_dimensions" => {
                        "height" => 2208,
                        "bounds" => {
                 "y" => 0,
                 "x" => 0,
             "width" => 414,
            "height" => 736
        },
                        "sample" => 1,
                 "native_bounds" => {
                 "y" => 0,
                 "x" => 0,
             "width" => 1242,
            "height" => 2208
        },
                         "width" => 1242,
                  "native_scale" => 3,
        "bounds_portrait_height" => 736,
         "bounds_portrait_width" => 414,
                         "scale" => 3
    },
                            "git" => {
             "revision" => "c875982",
        "remote_origin" => "git@github.com:calabash/calabash-ios-server.git",
               "branch" => "tag/0.21.4"
    },
                    "device_name" => "iPhone Simulator",
                          "4inch" => false,
                         "app_id" => "xxxxx",
                    "form_factor" => "iphone 6+",
                        "version" => "0.21.4",
      "server_identifier_to_skip" => "",
           "short_version_string" => "1.9.1",
              "server_identifier" => "c8759827c0fffb8a6c7960160a31889d0a83dad9",
                     "build_date" => "2017-01-06 17:12:12 +0100",
                    "ios_version" => "9.3",
    "iphone_app_emulated_on_ipad" => false,
               "model_identifier" => "iPhone7,1",
                   "app_base_sdk" => "iphonesimulator11.2"
}
jmoody commented 6 years ago

Good bug report - it contains all the information I need to understand the problem.

Please use "```" in the future and provide more of a curated summary and less of a text dump - I had to edit your report to read it.

frame #10: 0x0000000117c497ca UIKit`-[UINavigationBarAccessibility accessibilityIdentifier] + 348

Some view in your application's UINavigationBar is crashing when it is asked for it's accessibilityIdentifier.

Does this crash happen in iOS 10 and iOS 11? Does it happen on physical devices or just the simulator?

Are you explicitly setting Accessibility Traits for the UINavigationBar or any of the items in the bar?

Finally, it is likely that I will not be able to fix this problem unless I can get a copy of your application - I would prefer a .app built for the simulator.

Thanks!

reallyyun commented 6 years ago

My app only work on iOS 9 simulator so I didn't try iOS 10 or 11. Didn't try real device. Thanks.