Firefox crashes when create_wl_buffer() fails at egl/drivers/dri2/platform_wayland.c
When create_wl_buffer() at egl/drivers/dri2/platform_wayland.c fails (for instance we're running out of file descriptors) mesa backend crashes because there isn't any check that dri2_surf->current->wl_buffer is valid.
This happens when Firefox uses dmabuf buffers for video playback, ffmpeg does parallel decode to dmabuf buffers and the buffers are shared across Firefox processes while html page with video content is reloaded.
Firefox releases dmabuf buffers with some delay as dmabuf surfaces are used by more than one process so I think it's ok to just skip some frames until dmabuf buffers are released and mesa can allocate a new buffer.
backtrace:
#3 0x00007ffff7f931e0 in <signal handler called> () at /lib64/libpthread.so.0
#4 0x00007ffff60c23c3 in wl_proxy_add_listener (proxy=0x0, implementation=0x7fffbea7b950 <wl_buffer_listener>, data=0x7fffa54c1400) at src/wayland-client.c:561
#5 0x00007fffbea6155c in wl_buffer_add_listener (data=0x7fffa54c1400, listener=0x7fffbea7b950 <wl_buffer_listener>, wl_buffer=<optimized out>)
at /usr/include/wayland-client-protocol.h:1867
#6 dri2_wl_swap_buffers_with_damage (disp=0x7fffbfa14000, draw=0x7fffa54c1400, rects=0x7ffecf5ec9f0, n_rects=1) at ../src/egl/drivers/dri2/platform_wayland.c:1105
#7 0x00007fffbea5785a in dri2_swap_buffers_with_damage (disp=0x7fffbfa14000, surf=0x7fffa54c1400, rects=0x7ffecf5ec9f0, n_rects=1) at ../src/egl/drivers/dri2/egl_dri2.c:2022
#8 0x00007fffbea486bb in _eglSwapBuffersWithDamageCommon (disp=0x7fffbfa14000, surf=0x7fffa54c1400, rects=0x7ffecf5ec9f0, n_rects=1) at ../src/egl/main/eglapi.c:1376