selenium: [πŸ› Bug]: Webdrivers crash in multi process parallel test runs

What happened?

When running parallel tests with Python>=3.10 on Mac or Linux, with Firefox, Chrome or Safari, all but one webdriver instances crash. This mostly happens in combination with third-party libraries, that download the webdriver binary, but now and then it can also be observed with Selenium’s built-in driver manager or manually downloaded drivers. In the Mac console, I guess this is the relevant bit: dyld_process_snapshot_get_shared_cache failed

How can we reproduce the issue?

I created a script, that utilizes different driver managers. It offers to use different browsers and tests can be run in parallel processes.
The test itself is a very simple click-around on the-internet.herokuapp.com

https://gist.github.com/derdualist/be27f3e5a952953ec2cf096da6a06c2c
Examples:

* Firefox, 1 process, manual binary driver management (usually succeeds):
    `python parallel_selenium_tests.py -n1 -bfirefox -mpath-to-binary -p/Users/USER/bin/geckodriver`
* Firefox, 4 processes, manual binary driver management (sometimes fails):
    `python parallel_selenium_tests.py -n4 -bfirefox -mpath-to-binary -p/Users/USER/bin/geckodriver`
* Firefox, 4 processes, third-party webdriver-manager lib (usually fails):
    `python parallel_selenium_tests.py -n4 -bfirefox -mwebdriver-manager`
* Firefox, 4 processes, build-in management (usually succeeds):
    `python parallel_selenium_tests.py -n4 -bfirefox -mselenium4`

You can change the browser to Chrome or Safari (-bchrome / -bsafari)

Relevant log output

Terminal:
> selenium.common.exceptions.WebDriverException: Message: Service /Users/USER/.wdm/drivers/chromedriver/mac64/116.0.5845.140/chromedriver-mac-arm64/chromedriver unexpectedly exited. Status code was: -9

Mac Console:
-------------------------------------
Translated Report (Full Report Below)
-------------------------------------

Incident Identifier: ...
CrashReporter Key:   ...
Hardware Model:      MacBookPro18,2
Process:             geckodriver [99999]
Path:                /Users/USER/*/geckodriver
Identifier:          geckodriver
Version:             ???
Code Type:           ARM-64 (Native)
Role:                Unspecified
Parent Process:      Python [99998]
Coalition:           com.googlecode.iterm2 [999]
Responsible Process: iTerm2 [77777]

Date/Time:           2023-09-05 17:07:19.6720 +0200
Launch Time:         2023-09-05 17:07:19.6585 +0200
OS Version:          macOS 13.5.1 (22G90)
Release Type:        User
Report Version:      104

Exception Type:  EXC_CRASH (SIGKILL (Code Signature Invalid))
Exception Codes: 0x0000000000000000, 0x0000000000000000
Termination Reason: CODESIGNING 1 Taskgated Invalid Signature

Triggered by Thread:  0

Thread 0 Crashed:
0                                 	       0x102d68a40 _dyld_start + 0


Thread 0 crashed with ARM Thread State (64-bit):
    x0: 0x0000000000000000   x1: 0x0000000000000000   x2: 0x0000000000000000   x3: 0x0000000000000000
    x4: 0x0000000000000000   x5: 0x0000000000000000   x6: 0x0000000000000000   x7: 0x0000000000000000
    x8: 0x0000000000000000   x9: 0x0000000000000000  x10: 0x0000000000000000  x11: 0x0000000000000000
   x12: 0x0000000000000000  x13: 0x0000000000000000  x14: 0x0000000000000000  x15: 0x0000000000000000
   x16: 0x0000000000000000  x17: 0x0000000000000000  x18: 0x0000000000000000  x19: 0x0000000000000000
   x20: 0x0000000000000000  x21: 0x0000000000000000  x22: 0x0000000000000000  x23: 0x0000000000000000
   x24: 0x0000000000000000  x25: 0x0000000000000000  x26: 0x0000000000000000  x27: 0x0000000000000000
   x28: 0x0000000000000000   fp: 0x0000000000000000   lr: 0x0000000000000000
    sp: 0x000000016d68f4e0   pc: 0x0000000102d68a40 cpsr: 0x00001000
   far: 0x0000000000000000  esr: 0x00000000  Address size fault

Binary Images:
       0x102d64000 -        0x102df3fff  (*) <e7a99595-e0f8-34af-be8b-9347d0d658a4> ???
       0x102770000 -        0x102a7bfff  (*) <4c4c4477-5555-3144-a1da-acd8f1eb2342> ???

Error Formulating Crash Report:
dyld_process_snapshot_get_shared_cache failed

EOF

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

{"app_name":"geckodriver","timestamp":"2023-09-05 17:07:19.00 +0200","app_version":"","slice_uuid":"...","build_version":"","platform":0,"share_with_app_devs":1,"is_first_party":1,"bug_type":"309","os_version":"macOS 13.5.1 (22G90)","roots_installed":0,"incident_id":"...","name":"geckodriver"}
{
  "uptime" : 210000,
  "procRole" : "Unspecified",
  "version" : 2,
  "userID" : 555,
  "deployVersion" : 210,
  "modelCode" : "MacBookPro18,2",
  "coalitionID" : 853,
  "osVersion" : {
    "train" : "macOS 13.5.1",
    "build" : "22G90",
    "releaseType" : "User"
  },
  "captureTime" : "2023-09-05 17:07:19.6720 +0200",
  "incident" : "...",
  "pid" : 99999,
  "translated" : false,
  "cpuType" : "ARM-64",
  "roots_installed" : 0,
  "bug_type" : "309",
  "procLaunch" : "2023-09-05 17:07:19.6585 +0200",
  "procStartAbsTime" : 5053830690619,
  "procExitAbsTime" : 5053830731780,
  "procName" : "geckodriver",
  "procPath" : "\/Users\/USER\/*\/geckodriver",
  "parentProc" : "Python",
  "parentPid" : 99998,
  "coalitionName" : "com.googlecode.iterm2",
  "crashReporterKey" : "...",
  "responsiblePid" : 77777,
  "responsibleProc" : "iTerm2",
  "codeSigningID" : "",
  "codeSigningTeamID" : "",
  "codeSigningFlags" : 16777728,
  "codeSigningValidationCategory" : 0,
  "codeSigningTrustLevel" : 0,
  "wakeTime" : 11685,
  "sleepWakeUUID" : "...",
  "sip" : "enabled",
  "exception" : {"codes":"0x0000000000000000, 0x0000000000000000","rawCodes":[0,0],"type":"EXC_CRASH","signal":"SIGKILL (Code Signature Invalid)"},
  "termination" : {"flags":66,"code":1,"namespace":"CODESIGNING","indicator":"Taskgated Invalid Signature"},
  "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":3437669,"threadState":{"x":[{"value":0},{"value":0},{"value":0},{"value":0},{"value":0},{"value":0},{"value":0},{"value":0},{"value":0},{"value":0},{"value":0},{"value":0},{"value":0},{"value":0},{"value":0},{"value":0},{"value":0},{"value":0},{"value":0},{"value":0},{"value":0},{"value":0},{"value":0},{"value":0},{"value":0},{"value":0},{"value":0},{"value":0},{"value":0}],"flavor":"ARM_THREAD_STATE64","lr":{"value":0},"cpsr":{"value":4096},"fp":{"value":0},"sp":{"value":6130562272},"esr":{"value":0,"description":" Address size fault"},"pc":{"value":4342581824,"matchesCrashFrame":1},"far":{"value":0}},"frames":[{"imageOffset":19008,"symbol":"_dyld_start","symbolLocation":0,"imageIndex":0}]}],
  "usedImages" : [
  {
    "source" : "P",
    "arch" : "arm64e",
    "base" : 4342562816,
    "size" : 589824,
    "uuid" : "...",
    "name" : ""
  },
  {
    "source" : "P",
    "arch" : "arm64",
    "base" : 4336320512,
    "size" : 3194880,
    "uuid" : "...",
    "name" : ""
  }
],
  "vmSummary" : "ReadOnly portion of Libraries: Total=5472K resident=0K(0%) swapped_out_or_unallocated=5472K(100%)\nWritable regions: Total=8176K written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=8176K(100%)\n\n                                VIRTUAL   REGION \nREGION TYPE                        SIZE    COUNT (non-coalesced) \n===========                     =======  ======= \nSTACK GUARD                       56.0M        1 \nStack                             8176K        1 \n__DATA                              32K        2 \n__DATA_CONST                       224K        2 \n__DATA_DIRTY                        16K        1 \n__LINKEDIT                        1776K        2 \n__TEXT                            3696K        2 \n===========                     =======  ======= \nTOTAL                             69.6M       11 \n",
  "legacyInfo" : {
  "threadTriggered" : {

  }
},
  "logWritingSignature" : "...",
  "trialInfo" : {
  "rollouts" : [
    {
      "rolloutId" : "...",
      "factorPackIds" : {

      },
      "deploymentId" : ...
    },
    {
      "rolloutId" : "...",
      "factorPackIds" : {

      },
      "deploymentId" : ...
    }
  ],
  "experiments" : [

  ]
},
  "reportNotes" : [
  "dyld_process_snapshot_get_shared_cache failed"
]
}

Operating System

MacBook Pro18, Linux Server (Jenkins)

Selenium version

Python selenium==4.12.0

What are the browser(s) and version(s) where you see this issue?

Chrome 116.0.5845.187, Firefox 117.0.1, Safari 16.6

What are the browser driver(s) and version(s) where you see this issue?

chromedriver 116.0.5845.140, geckodriver 0.33.0

Are you using Selenium Grid?

–

About this issue

  • Original URL
  • State: closed
  • Created 10 months ago
  • Comments: 16 (9 by maintainers)

Most upvoted comments

Thanks for clarifying. We’d be happy to check the issue when we can reproduce it with code that only uses Selenium.