Skip to content Skip to sidebar Skip to footer

How To Address Chrome Displaying "aw, Snap!" Page While Executing Tests Through Chromedriver And Selenium Through Python 3

After about an hour of running my selenium browser will display an 'Aw, Snap!' page, and I am unable to interact with the browser in any way from the console, and I have to close b

Solution 1:

This error screen...

Aw, Snap!

...implies that the ChromeDriver is having problems loading a new Browsing Context i.e. the Chrome Browser session.


Reason

You are seeing this error about an hour of running Chrome Browser based Selenium tests and this issue can occur due to reduced size of /dev/shm i.e. /dev/shm running out of space. As an example:

mount -o remount,size=64M /dev/shm

Ideally it should have been:

mount --bind /tmp/ /dev/shm/

While running Chromium in Docker environment 64M size is pretty much reduced state.


Deep dive

As per the discussion in Issue 522853: Linux: Chrome/Chromium SIGBUS/Aw, Snap! on small /dev/shm:

  • util_posix.cc:GetShmemTempDir on Linux attempts to always use /dev/shm for non-executable memory.
  • The required size of /dev/shm by large depends on the number of renderers, screen resolution, etc.
  • At time you may run out of memory due to large webapps even before running out of space in /dev/shm
  • At times some Docker containers decides to severely limit the size of their shared memory by default, which may be ok for some workloads, and probably prevents any container from hogging all the memory.

This issue was analyzed and discussed at length in the following discussions:


Solution

This issue was finally addressed through the commit / revision by fixing CreateAnonymousSharedMemory() not to leak FILE when returning fd.

CreateAnonymousSharedMemory() was modified to return the writable memory handle as a file-descriptor rather than as a FILE. Since POSIX does not provide a standard way to teardown a FILE without also close()ing the underlying file-descriptor, this was achieved by leaking the FILE. We now provide CreateAndOpenFdForTemporaryFileInDir(), to avoid the need to wrap the temporary-file descriptor into a FILE at all.


Conclusion

Ensure that:

  • /dev/shm/ is mounted with enough memory.
  • Selenium is upgraded to current levels Version 3.141.59.
  • ChromeDriver is updated to current ChromeDriver v79.0.3945.36 level.
  • Chrome is updated to current Chrome Version 79.0 level. (as per ChromeDriver v78.0 release notes)
  • Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
  • If your base Web Client version is too old, then uninstall it through Revo Uninstaller and install a recent GA and released version of Web Client.
  • Take a System Reboot.
  • Execute your @Test as non-root user.

Solution 2:

I have the same problem, I worked around it by restarting my driver every 30 min automatically in withing the function.


Post a Comment for "How To Address Chrome Displaying "aw, Snap!" Page While Executing Tests Through Chromedriver And Selenium Through Python 3"