You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix#16407: Address 32-bit Chrome out-of-memory errors in Python bindings
This commit addresses out-of-memory errors that occur when using 32-bit Chrome with large extensions (like OKX wallet) on Windows, as reported in issue #16407.
Root Cause:
32-bit Chrome has a per-tab memory limit of approximately 1GB. When extensions consume significant memory, opening new tabs can exceed this limit, causing out-of-memory errors and connection timeouts between Selenium and ChromeDriver.
Implemented Solution:
1. Added garbage collection triggers at critical points:
- After closing windows/tabs (close method)
- Before opening new windows on 32-bit systems (switch_to_new_window method)
- After quitting the driver (quit method)
2. Enhanced session cleanup in quit method:
- Iteratively closes all window handles before final quit
- Prevents orphaned windows from holding memory
- Includes exception handling to ensure cleanup completes
3. Added platform detection and warning:
- Detects 32-bit Chrome on Windows during initialization
- Logs warning about 1GB per-tab memory limitation
- Advises upgrading to 64-bit Chrome
- Includes documentation in class docstring
Technical Details:
- Imports gc, logging, and platform modules
- Overrides quit, close, and switch_to_new_window methods
- Maintains backward compatibility with existing code
- Exception handling ensures robustness
This implementation helps prevent the timeout issues described in the bug report by proactively managing memory and providing clear warnings to users about platform limitations.
0 commit comments