Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SIGABRT occur in Embedder when using camera and video plugin same time #86

Closed
bbrto21 opened this issue May 4, 2021 · 5 comments
Closed
Assignees
Labels
help wanted Extra attention is needed

Comments

@bbrto21
Copy link
Contributor

bbrto21 commented May 4, 2021

I have a problem as below, but I haven't made any progress yet.
Is there something wrong with the way I handle the external textures?
You can check the relevant things here.
I need your help and thank you in advance.

How to reproduce

  1. Launch a camera example
  2. Select camera
  3. Take a video a while and done, then the video will play automatically
  4. Select another camera
    Repeat 2-4 until SIGABRT occurs. If the debugger is not attached, rendering may appear to have stopped.

Call stack

(lldb) Process 17608 stopped
* thread #23, name = 'Runner.dll', stop reason = signal SIGABRT
    frame #0: 0xb6bf94fc libc.so.6`__GI_raise + 156
libc.so.6`__GI_raise:
->  0xb6bf94fc <+156>: mov    r0, r12
    0xb6bf9500 <+160>: add    sp, sp, #260
    0xb6bf9504 <+164>: pop    {r4, r7, pc}
    0xb6bf9508 <+168>: ldr    r3, [pc, #0x18]
bt
* thread #23, name = 'Runner.dll', stop reason = signal SIGABRT
  * frame #0: 0xb6bf94fc libc.so.6`__GI_raise + 156
    frame #1: 0xb6be3788 libc.so.6`__GI_abort + 276
    frame #2: 0xa92bd1e0 libflutter_tizen.so`std::__1::__throw_system_error(int, char const*) + 8
    frame #3: 0xa92bc40a libflutter_tizen.so`std::__1::mutex::lock() + 22
    frame #4: 0xa929be52 libflutter_tizen.so`ExternalTextureGL::DestructionCallback(void*) + 18
    frame #5: 0xa7cfa82a libflutter_engine.so`GrSurface::onRelease() + 50
    frame #6: 0xa7dbb00a libflutter_engine.so`GrGLTexture::onRelease() + 158
    frame #7: 0xa7ce7a44 libflutter_engine.so`GrGpuResource::release() + 14
    frame #8: 0xa7cf45da libflutter_engine.so`GrResourceCache::notifyRefCntReachedZero(GrGpuResource*) + 352
    frame #9: 0xa7d09d88 libflutter_engine.so`GrTextureProxy::~GrTextureProxy() + 128
    frame #10: 0xa7d09e6a libflutter_engine.so`virtual thunk to GrTextureProxy::~GrTextureProxy() + 22
    frame #11: 0xa7d7fc04 libflutter_engine.so`SkImage_Gpu::~SkImage_Gpu() + 56
    frame #12: 0xa7af6bd6 libflutter_engine.so`flutter::EmbedderExternalTextureGL::~EmbedderExternalTextureGL() + 54
    frame #13: 0xa7b6898e libflutter_engine.so`std::__1::__tree<std::__1::__value_type<long long, std::__1::shared_ptr<flutter::Texture> >, std::__1::__map_value_compare<long long, std::__1::__value_type<long long, std::__1::shared_ptr<flutter::Texture> >, std::__1::less<long long>, true>, std::__1::allocator<std::__1::__value_type<long long, std::__1::shared_ptr<flutter::Texture> > > >::erase(std::__1::__tree_const_iterator<std::__1::__value_type<long long, std::__1::shared_ptr<flutter::Texture> >, std::__1::__tree_node<std::__1::__value_type<long long, std::__1::shared_ptr<flutter::Texture> >, void*>*, int>) + 112
    frame #14: 0xa7b13d9a libflutter_engine.so`fml::MessageLoopImpl::FlushTasks(fml::FlushType) + 170
    frame #15: 0xa7b17b5c libflutter_engine.so`fml::MessageLoopLinux::Run() + 96
    frame #16: 0xa7b13cb6 libflutter_engine.so`fml::MessageLoopImpl::DoRun() + 26
    frame #17: 0xa7b17200 libflutter_engine.so`void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, fml::Thread::Thread(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::$_0> >(void*) + 216
    frame #18: 0xb66c8438 libpthread.so.0
    frame #19: 0xb6c9be28 libc.so.6

@bbrto21 bbrto21 added the help wanted Extra attention is needed label May 4, 2021
@bwikbs
Copy link
Member

bwikbs commented May 4, 2021

After a few observations, I think this is a problem that ExternalTextureGL is not normal state when DestructionCallback is called.

From now on, the situation which textures are updated competitively seems irrelevant.

@bbrto21
Copy link
Contributor Author

bbrto21 commented May 6, 2021

@bwikbs I guess you are right

I observed a case that calling a destruction_callback registered with FlutterOpenGLexture after ExternalTextureGL is destroyed

ExternalTextureGL is immediately destroyed in FlutterUnregisterExternalTexture, however, the destruction_callback is referencing the destroyed instance in another thread

@xuelian-bai @xiaowei-guan

@xiaowei-guan
Copy link
Contributor

@bwikbs I guess you are right

I observed a case that calling a destruction_callback registered with FlutterOpenGLexture after ExternalTextureGL is destroyed

ExternalTextureGL is immediately destroyed in FlutterUnregisterExternalTexture, however, the destruction_callback is referencing the destroyed instance in another thread

@xuelian-bai @xiaowei-guan
Ok, we check this issue.

@bbrto21
Copy link
Contributor Author

bbrto21 commented May 6, 2021

A similar problem was found again when I test, which seems to require a mutex in the exturenal texture-related API of flutter-tizen.

(lldb) Process 947 stopped and restarted: thread 45 received signal: SIGCHLD
Process 947 stopped
* thread #22, name = 'Runner.dll', stop reason = signal SIGSEGV: invalid address (fault address: 0x14)
    frame #0: 0xb666fcec libpthread.so.0`__pthread_mutex_lock
libpthread.so.0`__pthread_mutex_lock:
->  0xb666fcec <+0>:  ldr    r3, [r0, #0xc]
    0xb666fcf0 <+4>:  movw   r2, #0x17f
    0xb666fcf4 <+8>:  push   {r4, r5, r6, lr}
    0xb666fcf8 <+12>: ands   r5, r3, #124
bt
* thread #22, name = 'Runner.dll', stop reason = signal SIGSEGV: invalid address (fault address: 0x14)
  * frame #0: 0xb666fcec libpthread.so.0`__pthread_mutex_lock
    frame #1: 0xa9ca23ac libflutter_tizen.so`std::__1::mutex::lock() + 8
    frame #2: 0xa9c81c8c libflutter_tizen.so`ExternalTextureGL::PopulateTextureWithIdentifier(unsigned int, unsigned int, FlutterOpenGLTexture*) + 28
    frame #3: 0xa84d3f10 libflutter_engine.so`std::__1::__function::__func<FlutterEngineInitialize::$_51, std::__1::allocator<FlutterEngineInitialize::$_51>, sk_sp<SkImage> (long long, GrDirectContext*, SkISize const&)>::operator()(long long&&, GrDirectContext*&&, SkISize const&) + 80
    frame #4: 0xa84dcc60 libflutter_engine.so`flutter::EmbedderExternalTextureGL::Paint(SkCanvas&, SkRect const&, bool, GrDirectContext*, SkFilterQuality) + 96
    frame #5: 0xa8807974 libflutter_engine.so`flutter::TextureLayer::Paint(flutter::Layer::PaintContext&) const + 60
    frame #6: 0xa8804dd4 libflutter_engine.so`flutter::ContainerLayer::PaintChildren(flutter::Layer::PaintContext&) const + 86
    frame #7: 0xa8807c74 libflutter_engine.so`flutter::TransformLayer::Paint(flutter::Layer::PaintContext&) const + 68
    frame #8: 0xa8804dd4 libflutter_engine.so`flutter::ContainerLayer::PaintChildren(flutter::Layer::PaintContext&) const + 86
    frame #9: 0xa8807c74 libflutter_engine.so`flutter::TransformLayer::Paint(flutter::Layer::PaintContext&) const + 68
    frame #10: 0xa8804dd4 libflutter_engine.so`flutter::ContainerLayer::PaintChildren(flutter::Layer::PaintContext&) const + 86
    frame #11: 0xa8806a92 libflutter_engine.so`flutter::PhysicalShapeLayer::Paint(flutter::Layer::PaintContext&) const + 210
    frame #12: 0xa8804dd4 libflutter_engine.so`flutter::ContainerLayer::PaintChildren(flutter::Layer::PaintContext&) const + 86
    frame #13: 0xa8807c74 libflutter_engine.so`flutter::TransformLayer::Paint(flutter::Layer::PaintContext&) const + 68
    frame #14: 0xa8804dd4 libflutter_engine.so`flutter::ContainerLayer::PaintChildren(flutter::Layer::PaintContext&) const + 86
    frame #15: 0xa8807c74 libflutter_engine.so`flutter::TransformLayer::Paint(flutter::Layer::PaintContext&) const + 68
    frame #16: 0xa8804dd4 libflutter_engine.so`flutter::ContainerLayer::PaintChildren(flutter::Layer::PaintContext&) const + 86
    frame #17: 0xa8807c74 libflutter_engine.so`flutter::TransformLayer::Paint(flutter::Layer::PaintContext&) const + 68
    frame #18: 0xa8804d76 libflutter_engine.so`flutter::ContainerLayer::Paint(flutter::Layer::PaintContext&) const + 86
    frame #19: 0xa8805b8a libflutter_engine.so`flutter::LayerTree::Paint(flutter::CompositorContext::ScopedFrame&, bool) const + 254
    frame #20: 0xa8803106 libflutter_engine.so`flutter::CompositorContext::ScopedFrame::Raster(flutter::LayerTree&, bool) + 218
    frame #21: 0xa8811a6c libflutter_engine.so`flutter::Rasterizer::DrawToSurface(flutter::LayerTree&) + 348
    frame #22: 0xa84f9d9a libflutter_engine.so`fml::MessageLoopImpl::FlushTasks(fml::FlushType) + 170
    frame #23: 0xa84fdb5c libflutter_engine.so`fml::MessageLoopLinux::Run() + 96
    frame #24: 0xa84f9cb6 libflutter_engine.so`fml::MessageLoopImpl::DoRun() + 26
    frame #25: 0xa84fd200 libflutter_engine.so`void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, fml::Thread::Thread(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::$_0> >(void*) + 216
    frame #26: 0xb666d438 libpthread.so.0
    frame #27: 0xb6c40e28 libc.so.6

@bbrto21 bbrto21 self-assigned this May 6, 2021
@bbrto21
Copy link
Contributor Author

bbrto21 commented May 10, 2021

closed by flutter-tizen/engine#81

@bbrto21 bbrto21 closed this as completed May 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants