mediapipe
mediapipe copied to clipboard
mediapipe::CvPixelBufferPoolWrapper::GetBuffer() fatal: Check failed: !err Error creating pixel buffer: -6662
Also see Google bug http://b/349815177.
Have I written custom code (as opposed to using a stock example script provided in MediaPipe)
Yes
OS Platform and Distribution
iOS 15.8.2, 16.7.8, 17.5.1
Mobile device if the issue happens on mobile device
iPad11,7, iPhone10,2, iPhone9,4
Browser and version if the issue happens on browser
No response
Programming Language and version
C++
MediaPipe version
0.10.15
Bazel version
head
Solution
N/A
Android Studio, NDK, SDK versions (if issue is related to building in Android environment)
No response
Xcode & Tulsi version (if issue is related to building for iOS)
No response
Describe the actual behavior
Fatal error Check failed: !err Error creating pixel buffer: -6662 from mediapipe::CvPixelBufferPoolWrapper::GetBuffer()
Describe the expected behaviour
Should not fatal on memory allocation failure
Standalone code/steps you may have used to try to get what you need
The error `kCVReturnAllocationFailed` (aka `-6662`) is defined in `CoreVideo.framework/Headers/CVReturn.h`.
https://developer.apple.com/documentation/corevideo/kcvreturnallocationfailed
This error is occasionally returned by `CVPixelBufferPoolCreatePixelBufferWithAuxAttributes()` here:
https://github.com/google-ai-edge/mediapipe/blob/4aea8e7723a6ebe79a7e0ae4cce9b1e89c1d633d/mediapipe/gpu/pixel_buffer_pool_util.cc#L107
This causes mediapipe to abort the process. Instead, it should return an `absl::ResourceExhaustedError()` here when `kCVReturnAllocationFailed` is returned:
https://github.com/google-ai-edge/mediapipe/blob/4aea8e7723a6ebe79a7e0ae4cce9b1e89c1d633d/mediapipe/gpu/pixel_buffer_pool_util.cc#L109
However, the fix isn't trivial, because this then turns into another fatal a little higher in the stack in `mediapipe::GlCalculatorHelper::CreateDestinationTexture()`:
https://github.com/google-ai-edge/mediapipe/blob/4aea8e7723a6ebe79a7e0ae4cce9b1e89c1d633d/mediapipe/gpu/gl_calculator_helper.cc#L219
This will require changing `GlCalculatorHelper::CreateDestinationTexture()` to return an `absl::StatusOr<GlTexture>`, which will require updating all callsites.
Other info / Complete Logs
Example crash:
Thread 60 drishti/0 (id: 0x0006f3da) CRASHED
Exception info 0x00010003 / 0x00000006 @0x00000001dc5ab198
0x00000001dc5ab198 (libsystem_kernel.dylib + 0x00007198) __pthread_kill
0x00000001ebb3a5f4 (libsystem_pthread.dylib + 0x0000d5f4) pthread_kill
0x00000001a7bf44b4 (libsystem_c.dylib + 0x0001c4b4) abort
0x0000000109fb2374 (NameOfApp -log_message.cc:359) absl::log_internal::LogMessage::FailWithoutStackTrace()
0x0000000109fb2774 (NameOfApp -log_message.cc:516) absl::log_internal::LogMessage::Die()
0x0000000109fb2530 (NameOfApp -log_message.cc:525) absl::log_internal::LogMessage::SendToLog()
0x0000000109fb2220 (NameOfApp -log_message.cc:437) absl::log_internal::LogMessage::Flush()
0x0000000109fb27b4 (NameOfApp -log_message.cc:617) absl::log_internal::LogMessageFatal::~LogMessageFatal()
0x0000000109fb27cc (NameOfApp -log_message.cc:616) absl::log_internal::LogMessageFatal::~LogMessageFatal()
0x00000001092d5154 (NameOfApp -log_message.h) mediapipe::CvPixelBufferPoolWrapper::CreateBufferWithoutPool(mediapipe::internal::GpuBufferSpec const&)
0x000000010922f41c (NameOfApp -multi_pool.h:118) mediapipe::MultiPool<mediapipe::CvPixelBufferPoolWrapper, mediapipe::internal::GpuBufferSpec, mediapipe::GpuBuffer>::Get(mediapipe::internal::GpuBufferSpec const&)
0x00000001092b82d8 (NameOfApp -gpu_buffer_multi_pool.h:53) mediapipe::GpuBufferMultiPool::GetBuffer(int, int, mediapipe::GpuBufferFormat)
0x00000001092b82d8 (NameOfApp -gl_calculator_helper.cc:237) mediapipe::GlCalculatorHelper::CreateDestinationTexture(int, int, mediapipe::GpuBufferFormat)
Hi @bhamiltoncx,
I cannot access the CL in Buganizer as I do not have permission for that component. Could you provide the complete steps you are following from our documentation or the standalone command you are using? This will help us reproduce and understand the issue better for resolution.
Thank you!!
Hi @kuaashish , let's chat over email. Thanks!
I'm having a similar error after running for a while on an M1 Mac:
F0000 00:00:1729106057.131085 15250755 gpu_buffer_storage_cv_pixel_buffer.cc:154] Check failed: status_or_buffer is OK (INTERNAL: ; RET_CHECK failure (mediapipe/objc/util.cc:287) err == kCVReturnSuccessError creating pixel buffer: -6662) *** Check failure stack trace: *** @ 0x16d03a844 absl::log_internal::LogMessage::SendToLog() @ 0x16d03a28c absl::log_internal::LogMessage::Flush() @ 0x16d03ab70 absl::log_internal::LogMessageFatal::~LogMessageFatal() @ 0x16d03ab98 absl::log_internal::LogMessageFatal::~LogMessageFatal() @ 0x16c9f2598 mediapipe::ConvertFromImageFrame() @ 0x16c9f2e08 std::__1::__invoke_void_return_wrapper<>::__call<>() @ 0x16c9f0de8 std::__1::invoke<>() @ 0x16c9efb8c mediapipe::GpuBuffer::StorageHolder::GetStorageForView() @ 0x16c9f060c mediapipe::GpuBuffer::GetStorageForViewOrDie() @ 0x16c974a54 mediapipe::Image::ConvertToGpu() @ 0x16c460980 std::__1::__function::__func<>::operator()() @ 0x16c9f6c9c mediapipe::GlContext::SwitchContextAndRun() @ 0x16c9f63e0 mediapipe::GlContext::Run() @ 0x16c46ab7c mediapipe::GlCalculatorHelper::RunInGlContext() @ 0x16c46ad40 mediapipe::GlCalculatorHelper::RunInGlContext() @ 0x16c46075c mediapipe::GlCalculatorHelper::RunInGlContext<>() @ 0x16c45fd38 mediapipe::api2::ImageCloneCalculator::Process() @ 0x16ca07ddc mediapipe::CalculatorNode::ProcessNode() @ 0x16c9e6240 mediapipe::internal::SchedulerQueue::RunCalculatorNode() @ 0x16c9e5cdc mediapipe::internal::SchedulerQueue::RunNextTask() @ 0x16ca000f0 mediapipe::ThreadPool::RunWorker() @ 0x16c9ffb9c mediapipe::ThreadPool::WorkerThread::ThreadBody() @ 0x19943df94 _pthread_start @ 0x199438d34 thread_start /Users/jonathanamichaels/miniconda/envs/mediapipe_env/lib/python3.9/multiprocessing/resource_tracker.py:216: UserWarning: resource_tracker: There appear to be 1 leaked semaphore objects to clean up at shutdown warnings.warn('resource_tracker: There appear to be %d ' Abort trap: 6
@JonathanAMichaels I'm experiencing the same issue. Did you figure out why was it happening?