I just learned something interesting today. When I was doing investigation regarding the website crash during automation testing because my local environment couldn’t have proper resources (in this case it is low memory), i didn’t expect that it would piqued my interest when trying to unpack the root cause and delve deeper into something “unknown” for me

so basically, when the website crashes while running automation on my local machine, it’s a multi-process OS-level application. perhaps i can simplify it like this

  • automation start running using playwright
  • 1 main browser process (here i’m using chromium)
  • it has a tab and frame
  • GPU start process
  • network also start the process (used for pass the data between process)
  • each of these will interacts with: linux namespace, shared memory, GPU drivers and sandbox permissions

the crash occurs if one of those processes fails to start renderer stop page crashed

and it’s particularly interesting because the crash only happened during the launch of the website homepage, and turns out navigation at the initial stage can be considered the heaviest load during browser lifecycle. The browser must cover and process:

  • spawn the renderer utilities
  • start to initialize the sandbox which has isolated the PID namespaces, user namespaces and seccomp filters so it can be authenticated the linux permission (https://www.kernel.org/doc/html/v4.19/userspace-api/seccomp_filter.html)
  • once sandbox success, start allocate shm buffers
  • GPU start rendering final UI layers by offloading task from CPU
  • running the task to execute the javascript program (in this case is our platform)
  • load everything (framework, media, fonts, assets, and so on)

after digging and deeper and checking the trace log, one of the main reasons why it crashed on my local machine is because it only has a smaller size of shm and the availability at that time is only 1 % out of my current tmpfs (70 to 90 MB out of 7.7 GiB)

so, when the shm start filled up, it will be:

  • kernel kills the process
  • rendered utilities cant allocate any memory
  • stop the renderer frames function alongside hold the javascript execution buffers

think of it like: automation running browser process renderer process OS kernel Hardware (CPU, GPU, shm)