wix / Detox

Gray box end-to-end testing and automation framework for mobile apps
https://wix.github.io/Detox/
MIT License
11.2k stars 1.92k forks source link

Support iOS 15 #2895

Closed alon-ha closed 3 years ago

alon-ha commented 3 years ago

We need to support iOS 15, check if anything broke

d4vidi commented 3 years ago

@alon-ha does this include Applesimutils?

alon-ha commented 3 years ago

Yes, in case we need to update there something as well

gabimoncha commented 3 years ago

I tried running detox on the beta release for MacOS 12, iOS 15.

The app launches and then crashes with the following error report

-------------------------------------
Translated Report (Full Report Below)
-------------------------------------

Incident Identifier: 41F9CAE1-D12A-43E9-B164-EA2DD3F6CD29
CrashReporter Key:   2F74569F-74CF-DFB6-7136-263A59844873
Hardware Model:      MacBookPro14,1
Process:             SelfapyStaging [70247]
Path:                /Users/USER/Library/Developer/CoreSimulator/Devices/02088BF2-0053-4650-A282-D97D3562ADBF/data/Containers/Bundle/Application/BB21F9DF-1D2F-4818-90AD-0DBC7537EC69/SelfapyStaging.app/SelfapyStaging
Identifier:          com.selfapy.app.staging
Version:             1.1.0 (18)
Code Type:           X86-64 (Native)
Role:                Foreground
Parent Process:      launchd_sim [42467]
Coalition:           com.apple.CoreSimulator.SimDevice.02088BF2-0053-4650-A282-D97D3562ADBF [9244]
Responsible Process: SimulatorTrampoline [2495]

Date/Time:           2021-08-27 02:25:17.4319 +0300
Launch Time:         2021-08-27 02:25:16.4603 +0300
OS Version:          macOS 12.0 (21A5304g)
Release Type:        User
Report Version:      104

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Subtype: KERN_PROTECTION_FAILURE at 0x00007fff8039b650
Exception Codes: 0x0000000000000002, 0x00007fff8039b650
VM Region Info: 0x7fff8039b650 is in 0x7fff8039b5f0-0x7fff803e8b08;  bytes after start: 96  bytes before end: 316599
      REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      unused shlib __TEXT      7fff80397c20-7fff8039b5f0 [   14K] r--/rwx SM=COW  ... this process
--->  __DATA_CONST             7fff8039b5f0-7fff803e8b08 [  309K] r--/rwx SM=COW  ...ork/CFNetwork
      unused shlib __TEXT      7fff803e8b08-7fff803e8b10 [     8] r--/rwx SM=COW  ... this process
Exception Note:  EXC_CORPSE_NOTIFY
Termination Reason: SIGNAL 10 Bus error: 10
Terminating Process: exc handler [70247]

Triggered by Thread:  0

Application Specific Information:
CoreSimulator 775 - Device: iPhone 12 (02088BF2-0053-4650-A282-D97D3562ADBF) - Runtime: iOS 15.0 (19A5307d) - DeviceType: iPhone 12
dyld4 config: DYLD_ROOT_PATH=/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot DYLD_INSERT_LIBRARIES=/Users/gabi/Library/Detox/ios/300f6225479bfc863124d36831a653487ebe6106/Detox.framework/Detox
dyld4 config: DYLD_ROOT_PATH=/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot DYLD_INSERT_LIBRARIES=/Users/gabi/Library/Detox/ios/300f6225479bfc863124d36831a653487ebe6106/Detox.framework/Detox

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   DetoxSync                              0x10662a828 0x106621000 + 38952
1   DetoxSync                              0x10662a491 0x106621000 + 38033
2   dyld_sim                               0x10672ca19 0x106714000 + 100889
3   dyld_sim                               0x1067190b5 0x106714000 + 20661
4   dyld_sim                               0x10672c91a 0x106714000 + 100634
5   DetoxSync                              0x10662a575 0x106621000 + 38261
6   DetoxSync                              0x10662a0e6 0x106621000 + 37094
7   libobjc.A.dylib                     0x7fff2018cd65 0x7fff2017f000 + 56677
8   dyld_sim                               0x10671d910 0x106714000 + 39184
9   dyld_sim                               0x10672234f 0x106714000 + 58191
10  dyld_sim                               0x10672233d 0x106714000 + 58173
11  dyld_sim                               0x1067223f8 0x106714000 + 58360
12  dyld_sim                               0x106730e2e 0x106714000 + 118318
13  dyld_sim                               0x106715920 0x106714000 + 6432
14  dyld_sim                               0x106715d3f 0x106714000 + 7487
15  dyld                                   0x10e446ae3 0x10e440000 + 27363
16  dyld                                   0x10e4456b5 0x10e440000 + 22197
17  dyld                                   0x10e4454b4 0x10e440000 + 21684

Thread 1:
0   libsystem_pthread.dylib             0x7fff6bb950b0 0x7fff6bb93000 + 8368

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x0000000106629bc9  rbx: 0x0000000000000000  rcx: 0x000000010666dd78  rdx: 0xffffffffffffffff
  rdi: 0x00007fff8039b5f0  rsi: 0x000000000000000c  rbp: 0x00007ff7ba773310  rsp: 0x00007ff7ba773240
   r8: 0x0000000000000000   r9: 0x0000000000000920  r10: 0x0000000000000001  r11: 0x0000000000000207
  r12: 0x0000000000000001  r13: 0x0000000000000001  r14: 0x00007fffd4df4656  r15: 0x0000600002fbc4a0
  rip: 0x000000010662a828  rfl: 0x0000000000010202  cr2: 0x00007fff8039b650

Logical CPU:     1
Error Code:      0x00000007 (invalid protections for user data write)
Trap Number:     14

Binary Images:
       0x106621000 -        0x10664cfff com.wix.DetoxSync (1.0) <56006f1c-e9db-36d8-86ad-393fc6e1252e> /Users/USER/Library/Detox/*/Detox.framework/Frameworks/DetoxSync.framework/DetoxSync
       0x106714000 -        0x106760fff dyld_sim (*) <4b882de9-4cab-3f20-bff2-f473fe52b431> /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/dyld_sim
    0x7fff2017f000 -     0x7fff201b0fff libobjc.A.dylib (*) <767f25ca-5ad3-3305-91c9-230f453e6ac0> /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libobjc.A.dylib
       0x10e440000 -        0x10e4a7fff dyld (*) <e604d5fb-9cec-336f-945b-cbda1a199e67> /usr/lib/dyld
    0x7fff6bb93000 -     0x7fff6bb9efff libsystem_pthread.dylib (*) <0e16c43a-453b-38c1-aa87-aab7edde0ad3> /usr/lib/system/libsystem_pthread.dylib
               0x0 - 0xffffffffffffffff ??? (*) <00000000-0000-0000-0000-000000000000> ???

EOF

-----------
Full Report
-----------

{"app_name":"SelfapyStaging","timestamp":"2021-08-27 02:25:28.00 +0300","app_version":"1.1.0","slice_uuid":"2d54bd8a-f922-3e7d-8e82-45c664b26f0c","build_version":"18","platform":7,"bundleID":"com.selfapy.app.staging","share_with_app_devs":1,"is_first_party":0,"etl_key":"3","bug_type":"309","os_version":"macOS 12.0 (21A5304g)","incident_id":"41F9CAE1-D12A-43E9-B164-EA2DD3F6CD29","name":"SelfapyStaging"}
{
  "uptime" : 80000,
  "procLaunch" : "2021-08-27 02:25:16.4603 +0300",
  "procRole" : "Foreground",
  "version" : 2,
  "userID" : 501,
  "deployVersion" : 209,
  "modelCode" : "MacBookPro14,1",
  "procStartAbsTime" : 80447281709398,
  "coalitionID" : 9244,
  "osVersion" : {
    "train" : "macOS 12.0",
    "build" : "21A5304g",
    "releaseType" : "User"
  },
  "captureTime" : "2021-08-27 02:25:17.4319 +0300",
  "incident" : "41F9CAE1-D12A-43E9-B164-EA2DD3F6CD29",
  "bug_type" : "309",
  "pid" : 70247,
  "procExitAbsTime" : 80447996736470,
  "cpuType" : "X86-64",
  "procName" : "SelfapyStaging",
  "procPath" : "\/Users\/USER\/Library\/Developer\/CoreSimulator\/Devices\/02088BF2-0053-4650-A282-D97D3562ADBF\/data\/Containers\/Bundle\/Application\/BB21F9DF-1D2F-4818-90AD-0DBC7537EC69\/SelfapyStaging.app\/SelfapyStaging",
  "bundleInfo" : {"CFBundleShortVersionString":"1.1.0","CFBundleVersion":"18","CFBundleIdentifier":"com.selfapy.app.staging"},
  "storeInfo" : {"deviceIdentifierForVendor":"310AA378-9B84-5B44-AC4D-5F11B77E8F02","thirdParty":true},
  "parentProc" : "launchd_sim",
  "parentPid" : 42467,
  "coalitionName" : "com.apple.CoreSimulator.SimDevice.02088BF2-0053-4650-A282-D97D3562ADBF",
  "crashReporterKey" : "2F74569F-74CF-DFB6-7136-263A59844873",
  "responsiblePid" : 2495,
  "responsibleProc" : "SimulatorTrampoline",
  "wakeTime" : 53863,
  "sleepWakeUUID" : "551F03FD-3E52-4C32-A144-F948DDB5B868",
  "sip" : "enabled",
  "vmRegionInfo" : "0x7fff8039b650 is in 0x7fff8039b5f0-0x7fff803e8b08;  bytes after start: 96  bytes before end: 316599\n      REGION TYPE                    START - END         [ VSIZE] PRT\/MAX SHRMOD  REGION DETAIL\n      unused shlib __TEXT      7fff80397c20-7fff8039b5f0 [   14K] r--\/rwx SM=COW  ... this process\n--->  __DATA_CONST             7fff8039b5f0-7fff803e8b08 [  309K] r--\/rwx SM=COW  ...ork\/CFNetwork\n      unused shlib __TEXT      7fff803e8b08-7fff803e8b10 [     8] r--\/rwx SM=COW  ... this process",
  "isCorpse" : 1,
  "exception" : {"codes":"0x0000000000000002, 0x00007fff8039b650","rawCodes":[2,140735344653904],"type":"EXC_BAD_ACCESS","signal":"SIGBUS","subtype":"KERN_PROTECTION_FAILURE at 0x00007fff8039b650"},
  "termination" : {"flags":0,"code":10,"namespace":"SIGNAL","indicator":"Bus error: 10","byProc":"exc handler","byPid":70247},
  "vmregioninfo" : "0x7fff8039b650 is in 0x7fff8039b5f0-0x7fff803e8b08;  bytes after start: 96  bytes before end: 316599\n      REGION TYPE                    START - END         [ VSIZE] PRT\/MAX SHRMOD  REGION DETAIL\n      unused shlib __TEXT      7fff80397c20-7fff8039b5f0 [   14K] r--\/rwx SM=COW  ... this process\n--->  __DATA_CONST             7fff8039b5f0-7fff803e8b08 [  309K] r--\/rwx SM=COW  ...ork\/CFNetwork\n      unused shlib __TEXT      7fff803e8b08-7fff803e8b10 [     8] r--\/rwx SM=COW  ... this process",
  "asi" : {"libsystem_sim_platform.dylib":["CoreSimulator 775 - Device: iPhone 12 (02088BF2-0053-4650-A282-D97D3562ADBF) - Runtime: iOS 15.0 (19A5307d) - DeviceType: iPhone 12"],"dyld_sim":["dyld4 config: DYLD_ROOT_PATH=\/Applications\/Xcode-beta.app\/Contents\/Developer\/Platforms\/iPhoneOS.platform\/Library\/Developer\/CoreSimulator\/Profiles\/Runtimes\/iOS.simruntime\/Contents\/Resources\/RuntimeRoot DYLD_INSERT_LIBRARIES=\/Users\/gabi\/Library\/Detox\/ios\/300f6225479bfc863124d36831a653487ebe6106\/Detox.framework\/Detox"],"dyld":["dyld4 config: DYLD_ROOT_PATH=\/Applications\/Xcode-beta.app\/Contents\/Developer\/Platforms\/iPhoneOS.platform\/Library\/Developer\/CoreSimulator\/Profiles\/Runtimes\/iOS.simruntime\/Contents\/Resources\/RuntimeRoot DYLD_INSERT_LIBRARIES=\/Users\/gabi\/Library\/Detox\/ios\/300f6225479bfc863124d36831a653487ebe6106\/Detox.framework\/Detox"]},
  "extMods" : {"caller":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"system":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"targeted":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"warnings":0},
  "faultingThread" : 0,
  "threads" : [{"triggered":true,"id":844301,"instructionState":{"instructionStream":{"bytes":[193,76,139,101,168,76,139,109,176,76,139,77,184,72,139,117,152,235,103,72,255,5,222,233,2,0,73,139,7,72,131,124,216,16,0,72,139,125,160,72,139,117,152,116,46,72,255,5,220,233,2,0,72,139,12,247,73,139,7,72,59,76,216,8,116,25,72,255,5,191,233,2,0,72,139,4,247,73,139,15,72,139,76,217,16,72,137,1,73,139,7,72,139,68,216,8,72,137,4,247,76,141,5,173,233,2,0,76,137,193,76,139,101,168,76,139,109,176,76,139,77,184,72,141,29,71,233,2,0,72,255,1,255,198,73,139,68,36,40,72,193,232,3,72,57,240,15,135,82,254,255,255,131,125,196,0,117,70,72,255,5,123,233,2,0,49,210,139,69,212,168,1,116,12,72,255,5,115,233,2,0,186,1,0,0,0,168,2,72,139,125,160],"offset":96}},"threadState":{"r13":{"value":1},"rax":{"value":4402093001},"rflags":{"value":66050},"cpu":{"value":1},"r14":{"value":140736764790358},"rsi":{"value":12},"r8":{"value":0},"cr2":{"value":140735344653904},"rdx":{"value":18446744073709551615},"r10":{"value":1},"r9":{"value":2336},"r15":{"value":105553166320800},"rbx":{"value":0},"trap":{"value":14,"description":"(invalid protections for user data write)"},"err":{"value":7},"r11":{"value":519},"rip":{"value":4402096168,"matchesCrashFrame":1},"rbp":{"value":140701962023696},"rsp":{"value":140701962023488},"r12":{"value":1},"rcx":{"value":4402371960},"flavor":"x86_THREAD_STATE","rdi":{"value":140735344653808}},"queue":"com.apple.main-thread","frames":[{"imageOffset":38952,"imageIndex":0},{"imageOffset":38033,"imageIndex":0},{"imageOffset":100889,"imageIndex":1},{"imageOffset":20661,"imageIndex":1},{"imageOffset":100634,"imageIndex":1},{"imageOffset":38261,"imageIndex":0},{"imageOffset":37094,"imageIndex":0},{"imageOffset":56677,"imageIndex":2},{"imageOffset":39184,"imageIndex":1},{"imageOffset":58191,"imageIndex":1},{"imageOffset":58173,"imageIndex":1},{"imageOffset":58360,"imageIndex":1},{"imageOffset":118318,"imageIndex":1},{"imageOffset":6432,"imageIndex":1},{"imageOffset":7487,"imageIndex":1},{"imageOffset":27363,"imageIndex":3},{"imageOffset":22197,"imageIndex":3},{"imageOffset":21684,"imageIndex":3}]},{"id":844343,"frames":[{"imageOffset":8368,"imageIndex":4}]}],
  "usedImages" : [
  {
    "source" : "P",
    "arch" : "x86_64",
    "base" : 4402057216,
    "CFBundleShortVersionString" : "1.0",
    "CFBundleIdentifier" : "com.wix.DetoxSync",
    "size" : 180224,
    "uuid" : "56006f1c-e9db-36d8-86ad-393fc6e1252e",
    "path" : "\/Users\/USER\/Library\/Detox\/*\/Detox.framework\/Frameworks\/DetoxSync.framework\/DetoxSync",
    "name" : "DetoxSync",
    "CFBundleVersion" : "1"
  },
  {
    "source" : "P",
    "arch" : "x86_64",
    "base" : 4403052544,
    "size" : 315392,
    "uuid" : "4b882de9-4cab-3f20-bff2-f473fe52b431",
    "path" : "\/Applications\/Xcode-beta.app\/Contents\/Developer\/Platforms\/iPhoneOS.platform\/Library\/Developer\/CoreSimulator\/Profiles\/Runtimes\/iOS.simruntime\/Contents\/Resources\/RuntimeRoot\/usr\/lib\/dyld_sim",
    "name" : "dyld_sim"
  },
  {
    "source" : "P",
    "arch" : "x86_64",
    "base" : 140733731827712,
    "size" : 204800,
    "uuid" : "767f25ca-5ad3-3305-91c9-230f453e6ac0",
    "path" : "\/Applications\/Xcode-beta.app\/Contents\/Developer\/Platforms\/iPhoneOS.platform\/Library\/Developer\/CoreSimulator\/Profiles\/Runtimes\/iOS.simruntime\/Contents\/Resources\/RuntimeRoot\/usr\/lib\/libobjc.A.dylib",
    "name" : "libobjc.A.dylib"
  },
  {
    "source" : "P",
    "arch" : "x86_64",
    "base" : 4534304768,
    "size" : 425984,
    "uuid" : "e604d5fb-9cec-336f-945b-cbda1a199e67",
    "path" : "\/usr\/lib\/dyld",
    "name" : "dyld"
  },
  {
    "source" : "P",
    "arch" : "x86_64",
    "base" : 140735000686592,
    "size" : 49152,
    "uuid" : "0e16c43a-453b-38c1-aa87-aab7edde0ad3",
    "path" : "\/usr\/lib\/system\/libsystem_pthread.dylib",
    "name" : "libsystem_pthread.dylib"
  },
  {
    "size" : 0,
    "source" : "A",
    "base" : 0,
    "uuid" : "00000000-0000-0000-0000-000000000000"
  }
],
  "sharedCache" : {
  "base" : 140733730258944,
  "size" : 3272769536,
  "uuid" : "bb190d77-0e6b-3e12-86f9-c6fada660120"
},
  "vmSummary" : "ReadOnly portion of Libraries: Total=954.5M resident=0K(0%) swapped_out_or_unallocated=954.5M(100%)\nWritable regions: Total=559.2M written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=559.2M(100%)\n\n                                VIRTUAL   REGION \nREGION TYPE                        SIZE    COUNT (non-coalesced) \n===========                     =======  ======= \nActivity Tracing                   256K        1 \nKernel Alloc Once                    8K        1 \nMALLOC                           164.3M       18 \nMALLOC guard page                   16K        4 \nMALLOC_NANO (reserved)           384.0M        1         reserved VM address space (unallocated)\nSTACK GUARD                       56.0M        2 \nStack                             8712K        2 \nVM_ALLOCATE                          8K        2 \n__DATA                            17.7M      437 \n__DATA_CONST                      35.6M      432 \n__DATA_DIRTY                        22K       10 \n__FONT_DATA                          4K        1 \n__LINKEDIT                       537.1M       10 \n__LLVM_COV                         144K        4 \n__OBJC_RO                         61.4M        1 \n__OBJC_RW                         3024K        1 \n__TEXT                           417.4M      443 \n__UNICODE                          588K        1 \ndyld private memory               2048K        2 \nmapped file                       28.3M        2 \nshared memory                       32K        3 \n===========                     =======  ======= \nTOTAL                              1.7G     1378 \nTOTAL, minus reserved VM space     1.3G     1378 \n",
  "legacyInfo" : {
  "threadTriggered" : {
    "queue" : "com.apple.main-thread"
  }
},
  "trialInfo" : {
  "rollouts" : [
    {
      "rolloutId" : "607844aa04477260f58a8077",
      "factorPackIds" : {
        "SIRI_MORPHUN_ASSETS" : "60ef663fa2f864203caf575c"
      },
      "deploymentId" : 250000055
    },
    {
      "rolloutId" : "5fc94383418129005b4e9ae0",
      "factorPackIds" : {

      },
      "deploymentId" : 250000110
    },
    {
      "rolloutId" : "60356660bbe37970735c5624",
      "factorPackIds" : {

      },
      "deploymentId" : 250000016
    },
    {
      "rolloutId" : "60da5e84ab0ca017dace9abf",
      "factorPackIds" : {

      },
      "deploymentId" : 250000007
    },
    {
      "rolloutId" : "602ad4dac86151000cf27e46",
      "factorPackIds" : {
        "SIRI_DICTATION_ASSETS" : "610c869137f5d11121dcd114"
      },
      "deploymentId" : 250000156
    },
    {
      "rolloutId" : "601d9415f79519000ccd4b69",
      "factorPackIds" : {
        "SIRI_TEXT_TO_SPEECH" : "611ad37537f5d11121dcd81b"
      },
      "deploymentId" : 250000164
    }
  ],
  "experiments" : [

  ]
}
}

Model: MacBookPro14,1, BootROM 429.140.8.0.0, 2 processors, Dual-Core Intel Core i5, 2,3 GHz, 8 GB, SMC 2.43f11
Graphics: Intel Iris Plus Graphics 640, Intel Iris Plus Graphics 640, Built-In
Display: Color LCD, 2560 x 1600 Retina, Main, MirrorOff, Online
Memory Module: BANK 0/DIMM0, 4 GB, LPDDR3, 2133 MHz, 0x802C, 0x4D5435324C3531324D3332443250462D3039
Memory Module: BANK 1/DIMM0, 4 GB, LPDDR3, 2133 MHz, 0x802C, 0x4D5435324C3531324D3332443250462D3039
AirPort: spairport_wireless_card_type_wifi (0x14E4, 0x170), Broadcom BCM43xx 1.0 (7.77.111.1 AirPortDriverBrcmNIC-1703.9)
AirPort: 
Bluetooth: Version (null), 0 services, 0 devices, 0 incoming serial ports
Network Service: Wi-Fi, AirPort, en0
Network Service: iPhone, Ethernet, en5
USB Device: USB30Bus
USB Device: USB2.0 Hub
USB Device: USB-C multiport device
USB Device: iPhone
USB Device: USB3.0 Hub
Thunderbolt Bus: MacBook Pro, Apple Inc., 41.5
mickmaccallum commented 3 years ago

I'm seeing this as well using the latest Xcode 13 beta (and running Detox 18.20.2, macOS 11.5.2). It seems that the app crashes during the device.launchApp call and the promise never resolves or rejects, which eventually leads to a timeout.

Here are the logs I'm seeing after calling launchApp: It looks like what's happening is app installs -> looks like device respring -> app launches -> app crashes.

detox[27133] DEBUG: [EXEC_CMD, #5] /usr/bin/xcrun simctl terminate AF4AAFA7-6B2F-4C30-B842-A19758DA77DA com.company.appname detox[27133] DEBUG: [EXEC_TRY, #5] Terminating com.company.appname... detox[27133] DEBUG: [EXEC_SUCCESS, #5] com.company.appname terminated detox[27133] DEBUG: [EXEC_CMD, #6] applesimutils --byId AF4AAFA7-6B2F-4C30-B842-A19758DA77DA --bundle com.company.appname --restartSB --setPermissions notifications=YES,microphone=YES,camera=YES,photos=YES detox[27133] DEBUG: [EXEC_TRY, #6] Trying to set permissions... detox[27133] DEBUG: [EXEC_SUCCESS, #6] Permissions are set detox[27133] DEBUG: [EXEC_CMD, #7] SIMCTL_CHILD_DYLD_INSERT_LIBRARIES="/Users/mick/Library/Detox/ios/98ed4482b9fb85c37af35487edfbb47d1215b31a/Detox.framework/Detox" /usr/bin/xcrun simctl launch AF4AAFA7-6B2F-4C30-B842-A19758DA77DA com.company.appname --args -detoxServer ws://localhost:50910 -detoxSessionId 19e3dedb-e4ee-0c35-b6e4-89d2c29de30b -DTXEnableVerboseSyncSystem YES -DTXEnableVerboseSyncResources YES -detoxPrintBusyIdleResources YES -detoxDebugVisibility YES -detoxDisableHierarchyDump YES detox[27133] DEBUG: [EXEC_TRY, #7] Launching com.company.appname... detox[27133] DEBUG: [EXEC_TRY, #7] Launching com.company.appname... detox[27133] DEBUG: [EXEC_CMD, #8] /usr/bin/xcrun simctl get_app_container AF4AAFA7-6B2F-4C30-B842-A19758DA77DA com.company.appname detox[27133] INFO: [AppleSimUtils.js] com.company.appname launched. To watch simulator logs, run: /usr/bin/xcrun simctl spawn AF4AAFA7-6B2F-4C30-B842-A19758DA77DA log stream --level debug --style compact --predicate 'process == "AppName"'

Crash Report:

Date/Time: 2021-08-26 16:13:11.018 -0400 OS Version: macOS 11.5.2 (20G95) Report Version: 12 Bridge OS Version: 5.5 (18P4759a) Anonymous UUID: 95F4846E-BEF6-6781-D82C-4A12B295777B

Sleep/Wake UUID: 415C3161-7F90-487E-91FD-DEDE5F42D5C5

Time Awake Since Boot: 390000 seconds Time Since Wake: 110000 seconds

System Integrity Protection: enabled

Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Exception Type: EXC_BAD_ACCESS (SIGBUS) Exception Codes: KERN_PROTECTION_FAILURE at 0x00007fff8039b8e0 Exception Note: EXC_CORPSE_NOTIFY

Termination Signal: Bus error: 10 Termination Reason: Namespace SIGNAL, Code 0xa Terminating Process: exc handler [86510]

VM Regions Near 0x7fff8039b8e0: DATA_CONST 7fff80397eb0-7fff8039b880 [ 14K] r--/rwx SM=COW /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/SharedWebCredentials.framework/SharedWebCredentials --> __DATA_CONST 7fff8039b880-7fff803e8de8 [ 309K] r--/rwx SM=COW /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CFNetwork.framework/CFNetwork unused shlib TEXT 7fff803e8de8-7fff803e8df0 [ 8] r--/rwx SM=COW system shared lib __TEXT not used by this process

Application Specific Information: dyld4 config: DYLD_ROOT_PATH=/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot DYLD_INSERT_LIBRARIES=/Users/mick/Library/Detox/ios/98ed4482b9fb85c37af35487edfbb47d1215b31a/Detox.framework/Detox CoreSimulator 776.1 - Device: iPhone 12 (AF4AAFA7-6B2F-4C30-B842-A19758DA77DA) - Runtime: iOS 15.0 (19A5318f) - DeviceType: iPhone 12

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 com.wix.DetoxSync 0x0000000111dee828 perform_rebinding_with_section + 649 1 com.wix.DetoxSync 0x0000000111dee491 rebind_symbols_for_image + 548 2 dyld_sim 0x000000011136ee19 invocation function for block in dyld4::APIs::_dyld_register_func_for_add_image(void ()(mach_header const, long)) + 175 3 dyld_sim 0x000000011135b0b5 dyld4::RuntimeState::withLoadersReadLock(void () block_pointer) + 41 4 dyld_sim 0x000000011136ed1a dyld4::APIs::_dyld_register_func_for_add_image(void ()(mach_header const, long)) + 116 5 com.wix.DetoxSync 0x0000000111dee575 rebind_symbols + 157 6 com.wix.DetoxSync 0x0000000111dee0e6 +[NSTimer(DTXSpy) load] + 145 7 libobjc.A.dylib 0x00007fff2018cd65 load_images + 970 8 dyld_sim 0x000000011135f9da dyld4::RuntimeState::notifyObjCInit(dyld4::Loader const) + 170 9 dyld_sim 0x00000001113648cd dyld4::Loader::runInitializersBottomUp(dyld4::RuntimeState&, dyld3::Array<dyld4::Loader const>&) const + 167 10 dyld_sim 0x00000001113648bb dyld4::Loader::runInitializersBottomUp(dyld4::RuntimeState&, dyld3::Array<dyld4::Loader const>&) const + 149 11 dyld_sim 0x0000000111364976 dyld4::Loader::runInitializersBottomUpPlusUpwardLinks(dyld4::RuntimeState&) const + 102 12 dyld_sim 0x000000011137323a dyld4::APIs::runAllInitializersForMain() + 222 13 dyld_sim 0x0000000111357920 dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const) + 2306 14 dyld_sim 0x0000000111357d3f _dyld_sim_prepare + 379 15 dyld 0x000000011e75dc27 dyld::useSimulatorDyld(int, macho_header const, char const, int, char const, char const, char const*, unsigned long, unsigned long) + 2093 16 dyld 0x000000011e75b15e dyld::_main(macho_header const, unsigned long, int, char const, char const, char const, unsigned long) + 1191 17 dyld 0x000000011e755224 dyldbootstrap::start(dyld3::MachOLoaded const, int, char const, dyld3::MachOLoaded const, unsigned long) + 450 18 dyld 0x000000011e755025 _dyld_start + 37 19 ??? 0x0000000000000010 0 + 16

Thread 1: 0 libsystem_pthread.dylib 0x00007fff6c0a7420 start_wqthread + 0

Thread 0 crashed with X86 Thread State (64-bit): rax: 0x0000000111dedbc9 rbx: 0x0000000000000000 rcx: 0x0000000111e31d78 rdx: 0xffffffffffffffff rdi: 0x00007fff8039b880 rsi: 0x000000000000000c rbp: 0x00007ffee45182f0 rsp: 0x00007ffee4518220 r8: 0x0000000000000000 r9: 0x0000000000000920 r10: 0x0000000000000001 r11: 0x0000000000000207 r12: 0x0000000000000001 r13: 0x0000000000000001 r14: 0x00007fffd3b398ea r15: 0x0000600000ee0020 rip: 0x0000000111dee828 rfl: 0x0000000000010202 cr2: 0x00007fff8039b8e0

Logical CPU: 8 Error Code: 0x00000007 (invalid protections for user data write) Trap Number: 14

Thread 0 instruction stream: c1 4c 8b 65 a8 4c 8b 6d-b0 4c 8b 4d b8 48 8b 75 .L.e.L.m.L.M.H.u 98 eb 67 48 ff 05 de e9-02 00 49 8b 07 48 83 7c ..gH......I..H.| d8 10 00 48 8b 7d a0 48-8b 75 98 74 2e 48 ff 05 ...H.}.H.u.t.H.. dc e9 02 00 48 8b 0c f7-49 8b 07 48 3b 4c d8 08 ....H...I..H;L.. 74 19 48 ff 05 bf e9 02-00 48 8b 04 f7 49 8b 0f t.H......H...I.. 48 8b 4c d9 10 48 89 01-49 8b 07 48 8b 44 d8 08 H.L..H..I..H.D.. [48]89 04 f7 4c 8d 05 ad-e9 02 00 4c 89 c1 4c 8b H...L......L..L. <== 65 a8 4c 8b 6d b0 4c 8b-4d b8 48 8d 1d 47 e9 02 e.L.m.L.M.H..G.. 00 48 ff 01 ff c6 49 8b-44 24 28 48 c1 e8 03 48 .H....I.D$(H...H 39 f0 0f 87 52 fe ff ff-83 7d c4 00 75 46 48 ff 9...R....}..uFH. 05 7b e9 02 00 31 d2 8b-45 d4 a8 01 74 0c 48 ff .{...1..E...t.H. 05 73 e9 02 00 ba 01 00-00 00 a8 02 48 8b 7d a0 .s..........H.}.

Thread 0 last branch register state not available.

d4vidi commented 3 years ago

@alon-ha something to look into this week?

alon-ha commented 3 years ago

@alon-ha something to look into this week?

I think so, it will be good time to check it

mickmaccallum commented 3 years ago

πŸ‘‹ Hello everyone! I just wanted to call attention to the fact that the Apple event where the iOS 15 release date is expected to be announced is next week. If anyone at Detox could find time to look into this it would be much appreciated.

d4vidi commented 3 years ago

Thanks @mickmaccallum, we will do our best!

Kudo commented 3 years ago

had some investigation for xcode 13.0 beta5 + ios 15 simulator today. there was a detox crash like this:

2021-09-13 18:17:46.144 Df BareExpoDetox[51267:2b20a1] (CoreFoundation) *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<_NSMainThread 0x6000025c42c0> valueForUndefinedKey:]: this class is not key value coding-compliant for the key private.'
*** First throw call stack:
(
        0   CoreFoundation                      0x000000011adb88a8 __exceptionPreprocess + 242
        1   libobjc.A.dylib                     0x00000001135ecbe7 objc_exception_throw + 48
        2   CoreFoundation                      0x000000011adb8549 -[NSException init] + 0
        3   Foundation                          0x000000011614d38e -[NSObject(NSKeyValueCoding) valueForUndefinedKey:] + 225
        4   Foundation                          0x00000001161fba76 -[NSThread valueForUndefinedKey:] + 85
        5   Foundation                          0x000000011614c16e -[NSObject(NSKeyValueCoding) valueForKey:] + 307
        6   Foundation                          0x000000011614cba8 -[NSObject(NSKeyValueCoding) valueForKeyPath:] + 244
        7   Detox                               0x00000001136bfd02 __DTXHandleCrash + 130
        8<…>

after further xcode debugging, the root cause is here to access private api UIWindowScene._keyWindowScene which is not available in ios 15. i am not sure where the change is in the ios 15 sdk, but looks like the symbol did exist.

$ nm -C /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore |grep 'UIWindowScene _keyWindowScene'
0000000000e94324 t +[UIWindowScene _keyWindowScene]

just for reference, hopefully to help with ios 15 support for detox. thanks for your great work for the detox framework πŸ”₯

alon-ha commented 3 years ago

Will check it this week. Im sure there will be more issues with iOS 15. Everyone please keep adding stack traces of crashes you are having on iOS 15. Thanks

mikehardy commented 3 years ago

@alon-ha I just bumped into Detox not working on iOS15 and I wonder if following the Apple documentation you could move past your crash if you locally patched to use

    UIWindowScene* scene = UIWindowScene.keyWindow;

In place of

    UIWindowScene* scene = UIWindowScene._keyWindowScene;

c.f. https://developer.apple.com/documentation/uikit/uiwindowscene/3750932-keywindow?language=objc

Seems like it would be taking the relevant changes from the iOS13 PR here and implementing them in a slightly different way but not using hidden symbols ? https://github.com/wix/Detox/commit/ac73949514199bc2f3acec192be3615c0bd79cf5#diff-7920fa2275d13d2229e29a25293f7ba57440fa87c8e57fcb7b9ff9053faa26d6

mikehardy commented 3 years ago

:thinking: I thought I was on to something with the ios15 changes to key window detection and this diff (based on this https://stackoverflow.com/a/58447461/9910298):

diff --git a/detox/ios/Detox/Utilities/UIWindow+DetoxUtils.m b/detox/ios/Detox/Utilities/UIWindow+DetoxUtils.m
index 1a067fe0..de91ca1d 100644
--- a/detox/ios/Detox/Utilities/UIWindow+DetoxUtils.m
+++ b/detox/ios/Detox/Utilities/UIWindow+DetoxUtils.m
@@ -138,19 +138,34 @@ static NSString* _DTXNSStringFromUISceneActivationState(UISceneActivationState s

 + (UIWindow*)dtx_keyWindow
 {
-       return UIWindowScene._keyWindowScene._keyWindow;
+    UIWindow        *foundWindow = nil;
+    NSArray         *windows = [[UIApplication sharedApplication]windows];
+    for (UIWindow   *window in windows) {
+        if (window.isKeyWindow) {
+            foundWindow = window;
+            break;
+        }
+    }
+    return foundWindow;
+}
+
++ (UIWindowScene*)dtx_keyWindowScene
+{
+       UIWindow* keyWindow = [self dtx_keyWindow];
+       UIWindowScene* scene = keyWindow ? keyWindow.windowScene :  nil;
+       return scene;
 }

 + (NSArray<UIWindow *> *)dtx_allKeyWindowSceneWindows
 {
-       UIWindowScene* scene = UIWindowScene._keyWindowScene;
+       UIWindowScene* scene = [self dtx_keyWindowScene];
        return [self dtx_allWindowsForScene:scene];
 }

 + (NSArray<UIWindow*>*)dtx_allWindowsForScene:(UIWindowScene*)scene
 {
        NSMutableArray<UIWindow*>* windows = [[self dtx_allWindows] mutableCopy];
-       scene = scene ?: UIWindowScene._keyWindowScene;
+       scene = scene ?: [self dtx_keyWindowScene];
        if(scene != nil)
        {
                NSPredicate* predicate = [NSPredicate predicateWithFormat:@"windowScene == %@", scene];
@@ -193,7 +208,7 @@ static NSString* _DTXNSStringFromUISceneActivationState(UISceneActivationState s

 + (void)dtx_enumerateKeyWindowSceneWindowsUsingBlock:(void (NS_NOESCAPE ^)(UIWindow* obj, NSUInteger idx, BOOL *stop))block
 {
-       UIWindowScene* scene = UIWindowScene._keyWindowScene;
+       UIWindowScene* scene = [self dtx_keyWindowScene];
        [self dtx_enumerateWindowsInScene:scene usingBlock:block];
 }

But now I'm crashing deep in Detox innards, with a fishhook crash while it's trying to rebind symbols :disappointed:

EXC_BAD_ACCESS here while doing a dyld load on something https://github.com/facebook/fishhook/blob/8ef82f0711494ecc78d16bf6ce76f5ad92e5f67b/fishhook.c#L137

I'm just an Objective-C dilettante so this is really hard + slow going for me, any chance this will see attention some time soon by someone that actually knows Objective-C + iOS :pray: :laughing:

calebmackdavenport commented 3 years ago

For anyone who has updated to iOS 15 but needs to work on detox in the meantime

In your detox configurations: if you're generically pointing at a name like "name": "iPhone 11 Pro Max" you can instead use "device": { "name": "iPhone 11 Pro Max", "os": "iOS 14.5". }

where 14.5 is whatever version you select & download in xcode -> preferences -> components image

mikehardy commented 3 years ago

@calebmackdavenport this is great and true, I will mention for people interested in keeping configs cleaner, are not using iOS15 symbols (so Xcode 12.5 would still work for you) and focusing more on environment constraint you can also just ensure that Xcode 12.5 + iOS 14.5 are the defaults by using xcode-select for local dev to choose a side-by-side install of Xcode (handy guides available a quick search away) and/or using github action "xcode-select" in combination with macos-11 (which will be macos-current in a month or so, but defaults to xcode-12.5.1 right now vs xcode-13)

The side-by-side install takes up a huge chunk of disk in a local environment vs downloading the ios 14.5 simulator so I think that's best, but it's all tradeoffs so I thought I'd mention it was possible to switch the whole Xcode too in case people needed it

Wish I was better at obj-c and could have just knocked out ios15 support, but I'll have to wait I suppose :-)

calebmackdavenport commented 3 years ago

@mikehardy

But now I'm crashing deep in Detox innards, with a fishhook crash while it's trying to rebind symbols 😞

what was the scenario that led to the fishhook crash? I am not experiencing this problem

mikehardy commented 3 years ago

Fantastic, does that mean that you are using my patch above with ios15 and detox v18 and it's working? Just curious if that was useful. My test case is just using the detox repo directions for development and running the ios e2e app. I was on an Intel Mac fully updated to current stable versions of everything in the tool chain

mikehardy commented 3 years ago

I should make a fork of this repo and make a PR just so it's easier to inspect I guess

calebmackdavenport commented 3 years ago

@mikehardy i have a fork/pr with your changes and little more here: https://github.com/wix/Detox/pull/2992

It works using the iOS:none flow. I will try other scenarios. It’s capable of manipulating and juggling navigators. I added an example app to fiddle with

calebmackdavenport commented 3 years ago

Premature... Signal 6 crash in release build. The symbols issue. Side-by-side, it does work on 14.5. I'll keep digging.

The app has crashed, see the details below:

Signal 6 was raised
(
        0   Detox                               0x00000001093fac45 +[NSThread(DetoxUtils) dtx_demangledCallStackSymbols] + 37
        1   Detox                               0x00000001093fde50 __DTXHandleCrash + 464
        2   Detox                               0x00000001093fe595 __DTXHandleSignal + 59
        3   libsystem_platform.dylib            0x000000010b6fdd7d _sigtramp + 29
        4   ???                                 0x0000000000000001 0x0 + 1
        5   libsystem_c.dylib                   0x000000010b68a684 abort + 123
        6   libc++abi.dylib                     0x00000001091f25c2 abort_message + 241
        7   libc++abi.dylib                     0x00000001091e376d demangling_unexpected_handler() + 0
        8   libobjc.A.dylib                     0x000000010918ec1b _objc_terminate() + 96
        9   Detox                               0x00000001093fea8f __dtx_terminate() + 157
        10  libc++abi.dylib                     0x00000001091f19e7 std::__terminate(void (*)()) + 8
        11  libc++abi.dylib                     0x00000001091f1998 std::terminate() + 56
        12  libdispatch.dylib                   0x000000010a88da6a _dispatch_client_callout + 28
        13  libdispatch.dylib                   0x000000010a89ae20 _dispatch_main_queue_callback_4CF + 1073
        14  CoreFoundation                      0x0000000109bd485d __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
        15  CoreFoundation                      0x0000000109bcf0ba __CFRunLoopRun + 2772
        16  CoreFoundation                      0x0000000109bce103 CFRunLoopRunSpecific + 567
        17  GraphicsServices                    0x000000010d8a2cd3 GSEventRunModal + 139
        18  UIKitCore                           0x000000011d974e63 -[UIApplication _run] + 928
        19  DetoxSync                           0x00000001212712fd __detox_sync_UIApplication_run + 362
        20  UIKitCore                           0x000000011d979a53 UIApplicationMain + 101
        21  example                             0x000000010768b3c8 main + 104
        22  dyld                                0x0000000108f45e1e start_sim + 10
        23  ???                                 0x0000000000000001 0x0 + 1
)
calebmackdavenport commented 3 years ago

Premature... Signal 6 crash in release build. The symbols issue. Side-by-side, it does work on 14.5. I'll keep digging.

The symbol crash was actually due to a stale version in ~/Library/detox/ios, ensuring the newly built framework with the changes to NSObject+DetoxUtils.m as well resolved the issue.

Video is kind of long but shows side by side 14.5 & 15 running the test app that was crashing before

https://user-images.githubusercontent.com/30021449/135115805-957e612e-70d8-47ac-bb6a-87d000984398.mp4

mikehardy commented 3 years ago

Very interesting! If you see success with my patch above as used in #2992, then I need to re-test locally and make sure I have a clean environment. That would be a great result. #2992 contains unrelated things so I posted #2996 in the hopes that if the patch works it can be incorporated really quickly, independent of any new demo or unrelated changes...

calebmackdavenport commented 3 years ago

I think you will still need the two changes in

mikehardy commented 3 years ago

Oh, very interesting result! I'm not sure when I'll have the time to give this another timeslice as I need to get a few other critical things done first, but my next step if no one beats me to it will be to triple-check my local environment (to make sure I have up to date local frameworks built etc etc) and try to reproduce success based on your PR branch. Given my obj-c skills I'm going to be kind of astounded if it works

Yeah - just seeing your comment - I think you are right - I just noticed those in your PR, added a second commit with those and attribution. Hopefully something here works between the two PRs !

alon-ha commented 3 years ago

A new version released. It includes the fix for keyWindowScene unrecognized selector Let's see if we still have issues with iOS 15..

mikehardy commented 3 years ago

Unfortunately, react-native-firebase e2e test harness still fails on it in github using macos-11 runner + Xcode 13.0 + iOS15 - https://github.com/invertase/react-native-firebase/pull/5734/checks?check_run_id=3749043879 (the simulator log, attached as an artifact, did not reveal anything really)

whereas it works with Xcode12.5.1/iOS14.5 github actions or local https://github.com/invertase/react-native-firebase/actions/runs/1288236200

I did give it a whirl at least :-). The README.md here shows how to run it in case you want to use it as a fuzztest once Detox internal e2e works on iOS15? https://github.com/invertase/react-native-firebase/blob/master/tests/README.md

jacargentina commented 3 years ago

Hi! I just updated to detox 18.22.0, and it stills is not working in my case.

-------------------------------------
Translated Report (Full Report Below)
-------------------------------------

Incident Identifier: F548AF41-6556-4654-8720-553D599337CB
CrashReporter Key:   61FDB4F5-B654-92E7-EC0A-1EC76F813242
Hardware Model:      MacBookPro16,1
Process:             webapiReactNativeClient [33219]
Path:                /Users/USER/Library/Developer/CoreSimulator/Devices/7F8D459C-2BF9-401F-8FE4-5D945CE6E598/data/Containers/Bundle/Application/4DDA58ED-D890-4070-ABF4-94DE5A91CAC8/webapiReactNativeClient.app/webapiReactNativeClient
Identifier:          ar.com.nexion.webapiReactNativeClient
Version:             1.0 (0)
Code Type:           X86-64 (Native)
Role:                Foreground
Parent Process:      launchd_sim [29086]
Coalition:           com.apple.CoreSimulator.SimDevice.7F8D459C-2BF9-401F-8FE4-5D945CE6E598 [1235]
Responsible Process: SimulatorTrampoline [2080]

Date/Time:           2021-09-29 21:25:05.1515 -0300
Launch Time:         2021-09-29 21:25:04.9549 -0300
OS Version:          macOS 12.0 (21A5522h)
Release Type:        User
Report Version:      104

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Subtype: KERN_PROTECTION_FAILURE at 0x00007fff81a55478
Exception Codes: 0x0000000000000002, 0x00007fff81a55478
VM Region Info: 0x7fff81a55478 is in 0x7fff81a54f20-0x7fff81a98088;  bytes after start: 1368  bytes before end: 273423
      REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      unused shlib __TEXT      7fff81a54f18-7fff81a54f20 [     8] r--/rwx SM=COW  ... this process
--->  __DATA_CONST             7fff81a54f20-7fff81a98088 [  268K] r--/rwx SM=COW  ...avaScriptCore
      __DATA_CONST             7fff81a98088-7fff81a9aed0 [   12K] r--/rwx SM=COW  ...Dynamic.dylib
Exception Note:  EXC_CORPSE_NOTIFY
Termination Reason: SIGNAL 10 Bus error: 10
Terminating Process: exc handler [33219]

Triggered by Thread:  0

Application Specific Information:
CoreSimulator 776.3 - Device: iPhone 12 (7F8D459C-2BF9-401F-8FE4-5D945CE6E598) - Runtime: iOS 15.0 (19A339) - DeviceType: iPhone 12
dyld4 config: DYLD_ROOT_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot DYLD_INSERT_LIBRARIES=/Users/javiercastro/Library/Detox/ios/87fc7c1a86f820d7804733cd5e9abb5dfa4b3bed/Detox.framework/Detox
dyld4 config: DYLD_ROOT_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot DYLD_INSERT_LIBRARIES=/Users/javiercastro/Library/Detox/ios/87fc7c1a86f820d7804733cd5e9abb5dfa4b3bed/Detox.framework/Detox

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   DetoxSync                              0x10f083828 perform_rebinding_with_section + 649
1   DetoxSync                              0x10f083465 rebind_symbols_for_image + 504
2   dyld_sim                               0x10f185e99 invocation function for block in dyld4::APIs::_dyld_register_func_for_add_image(void (*)(mach_header const*, long)) + 175
3   dyld_sim                               0x10f1720b5 dyld4::RuntimeState::withLoadersReadLock(void () block_pointer) + 41
4   dyld_sim                               0x10f185d9a dyld4::APIs::_dyld_register_func_for_add_image(void (*)(mach_header const*, long)) + 116
5   DetoxSync                              0x10f083575 rebind_symbols + 157
6   DetoxSync                              0x10f0830e6 +[NSTimer(DTXSpy) load] + 145
7   libobjc.A.dylib                     0x7fff2018cd65 load_images + 970
8   dyld_sim                               0x10f1769da dyld4::RuntimeState::notifyObjCInit(dyld4::Loader const*) + 170
9   dyld_sim                               0x10f17b94d dyld4::Loader::runInitializersBottomUp(dyld4::RuntimeState&, dyld3::Array<dyld4::Loader const*>&) const + 167
10  dyld_sim                               0x10f17b93b dyld4::Loader::runInitializersBottomUp(dyld4::RuntimeState&, dyld3::Array<dyld4::Loader const*>&) const + 149
11  dyld_sim                               0x10f17b9f6 dyld4::Loader::runInitializersBottomUpPlusUpwardLinks(dyld4::RuntimeState&) const + 102
12  dyld_sim                               0x10f18a2d8 dyld4::APIs::runAllInitializersForMain() + 222
13  dyld_sim                               0x10f16e920 dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*) + 2306
14  dyld_sim                               0x10f16ed3f _dyld_sim_prepare + 379
15  dyld                                   0x117689ba7 dyld4::prepareSim(dyld4::RuntimeState&, char const*) + 1265
16  dyld                                   0x1176886b5 dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*) + 244
17  dyld                                   0x1176884b4 start + 388

Thread 1:
0   libsystem_pthread.dylib             0x7fff6bfec00c start_wqthread + 0

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x000000010f082bc9  rbx: 0x0000000000000000  rcx: 0x000000010f0c6d78  rdx: 0xffffffffffffffff
  rdi: 0x00007fff81a553a8  rsi: 0x000000000000001a  rbp: 0x00007ff7b24269c0  rsp: 0x00007ff7b24268f0
   r8: 0x0000000000000000   r9: 0x0000000000000910  r10: 0x0000000000000001  r11: 0x0000000000000203
  r12: 0x0000000000000001  r13: 0x0000000000000001  r14: 0x00007fffd3be5072  r15: 0x00006000009ee280
  rip: 0x000000010f083828  rfl: 0x0000000000010202  cr2: 0x00007fff81a55478

Logical CPU:     4
Error Code:      0x00000007 (invalid protections for user data write)
Trap Number:     14

Binary Images:
       0x10f07a000 -        0x10f0a5fff com.wix.DetoxSync (1.0) <56006f1c-e9db-36d8-86ad-393fc6e1252e> /Users/USER/Library/Detox/*/Detox.framework/Frameworks/DetoxSync.framework/DetoxSync
       0x10f16d000 -        0x10f1b9fff dyld_sim (*) <d494c297-dc73-394b-901e-1b5930e801df> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/dyld_sim
    0x7fff2017f000 -     0x7fff201b0fff libobjc.A.dylib (*) <8d646e32-1ecc-300d-acea-e906348ab594> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libobjc.A.dylib
       0x117683000 -        0x1176eafff dyld (*) <9fc670fc-4d35-3582-a044-8f06bf2528af> /usr/lib/dyld
    0x7fff6bfea000 -     0x7fff6bff5fff libsystem_pthread.dylib (*) <ad356414-9c4c-3df7-a0e6-57ccac56de46> /usr/lib/system/libsystem_pthread.dylib
               0x0 - 0xffffffffffffffff ??? (*) <00000000-0000-0000-0000-000000000000> ???

EOF

-----------
Full Report
-----------

{"app_name":"webapiReactNativeClient","timestamp":"2021-09-29 21:25:05.00 -0300","app_version":"1.0","slice_uuid":"05187f0c-dd94-32dc-b182-0f1d4b75668b","build_version":"0","platform":7,"bundleID":"ar.com.nexion.webapiReactNativeClient","share_with_app_devs":0,"is_first_party":0,"bug_type":"309","os_version":"macOS 12.0 (21A5522h)","incident_id":"F548AF41-6556-4654-8720-553D599337CB","name":"webapiReactNativeClient"}
{
  "uptime" : 22000,
  "procLaunch" : "2021-09-29 21:25:04.9549 -0300",
  "procRole" : "Foreground",
  "version" : 2,
  "userID" : 501,
  "deployVersion" : 210,
  "modelCode" : "MacBookPro16,1",
  "procStartAbsTime" : 22060768050113,
  "coalitionID" : 1235,
  "osVersion" : {
    "train" : "macOS 12.0",
    "build" : "21A5522h",
    "releaseType" : "User"
  },
  "captureTime" : "2021-09-29 21:25:05.1515 -0300",
  "incident" : "F548AF41-6556-4654-8720-553D599337CB",
  "bug_type" : "309",
  "pid" : 33219,
  "procExitAbsTime" : 22060964443417,
  "cpuType" : "X86-64",
  "procName" : "webapiReactNativeClient",
  "procPath" : "\/Users\/USER\/Library\/Developer\/CoreSimulator\/Devices\/7F8D459C-2BF9-401F-8FE4-5D945CE6E598\/data\/Containers\/Bundle\/Application\/4DDA58ED-D890-4070-ABF4-94DE5A91CAC8\/webapiReactNativeClient.app\/webapiReactNativeClient",
  "bundleInfo" : {"CFBundleShortVersionString":"1.0","CFBundleVersion":"0","CFBundleIdentifier":"ar.com.nexion.webapiReactNativeClient"},
  "storeInfo" : {"deviceIdentifierForVendor":"1CA5B917-A72E-50A5-A3CA-5CE22D3CD512","thirdParty":true},
  "parentProc" : "launchd_sim",
  "parentPid" : 29086,
  "coalitionName" : "com.apple.CoreSimulator.SimDevice.7F8D459C-2BF9-401F-8FE4-5D945CE6E598",
  "crashReporterKey" : "61FDB4F5-B654-92E7-EC0A-1EC76F813242",
  "responsiblePid" : 2080,
  "responsibleProc" : "SimulatorTrampoline",
  "wakeTime" : 3739,
  "bridgeVersion" : {"build":"19P50522d","train":"6.0"},
  "sleepWakeUUID" : "2134466E-08E5-4E04-AB31-F9CF0D46B8F9",
  "sip" : "disabled",
  "vmRegionInfo" : "0x7fff81a55478 is in 0x7fff81a54f20-0x7fff81a98088;  bytes after start: 1368  bytes before end: 273423\n      REGION TYPE                    START - END         [ VSIZE] PRT\/MAX SHRMOD  REGION DETAIL\n      unused shlib __TEXT      7fff81a54f18-7fff81a54f20 [     8] r--\/rwx SM=COW  ... this process\n--->  __DATA_CONST             7fff81a54f20-7fff81a98088 [  268K] r--\/rwx SM=COW  ...avaScriptCore\n      __DATA_CONST             7fff81a98088-7fff81a9aed0 [   12K] r--\/rwx SM=COW  ...Dynamic.dylib",
  "isCorpse" : 1,
  "exception" : {"codes":"0x0000000000000002, 0x00007fff81a55478","rawCodes":[2,140735368483960],"type":"EXC_BAD_ACCESS","signal":"SIGBUS","subtype":"KERN_PROTECTION_FAILURE at 0x00007fff81a55478"},
  "termination" : {"flags":0,"code":10,"namespace":"SIGNAL","indicator":"Bus error: 10","byProc":"exc handler","byPid":33219},
  "vmregioninfo" : "0x7fff81a55478 is in 0x7fff81a54f20-0x7fff81a98088;  bytes after start: 1368  bytes before end: 273423\n      REGION TYPE                    START - END         [ VSIZE] PRT\/MAX SHRMOD  REGION DETAIL\n      unused shlib __TEXT      7fff81a54f18-7fff81a54f20 [     8] r--\/rwx SM=COW  ... this process\n--->  __DATA_CONST             7fff81a54f20-7fff81a98088 [  268K] r--\/rwx SM=COW  ...avaScriptCore\n      __DATA_CONST             7fff81a98088-7fff81a9aed0 [   12K] r--\/rwx SM=COW  ...Dynamic.dylib",
  "asi" : {"libsystem_sim_platform.dylib":["CoreSimulator 776.3 - Device: iPhone 12 (7F8D459C-2BF9-401F-8FE4-5D945CE6E598) - Runtime: iOS 15.0 (19A339) - DeviceType: iPhone 12"],"dyld_sim":["dyld4 config: DYLD_ROOT_PATH=\/Applications\/Xcode.app\/Contents\/Developer\/Platforms\/iPhoneOS.platform\/Library\/Developer\/CoreSimulator\/Profiles\/Runtimes\/iOS.simruntime\/Contents\/Resources\/RuntimeRoot DYLD_INSERT_LIBRARIES=\/Users\/javiercastro\/Library\/Detox\/ios\/87fc7c1a86f820d7804733cd5e9abb5dfa4b3bed\/Detox.framework\/Detox"],"dyld":["dyld4 config: DYLD_ROOT_PATH=\/Applications\/Xcode.app\/Contents\/Developer\/Platforms\/iPhoneOS.platform\/Library\/Developer\/CoreSimulator\/Profiles\/Runtimes\/iOS.simruntime\/Contents\/Resources\/RuntimeRoot DYLD_INSERT_LIBRARIES=\/Users\/javiercastro\/Library\/Detox\/ios\/87fc7c1a86f820d7804733cd5e9abb5dfa4b3bed\/Detox.framework\/Detox"]},
  "extMods" : {"caller":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"system":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"targeted":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"warnings":0},
  "faultingThread" : 0,
  "threads" : [{"triggered":true,"id":313518,"instructionState":{"instructionStream":{"bytes":[193,76,139,101,168,76,139,109,176,76,139,77,184,72,139,117,152,235,103,72,255,5,222,233,2,0,73,139,7,72,131,124,216,16,0,72,139,125,160,72,139,117,152,116,46,72,255,5,220,233,2,0,72,139,12,247,73,139,7,72,59,76,216,8,116,25,72,255,5,191,233,2,0,72,139,4,247,73,139,15,72,139,76,217,16,72,137,1,73,139,7,72,139,68,216,8,72,137,4,247,76,141,5,173,233,2,0,76,137,193,76,139,101,168,76,139,109,176,76,139,77,184,72,141,29,71,233,2,0,72,255,1,255,198,73,139,68,36,40,72,193,232,3,72,57,240,15,135,82,254,255,255,131,125,196,0,117,70,72,255,5,123,233,2,0,49,210,139,69,212,168,1,116,12,72,255,5,115,233,2,0,186,1,0,0,0,168,2,72,139,125,160],"offset":96}},"threadState":{"r13":{"value":1},"rax":{"value":4547161033,"symbolLocation":0,"symbol":"__detox_sync_CFRunLoopAddTimer"},"rflags":{"value":66050},"cpu":{"value":4},"r14":{"value":140736745853042},"rsi":{"value":26},"r8":{"value":0},"cr2":{"value":140735368483960},"rdx":{"value":18446744073709551615},"r10":{"value":1},"r9":{"value":2320},"r15":{"value":105553126679168},"rbx":{"value":0},"trap":{"value":14,"description":"(invalid protections for user data write)"},"err":{"value":7},"r11":{"value":515},"rip":{"value":4547164200,"matchesCrashFrame":1},"rbp":{"value":140701824346560},"rsp":{"value":140701824346352},"r12":{"value":1},"rcx":{"value":4547439992,"symbolLocation":0,"symbol":"__orig_CFRunLoopAddTimer"},"flavor":"x86_THREAD_STATE","rdi":{"value":140735368483752}},"queue":"com.apple.main-thread","frames":[{"imageOffset":38952,"symbol":"perform_rebinding_with_section","symbolLocation":649,"imageIndex":0},{"imageOffset":37989,"symbol":"rebind_symbols_for_image","symbolLocation":504,"imageIndex":0},{"imageOffset":102041,"symbol":"invocation function for block in dyld4::APIs::_dyld_register_func_for_add_image(void (*)(mach_header const*, long))","symbolLocation":175,"imageIndex":1},{"imageOffset":20661,"symbol":"dyld4::RuntimeState::withLoadersReadLock(void () block_pointer)","symbolLocation":41,"imageIndex":1},{"imageOffset":101786,"symbol":"dyld4::APIs::_dyld_register_func_for_add_image(void (*)(mach_header const*, long))","symbolLocation":116,"imageIndex":1},{"imageOffset":38261,"symbol":"rebind_symbols","symbolLocation":157,"imageIndex":0},{"imageOffset":37094,"symbol":"+[NSTimer(DTXSpy) load]","symbolLocation":145,"imageIndex":0},{"imageOffset":56677,"symbol":"load_images","symbolLocation":970,"imageIndex":2},{"imageOffset":39386,"symbol":"dyld4::RuntimeState::notifyObjCInit(dyld4::Loader const*)","symbolLocation":170,"imageIndex":1},{"imageOffset":59725,"symbol":"dyld4::Loader::runInitializersBottomUp(dyld4::RuntimeState&, dyld3::Array<dyld4::Loader const*>&) const","symbolLocation":167,"imageIndex":1},{"imageOffset":59707,"symbol":"dyld4::Loader::runInitializersBottomUp(dyld4::RuntimeState&, dyld3::Array<dyld4::Loader const*>&) const","symbolLocation":149,"imageIndex":1},{"imageOffset":59894,"symbol":"dyld4::Loader::runInitializersBottomUpPlusUpwardLinks(dyld4::RuntimeState&) const","symbolLocation":102,"imageIndex":1},{"imageOffset":119512,"symbol":"dyld4::APIs::runAllInitializersForMain()","symbolLocation":222,"imageIndex":1},{"imageOffset":6432,"symbol":"dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*)","symbolLocation":2306,"imageIndex":1},{"imageOffset":7487,"symbol":"_dyld_sim_prepare","symbolLocation":379,"imageIndex":1},{"imageOffset":27559,"symbol":"dyld4::prepareSim(dyld4::RuntimeState&, char const*)","symbolLocation":1265,"imageIndex":3},{"imageOffset":22197,"symbol":"dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*)","symbolLocation":244,"imageIndex":3},{"imageOffset":21684,"symbol":"start","symbolLocation":388,"imageIndex":3}]},{"id":313542,"frames":[{"imageOffset":8204,"symbol":"start_wqthread","symbolLocation":0,"imageIndex":4}]}],
  "usedImages" : [
  {
    "source" : "P",
    "arch" : "x86_64",
    "base" : 4547125248,
    "CFBundleShortVersionString" : "1.0",
    "CFBundleIdentifier" : "com.wix.DetoxSync",
    "size" : 180224,
    "uuid" : "56006f1c-e9db-36d8-86ad-393fc6e1252e",
    "path" : "\/Users\/USER\/Library\/Detox\/*\/Detox.framework\/Frameworks\/DetoxSync.framework\/DetoxSync",
    "name" : "DetoxSync",
    "CFBundleVersion" : "1"
  },
  {
    "source" : "P",
    "arch" : "x86_64",
    "base" : 4548120576,
    "size" : 315392,
    "uuid" : "d494c297-dc73-394b-901e-1b5930e801df",
    "path" : "\/Applications\/Xcode.app\/Contents\/Developer\/Platforms\/iPhoneOS.platform\/Library\/Developer\/CoreSimulator\/Profiles\/Runtimes\/iOS.simruntime\/Contents\/Resources\/RuntimeRoot\/usr\/lib\/dyld_sim",
    "name" : "dyld_sim"
  },
  {
    "source" : "P",
    "arch" : "x86_64",
    "base" : 140733731827712,
    "size" : 204800,
    "uuid" : "8d646e32-1ecc-300d-acea-e906348ab594",
    "path" : "\/Applications\/Xcode.app\/Contents\/Developer\/Platforms\/iPhoneOS.platform\/Library\/Developer\/CoreSimulator\/Profiles\/Runtimes\/iOS.simruntime\/Contents\/Resources\/RuntimeRoot\/usr\/lib\/libobjc.A.dylib",
    "name" : "libobjc.A.dylib"
  },
  {
    "source" : "P",
    "arch" : "x86_64",
    "base" : 4687671296,
    "size" : 425984,
    "uuid" : "9fc670fc-4d35-3582-a044-8f06bf2528af",
    "path" : "\/usr\/lib\/dyld",
    "name" : "dyld"
  },
  {
    "source" : "P",
    "arch" : "x86_64",
    "base" : 140735005237248,
    "size" : 49152,
    "uuid" : "ad356414-9c4c-3df7-a0e6-57ccac56de46",
    "path" : "\/usr\/lib\/system\/libsystem_pthread.dylib",
    "name" : "libsystem_pthread.dylib"
  },
  {
    "size" : 0,
    "source" : "A",
    "base" : 0,
    "uuid" : "00000000-0000-0000-0000-000000000000"
  }
],
  "sharedCache" : {
  "base" : 140733730258944,
  "size" : 3254697984,
  "uuid" : "f63c144b-9857-37d5-a155-1a1434f2703a"
},
  "vmSummary" : "ReadOnly portion of Libraries: Total=899.4M resident=0K(0%) swapped_out_or_unallocated=899.4M(100%)\nWritable regions: Total=687.0M written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=687.0M(100%)\n\n                                VIRTUAL   REGION \nREGION TYPE                        SIZE    COUNT (non-coalesced) \n===========                     =======  ======= \nActivity Tracing                   256K        1 \nKernel Alloc Once                    8K        1 \nMALLOC                           172.2M       18 \nMALLOC guard page                   24K        5 \nMALLOC_MEDIUM (reserved)         120.0M        1         reserved VM address space (unallocated)\nMALLOC_NANO (reserved)           384.0M        1         reserved VM address space (unallocated)\nSTACK GUARD                       56.0M        2 \nStack                             8712K        2 \nVM_ALLOCATE                          8K        2 \n__DATA                            13.2M      374 \n__DATA_CONST                      29.9M      371 \n__DATA_DIRTY                        22K       10 \n__FONT_DATA                          4K        1 \n__LINKEDIT                       525.9M       10 \n__LLVM_COV                         144K        4 \n__OBJC_RO                         61.8M        1 \n__OBJC_RW                         3040K        1 \n__TEXT                           373.5M      380 \n__UNICODE                          588K        1 \ndyld private memory               2048K        2 \nmapped file                       28.3M        2 \nshared memory                       32K        3 \n===========                     =======  ======= \nTOTAL                              1.7G     1193 \nTOTAL, minus reserved VM space     1.2G     1193 \n",
  "legacyInfo" : {
  "threadTriggered" : {
    "queue" : "com.apple.main-thread"
  }
},
  "trialInfo" : {
  "rollouts" : [
    {
      "rolloutId" : "607844aa04477260f58a8077",
      "factorPackIds" : {
        "SIRI_MORPHUN_ASSETS" : "60ef663fa2f864203caf575c"
      },
      "deploymentId" : 250000055
    },
    {
      "rolloutId" : "60da5e84ab0ca017dace9abf",
      "factorPackIds" : {

      },
      "deploymentId" : 250000007
    },
    {
      "rolloutId" : "60356660bbe37970735c5624",
      "factorPackIds" : {

      },
      "deploymentId" : 250000016
    },
    {
      "rolloutId" : "5ffde50ce2aacd000d47a95f",
      "factorPackIds" : {

      },
      "deploymentId" : 250000036
    },
    {
      "rolloutId" : "5fc94383418129005b4e9ae0",
      "factorPackIds" : {

      },
      "deploymentId" : 250000124
    },
    {
      "rolloutId" : "602ad4dac86151000cf27e46",
      "factorPackIds" : {
        "SIRI_DICTATION_ASSETS" : "61522de8f387f92b1fffbc0d"
      },
      "deploymentId" : 250000205
    },
    {
      "rolloutId" : "601d9415f79519000ccd4b69",
      "factorPackIds" : {
        "SIRI_TEXT_TO_SPEECH" : "61522cf341685658846fadb6"
      },
      "deploymentId" : 250000224
    }
  ],
  "experiments" : [

  ]
}
}
mikehardy commented 3 years ago

That was the one I saw! Exact same trace, mentioned in https://github.com/wix/Detox/issues/2895#issuecomment-926181391 - glad I'm not going crazy on that one. That's in the Fishhook library as it's hooking into the native calls in order to do the syncing etc, it was way farther than my Obj-C skills could carry me unfortunately.

calebmackdavenport commented 3 years ago

@mikehardy did you have an app/scenario I could recreate the issue on? happy to dig in. Only problem I've seen on iOS 15 now is our suite as a whole seems to take an extra 30 minutes

https://github.com/facebook/fishhook/pull/87 seems promising https://github.com/zendesk/fishhook

mikehardy commented 3 years ago

Yeah I linked the react-native-firebase tests suite above. That's my only goal here, make that run. In the process I found that following the contribution guide here and running the e2e tests for ios results in the fish hook crash

d4vidi commented 3 years ago

@calebmackdavenport did Detox 18.22.0 sort things out for you?

calebmackdavenport commented 3 years ago

@calebmackdavenport did Detox 18.22.0 sort things out for you?

Yes it did!

I am digging into react-native-firebase to see if I can replicate the fishhook crash and check if any of the forks resolve it

d4vidi commented 3 years ago

@calebmackdavenport great! Keep us posted, please

mklb commented 3 years ago

Running iOS 15, "detox": "^18.22.1" and "react-native": "^0.65.1". App launches, screen stays black with the white loading circle animation, then crashes. Weirdly it tries to launch the app again and the same thing happens. After a while I get this error:

detox[51738] ERROR: [APP_UNREACHABLE] Detox can't seem to connect to the test app(s)!
mikehardy commented 3 years ago

@mklb is there any way for you to grab the crash trace like :point_up: https://github.com/wix/Detox/issues/2895#issuecomment-929204381 ?

It is not the easiest to get them because it is not the easiest to launch a Detox test run via Xcode, so I get them from Console.app usually - quite verbose and I have to watch the time of the crash closely in order to scroll back to the crash location, but it's possible. The crash trace is critical for locating the issue(s)

cmcewen commented 3 years ago

Also getting a crash with a similar error to @mikehardy on iOS 15:

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   com.wix.DetoxSync               0x000000010ae12828 perform_rebinding_with_section + 649
1   com.wix.DetoxSync               0x000000010ae12491 rebind_symbols_for_image + 548
2   dyld_sim                        0x000000010aad7e99 invocation function for block in dyld4::APIs::_dyld_register_func_for_add_image(void (*)(mach_header const*, long)) + 175
3   dyld_sim                        0x000000010aac40b5 dyld4::RuntimeState::withLoadersReadLock(void () block_pointer) + 41
4   dyld_sim                        0x000000010aad7d9a dyld4::APIs::_dyld_register_func_for_add_image(void (*)(mach_header const*, long)) + 116
5   com.wix.DetoxSync               0x000000010ae12575 rebind_symbols + 157
6   com.wix.DetoxSync               0x000000010ae120e6 +[NSTimer(DTXSpy) load] + 145
7   libobjc.A.dylib                 0x00007fff2018cd65 load_images + 970
8   dyld_sim                        0x000000010aac89da dyld4::RuntimeState::notifyObjCInit(dyld4::Loader const*) + 170
9   dyld_sim                        0x000000010aacd94d dyld4::Loader::runInitializersBottomUp(dyld4::RuntimeState&, dyld3::Array<dyld4::Loader const*>&) const + 167
10  dyld_sim                        0x000000010aacd93b dyld4::Loader::runInitializersBottomUp(dyld4::RuntimeState&, dyld3::Array<dyld4::Loader const*>&) const + 149
11  dyld_sim                        0x000000010aacd9f6 dyld4::Loader::runInitializersBottomUpPlusUpwardLinks(dyld4::RuntimeState&) const + 102
12  dyld_sim                        0x000000010aadc2d8 dyld4::APIs::runAllInitializersForMain() + 222
13  dyld_sim                        0x000000010aac0920 dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*) + 2306
14  dyld_sim                        0x000000010aac0d3f _dyld_sim_prepare + 379
15  dyld                            0x000000011549dc27 dyld::useSimulatorDyld(int, macho_header const*, char const*, int, char const**, char const**, char const**, unsigned long*, unsigned long*) + 2093
16  dyld                            0x000000011549b15e dyld::_main(macho_header const*, unsigned long, int, char const**, char const**, char const**, unsigned long*) + 1191
17  dyld                            0x0000000115495224 dyldbootstrap::start(dyld3::MachOLoaded const*, int, char const**, dyld3::MachOLoaded const*, unsigned long*) + 450
18  dyld                            0x0000000115495025 _dyld_start + 37
19  ???                             0x0000000000000008 0 + 8

Thread 1:
0   libsystem_pthread.dylib         0x00007fff6bfea420 start_wqthread + 0

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x000000010ae11bc9  rbx: 0x0000000000000000  rcx: 0x000000010ae55d78  rdx: 0xffffffffffffffff
  rdi: 0x00007fff8039de40  rsi: 0x000000000000000c  rbp: 0x00007ffee7a29b70  rsp: 0x00007ffee7a29aa0
   r8: 0x0000000000000000   r9: 0x0000000000000910  r10: 0x0000000000000001  r11: 0x0000000000000203
  r12: 0x0000000000000001  r13: 0x0000000000000001  r14: 0x00007fffd3be47a2  r15: 0x0000600000100200
  rip: 0x000000010ae12828  rfl: 0x0000000000010202  cr2: 0x00007fff8039dea0

Logical CPU:     0
Error Code:      0x00000007 (invalid protections for user data write)
Trap Number:     14
calebmackdavenport commented 3 years ago

@calebmackdavenport great! Keep us posted, please

@d4vidi I finally replicated the issue presented above by @cmcewen (edit: seems to be the same as @mikehardy - didn't notice). Pointing fishhook at the proposed fix here https://github.com/facebook/fishhook/pull/87 resolved the stack trace listed below.

I forked fishhook https://github.com/calebmackdavenport/fishhook, pointed the submodules at this version incorporating the fix, bundled, replaced the framework in ~/Library/Detox/ with the new bundle and it worked!

To sanity check, I ran detox clean-framework-cache && detox build-framework-cache to grab the current live version and it crashed again. Repeating the framework replacement resolved it once more.

Application Specific Information:
dyld4 config: DYLD_ROOT_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot DYLD_INSERT_LIBRARIES=/Users/cmd/Library/Detox/ios/b82c1ab38241a09b9e387730dd4e233dbdb5783f/Detox.framework/Detox 
CoreSimulator 776.3 - Device: iPhone 12 Pro (39AA4807-8D99-4C3B-9645-B1E071BEA819) - Runtime: iOS 15.0 (19A339) - DeviceType: iPhone 12 Pro

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   com.wix.DetoxSync               0x0000000104ce0828 perform_rebinding_with_section + 649
1   com.wix.DetoxSync               0x0000000104ce0491 rebind_symbols_for_image + 548
2   dyld_sim                        0x0000000104a47e99 invocation function for block in dyld4::APIs::_dyld_register_func_for_add_image(void (*)(mach_header const*, long)) + 175
3   dyld_sim                        0x0000000104a340b5 dyld4::RuntimeState::withLoadersReadLock(void () block_pointer) + 41
4   dyld_sim                        0x0000000104a47d9a dyld4::APIs::_dyld_register_func_for_add_image(void (*)(mach_header const*, long)) + 116
5   com.wix.DetoxSync               0x0000000104ce0575 rebind_symbols + 157
6   com.wix.DetoxSync               0x0000000104ce00e6 +[NSTimer(DTXSpy) load] + 145
7   libobjc.A.dylib                 0x00007fff2018cd65 load_images + 970
8   dyld_sim                        0x0000000104a389da dyld4::RuntimeState::notifyObjCInit(dyld4::Loader const*) + 170
9   dyld_sim                        0x0000000104a3d94d dyld4::Loader::runInitializersBottomUp(dyld4::RuntimeState&, dyld3::Array<dyld4::Loader const*>&) const + 167
10  dyld_sim                        0x0000000104a3d93b dyld4::Loader::runInitializersBottomUp(dyld4::RuntimeState&, dyld3::Array<dyld4::Loader const*>&) const + 149
11  dyld_sim                        0x0000000104a3d9f6 dyld4::Loader::runInitializersBottomUpPlusUpwardLinks(dyld4::RuntimeState&) const + 102
12  dyld_sim                        0x0000000104a4c2d8 dyld4::APIs::runAllInitializersForMain() + 222
13  dyld_sim                        0x0000000104a30920 dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*) + 2306
14  dyld_sim                        0x0000000104a30d3f _dyld_sim_prepare + 379
15  dyld                            0x00000001107fcc27 dyld::useSimulatorDyld(int, macho_header const*, char const*, int, char const**, char const**, char const**, unsigned long*, unsigned long*) + 2093
16  dyld                            0x00000001107fa15e dyld::_main(macho_header const*, unsigned long, int, char const**, char const**, char const**, unsigned long*) + 1191
17  dyld                            0x00000001107f4224 dyldbootstrap::start(dyld3::MachOLoaded const*, int, char const**, dyld3::MachOLoaded const*, unsigned long*) + 450
18  dyld                            0x00000001107f4025 _dyld_start + 37
19  ???                             0x0000000000000008 0 + 8

Thread 1:
0   libsystem_pthread.dylib         0x00007fff6bfea420 start_wqthread + 0

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x0000000104cdfbc9  rbx: 0x0000000000000000  rcx: 0x0000000104d23d78  rdx: 0xffffffffffffffff
  rdi: 0x00007fff8039de40  rsi: 0x000000000000000c  rbp: 0x00007ffeed00f490  rsp: 0x00007ffeed00f3c0
   r8: 0x0000000000000000   r9: 0x0000000000000910  r10: 0x0000000000000001  r11: 0x0000000000000207
  r12: 0x0000000000000001  r13: 0x0000000000000001  r14: 0x00007fffd3be47a2  r15: 0x000060000384c1e0
  rip: 0x0000000104ce0828  rfl: 0x0000000000010202  cr2: 0x00007fff8039dea0

Logical CPU:     2
Error Code:      0x00000007 (invalid protections for user data write)
Trap Number:     14

Here's that workflow in action: https://streamable.com/7e9lr2

mikehardy commented 3 years ago

Fantastic result! Caleb you can have all of my daily allotment of internet points :trophy: :laughing:

I investigated the fishhook repo and it looks like the repo is a bit asleep. Google/EarlGrey repo actually internalized fishook (as a third_party module in their repo) so they could apply the fix even. I am connected with a few FB / react-native type people though on the react-native Discord - likely same as the Wix folks, but I'm paying attention now - so I posted this on the #detox channel, hopefully we can get a Fishhook release?


Hey channel detox - ios14.5+ and ios15 detox fail because they depend on https://github.com/facebook/fishhook and there is a crash in fishhook, but there are PRs there that fix it. Specifically https://github.com/facebook/fishhook/pull/87 tests out by a dedicated Caleb Davenport as being what's needed for Detox to work on ios15 (https://github.com/wix/Detox/issues/2895#issuecomment-935418682). Problem: Fishhook repo looks like it's asleep. Who do we know that can merge a PR and do a tag on there? Last committers are Scott Wolchok and "megCanicalKb". @kelset @fkgozali tagging you directly (sorry) just because we have collaborated, and you may know someone that knows someone etc and can help get the message to the right person? πŸ™


...if not, I think the EarlGrey style of internalization, or perhaps an "official" wix Fishhook fork that Detox could then reference until fishhook gets moving, would be the answer to get the fix ingested.

But that's just brainstorming.

Thoughts?

d4vidi commented 3 years ago

@mikehardy @calebmackdavenport thanks for the true effort on this. Yes - we will give this a few more days or otherwise fork fishhook.

glesperance commented 3 years ago

Seems like Zendesk decided to move ahead and fork: https://github.com/zendesk/fishhook. Perhaps Detox could point it towards the Zendesk repo if it works.

mikehardy commented 3 years ago

@glesperance interesting - zendesk/fishhoook doesn't have issues enabled though and the last two commits are...puzzling :thinking:

mklb commented 3 years ago

@mklb is there any way for you to grab the crash trace like ☝️ #2895 (comment) ?

Sorry but I downgraded to iOS 14.5..I had no idea how to get the trace back then. Maybe I can try it the next days.

@mikehardy @calebmackdavenport thanks for the true effort on this. Yes - we will give this a few more days or otherwise fork fishhook.

Ever tried patch-package ? Love this. There is no need to go through forking. Just make the changes, hook up the package as a postinstall hook. Makes it easy to propose changes to the original library as well. This way we would all benefit ;)

mikehardy commented 3 years ago

I use patch-package everywhere, always, but there's no easy way to patch Pods that are transitive dependencies except via gross (in my opinion) post_install sed hacks (or similar) in Podfiles (which I nevertheless hold my nose and do: https://github.com/facebook/react-native/commit/ac4ddec542febda744de218dae3a3d34edc7da84#diff-adcf572f001c2b710d14f409c14763f1a50b08369b3034548f1602685d21f67fR219-R248)

mikehardy commented 3 years ago

@d4vidi success! Fishhook merged the apparently-needed PR. If the Fishhook dependency were bumped to this commit ios15 may work https://github.com/facebook/fishhook/commit/aadc161ac3b80db07a9908851839a17ba63a9eb1

There are still unrelated issues about DetoxSync added in v18 of course, but this could remove the ios15 hard block

asafkorem commented 3 years ago

v18.23.1 was released, this version includes the required update for the fishhook dependency.

d4vidi commented 3 years ago

Thanks to @asafkorem, we've gained pretty high confidence with this fix, so far. @mikehardy @calebmackdavenport we can't thank you enough for your work and support here πŸ™πŸ»

MaxJadav commented 2 years ago

"detox": "^19.6.7", "react-native": "0.67.2", M1 Xcode Version 13.3 simulator iOS 15.4

Screenshot 2022-04-28 at 2 36 05 PM

@d4vidi Getting this issue. Build was success. When try to test command. throw error.

mikehardy commented 2 years ago

@MaxJadav that looks more like the whole command failed. What happened when you cut out the /usr/bin/xcrun command line and pasted it in + ran it directly? did that work at all? I have definitely run detox on a mac (intel and m1) and it's working with ios15 no problem.

bviebahn commented 2 years ago

@MaxJadav I recently had the same error and fixed it by upgrading detox from 19.4.1 to 19.6.4. Not sure if this helps though since you are already on 19.6.7...

mikehardy commented 2 years ago

All I can say is that both these repos use detox and they're both working right now, intel or m1 mac - linking in to their e2e test/example apps in case that helps

https://github.com/invertase/react-native-google-mobile-ads/tree/main/RNGoogleMobileAdsExample https://github.com/invertase/react-native-firebase/blob/main/tests/

The github workflows for both projects exercise them all the time (within the last day, during my work certainly) on intel macs and I have intel and m1 in the house, running them from time to time. No issues with those sets of dependencies / CI order-of-operations+versions

d4vidi commented 2 years ago

@MaxJadav your report is painfully short of information. Please reach out either through a separate issue, providing more details, or join our Discord.