I have an application built over CEF v135.0.22.
- It renders web page in headless mode and then encode the screen into video stream.
- It is deployed in docker container with NVIDIA GPU enabled.
- It allows rendering multiple pages, each page is rendered individually into a video stream.
- The application works fine with a single page opened.
- But when opening more pages, it could end with OOM error but there is suificient video memory.
1. Using `/app/web-renderer --use-angle=vulkan` to launch
The first page works fine and encodes into video.
When openning the 2nd page, it fails with following error.
[77:128:0617/064912.445207:ERROR:frame_sink_video_capturer_impl.cc(899)] Unable to allocate frame for first frame capture: OOM?
This error is from https://chromium.googlesource.com/chromium/src/+/refs/tags/135.0.7049.128/components/viz/service/frame_sinks/video_capture/frame_sink_video_capturer_impl.cc when it tries to allocate memory.
- Code: Select all
UMA_HISTOGRAM_BOOLEAN("Viz.FrameSinkVideoCapturer.FrameResurrected",
can_resurrect_content);
const float utilization = GetPipelineUtilization();
const int utilization_pct = AsPercent(utilization);
// Do not proceed if the pool did not provide a frame: This indicates the
// pipeline is full.
if (!frame) {
TRACE_EVENT_INSTANT("gpu.capture", "PipelineLimited", "trigger",
VideoCaptureOracle::EventAsString(event),
"utilization_pct", utilization_pct);
oracle_->RecordWillNotCapture(utilization);
if (next_capture_frame_number_ == 0) {
// The pool was unable to provide a buffer for the very first capture, and
// so there is no expectation of recovery. Thus, treat this as a fatal
// resource allocation issue instead of a transient one.
LOG(ERROR) << "Unable to allocate frame for first frame capture: OOM?";
Stop();
} else {
MaybeScheduleRefreshFrame();
}
return;
}
Definitely, there is enough video memory and you can see below
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 575.57.08 Driver Version: 575.57.08 CUDA Version: 12.9 |
|-----------------------------------------+------------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+========================+======================|
| 0 NVIDIA GeForce RTX 4060 ... Off | 00000000:01:00.0 On | N/A |
| N/A 48C P4 10W / 60W | 986MiB / 8188MiB | 34% Default |
| | | N/A |
+-----------------------------------------+------------------------+----------------------+
+-----------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=========================================================================================|
| 0 N/A N/A 3535 G /usr/lib/xorg/Xorg 328MiB |
| 0 N/A N/A 3914 G /usr/bin/gnome-shell 142MiB |
| 0 N/A N/A 4654 G ...ess --variations-seed-version 192MiB |
| 0 N/A N/A 18245 G ...ersion=20250613-130015.573000 172MiB |
| 0 N/A N/A 30069 C+G /app/web-renderer 59MiB |
+-----------------------------------------------------------------------------------------+
2. Using `vglrun /app/web-renderer` to launch
For the first three pages, it works fine and each page can be rendered into individual video stream.
However, when openning the 4th page, it fails with OOM error again but surely there is enough video memory.
[331:339:0616/062620.494556:ERROR:cmd_buffer_helper.cc(141)] ContextResult::kFatalFailure: CommandBufferHelper::AllocateRingBuffer() failed
[344:344:0616/062620.494589:ERROR:cmd_buffer_helper.cc(141)] ContextResult::kFatalFailure: CommandBufferHelper::AllocateRingBuffer() failed
[135:135:0616/062620.494714:ERROR:cmd_buffer_helper.cc(141)] ContextResult::kFatalFailure: CommandBufferHelper::AllocateRingBuffer() failed
The error is from source code here: https://chromium.googlesource.com/chromium/src/+/refs/heads/main/gpu/command_buffer/client/cmd_buffer_helper.cc#136
- Code: Select all
gpu::ContextResult CommandBufferHelper::Initialize(uint32_t ring_buffer_size) {
ring_buffer_size_ = ring_buffer_size;
if (!AllocateRingBuffer()) {
// This would fail if CreateTransferBuffer fails, which will not fail for
// transient reasons such as context loss. See http://crrev.com/c/720269
LOG(ERROR) << "ContextResult::kFatalFailure: "
<< "CommandBufferHelper::AllocateRingBuffer() failed";
return gpu::ContextResult::kFatalFailure;
}
return gpu::ContextResult::kSuccess;
}
CommandBufferHelper::~CommandBufferHelper() {
FreeRingBuffer();
}
It seems I reached some VRAM limitation when running the application in docker container although there is suificient video memory.
I checked in NVIDIA's Container Toolkit doc, no such limitation.
Do you know where the issue is?