Main Ecosystems
HomePython CorePandas ReferenceNumPy ScientificFastAPI & PydanticDjango Enterprise
More Ecosystems
Environment & SetupRequests & HTTPAsyncIO ConcurrencyObject-Oriented OOPPyTorch Deep LearningScikit-Learn MLFlask FrameworkWeb ScrapingDatabase & ORMDevOps & Docker

Scraping/Selenium: ChromeDriver Failed to read descriptor from node connection: A device attached to the system is not functioning

Verified FixPython 3.10+Selenium 4.18+, Chrome 120+Silo: scraping

Quick Fix / Solution Rapide

This error occurs when Windows security software, antivirus, or port exhaustion blocks the local TCP connection between ChromeDriver and the Chrome browser process. Add --remote-debugging-port=0 and --no-sandbox to ChromeOptions.

Root Cause Analysis

This error occurs on Windows when Selenium launches chromedriver.exe to automate Google Chrome, but the DevTools Protocol pipe or local TCP loopback socket fails with Failed to read descriptor from node connection: A device attached to the system is not functioning (0x1F).

Root Cause 1: Antivirus / Endpoint Security Blocking Inter-Process Pipes

Windows Defender, corporate endpoint protection (CrowdStrike, CarbonBlack), or third-party firewalls block ChromeDriver from establishing a named pipe or debugging socket to the child Chrome process.

Root Cause 2: Chrome Version and ChromeDriver Version Mismatch

If Google Chrome auto-updates to a new major version in the background while an older chromedriver.exe remains in the system PATH, protocol communication errors occur.

Root Cause 3: Port Collision on Remote Debugging Socket

Multiple concurrent Selenium tests attempting to bind to the default debugging port (9222) collide, causing socket initialization to fail.

Root Cause 4: Zombie Chrome Processes Locking the User Profile

Crashed previous test runs leave orphan chrome.exe processes running in the background, locking the temporary user profile directory.

Reproduction Code (MCVE)

Example: Bug Reproduction
# Simulating Windows ChromeDriver node descriptor read failure
class MockChromeDriverConnection:
    def open_pipe(self, is_pipe_blocked: bool):
        if is_pipe_blocked:
            raise WebDriverException(
                "WebDriverException: Message: Failed to read descriptor from node connection: "
                "A device attached to the system is not functioning. (0x1F) "
                "ChromeDriver failed to establish communication with Google Chrome on Windows."
            )

class WebDriverException(Exception):
    pass

driver_conn = MockChromeDriverConnection()
driver_conn.open_pipe(is_pipe_blocked=True)

Solution 1: Configure ChromeOptions with Dynamic Debugging Port and Headless Mode

Add --remote-debugging-port=0, --no-sandbox, and --disable-dev-shm-usage to ChromeOptions.

Example: Recommended Solution
# Solution 1: Recommended ChromeOptions configuration for Windows
chrome_arguments = [
    "--remote-debugging-port=0",   # Assign dynamic available ephemeral port
    "--no-sandbox",
    "--disable-dev-shm-usage",
    "--disable-gpu",
    "--headless=new"
]

print("Configured Chrome arguments for Windows stability:")
for arg in chrome_arguments:
    print(f"  {arg}")

assert "--remote-debugging-port=0" in chrome_arguments

Solution 2: Terminate Orphan Chrome Background Processes on Windows

Kill lingering zombie Chrome and ChromeDriver processes using PowerShell or Task Manager.

Example: Alternative Solution
# Solution 2: PowerShell cleanup command
cleanup_powershell = "Stop-Process -Name chrome,chromedriver -Force -ErrorAction SilentlyContinue"
print("Command to purge zombie processes on Windows:")
print(f"  PowerShell: {cleanup_powershell}")
assert "Stop-Process" in cleanup_powershell

Always call driver.quit() in a try...finally block to guarantee that the browser process terminates cleanly when errors occur during scraping.

Note de reproductibilité : Cette erreur dépend du système d'exploitation Windows, de l'état des processus résidents en mémoire et des règles de sécurité locales/antivirus.

Contrast A device attached to the system is not functioning with SessionNotCreatedException: SessionNotCreatedException occurs when version numbers mismatch; device not functioning occurs at the OS socket/pipe layer.