[Interest] Crash in QSGOpaqueTextureMaterial::compare

Jani Tykka jtykka at broadsoft.com
Thu Dec 15 17:16:14 CET 2016


Hi,

It's now been ruled out that the crash reason is our
QSGSimpleTextureNode -based object. It must be some object created in
plain QML. One more hint is that the application most commonly crashes
when it's been put in sleep mode. Then user resumes from sleep mode
just to realise that the application has crashed.

Could this give more hints where to look at? Also we run the the same
code on OS X where this hasn't been an issue, only on Windows. The app
has 50+ QML files and tracking this will be really painful :)

Thanks

On Mon, Dec 12, 2016 at 11:59 AM, Jani Tykka <jtykka at broadsoft.com> wrote:
> Thanks Gunnar, will definitely look into this. Also noticed that it's
> possible to give the texture ownership to node to simplify the case.
>
> Jani
>
> On Mon, Dec 12, 2016 at 11:39 AM, Gunnar Sletta <gunnar at sletta.org> wrote:
>> Hi Jani,
>>
>> If you have a dangling texture pointer in one of the nodes, then this will most likely not crash during updatePaintNode() but rather during rendering when the texture is taken into use. So I suggest you look at your nodes and textures. The important bit is that no node is referencing a texture after that texture has been deleted.
>>
>> A tool such as valgrind or similar memory debugger will greatly help you to pinpoint the source of the deleted texture.
>>
>> cheers,
>> Gunnar
>>
>>> On 12 Dec 2016, at 08:39, Jani Tykka <jtykka at broadsoft.com> wrote:
>>>
>>> Actually QSGSimpleTextureNode is used. Just that crashes does rarely
>>> or never occur when that part of code is being executed. They might
>>> occur much later when that code has been already executed and deleted
>>> or then the code is not related at all (really unsure about the steps
>>> that produces the crash).
>>>
>>> Here is the code which is used in QQuickItem. Do you see anything
>>> suspicious here? Thanks.
>>>
>>> QSGNode * VideoItem::updatePaintNode( QSGNode * node,
>>> UpdatePaintNodeData * /*data*/ )
>>> {
>>> QSGSimpleTextureNode * n = static_cast< QSGSimpleTextureNode* >( node );
>>> if ( !n )
>>>   n = new QSGSimpleTextureNode;
>>> n->setRect( 0, 0, width(), height() );
>>>
>>> delete m_Texture;
>>> m_Texture = window()->createTextureFromImage( m_Renderer->getImage() );
>>> n->setTexture( m_Texture );
>>> n->markDirty( QSGNode::DirtyGeometry );
>>>
>>> return n;
>>> }
>>>
>>> On Fri, Dec 9, 2016 at 8:17 PM, Gunnar Sletta <gunnar at sletta.org <mailto:gunnar at sletta.org>> wrote:
>>>> Is the application using QSGSimpleTextureNode and QSGTexture or is this a plain QML application? If so, are you deleting textures at the right time and updating nodes accordingly?
>>>>
>>>> We did have issues with textures being deleted out of turn on the render thread, but that was fixed back in 5.1-days or so and I haven't seen backtraces like this since then.
>>>>
>>>> cheers,
>>>> Gunnar
>>>>
>>>>> On 09 Dec 2016, at 12:16, Jani Tykka <jtykka at broadsoft.com> wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> I'm experiencing a crash that is quite common, but no idea about steps
>>>>> how to reproduce it (I have never been able to reproduce it myself,
>>>>> but various users sees it time after time). I think it's not directly
>>>>> a Qt bug, instead it might be something I do incorrectly. The crash
>>>>> seems to be most common after the application had been idling for a
>>>>> while or the computer is resumed from the sleep mode. Basically when
>>>>> the scene needs to be rendered again. I'd appreciate any hints that
>>>>> would help me to track this issue. See clipped crash stack traces
>>>>> below (Qt 5.6.2 on Windows), thanks.
>>>>>
>>>>> Case 1
>>>>> QSGOpaqueTextureMaterial::compare
>>>>> qt5\qtdeclarative\src\quick\scenegraph\util\qsgtexturematerial.cpp:295
>>>>> QSGBatchRenderer::Renderer::prepareOpaqueBatches
>>>>> qt5\qtdeclarative\src\quick\scenegraph\coreapi\qsgbatchrenderer.cpp:1520
>>>>> Qt5Core.dll Qt5Core.dll at 0x1afb0
>>>>> Qt5Quick.dll QSGBatchRenderer::Renderer::render
>>>>> qt5\qtdeclarative\src\quick\scenegraph\coreapi\qsgbatchrenderer.cpp:2615
>>>>> Qt5Quick.dll QSGRenderer::renderScene
>>>>> qt5\qtdeclarative\src\quick\scenegraph\coreapi\qsgrenderer.cpp:217
>>>>> Qt5Quick.dll QSGRenderer::renderScene
>>>>> qt5\qtdeclarative\src\quick\scenegraph\coreapi\qsgrenderer.cpp:177
>>>>> Qt5Quick.dll QSGRenderContext::renderNextFrame
>>>>> qt5\qtdeclarative\src\quick\scenegraph\qsgcontext.cpp:555
>>>>> Qt5Quick.dll QQuickWindowPrivate::renderSceneGraph
>>>>> qt5\qtdeclarative\src\quick\items\qquickwindow.cpp:424
>>>>> Qt5Quick.dll QSGWindowsRenderLoop::renderWindow
>>>>> qt5\qtdeclarative\src\quick\scenegraph\qsgwindowsrenderloop.cpp:452
>>>>> Qt5Quick.dll QSGWindowsRenderLoop::render
>>>>> qt5\qtdeclarative\src\quick\scenegraph\qsgwindowsrenderloop.cpp:371
>>>>> Qt5Quick.dll QSGWindowsRenderLoop::event
>>>>> qt5\qtdeclarative\src\quick\scenegraph\qsgwindowsrenderloop.cpp:350
>>>>> Qt5Widgets.dll QApplicationPrivate::notify_helper
>>>>> qt5\qtbase\src\widgets\kernel\qapplication.cpp:3804
>>>>> ....
>>>>>
>>>>> Case 2
>>>>> Qt5Quick.dll QSGOpaqueTextureMaterial::compare
>>>>> qt5\qtdeclarative\src\quick\scenegraph\util\qsgtexturematerial.cpp:295
>>>>> Qt5Quick.dll QSGBatchRenderer::Batch::isMaterialCompatible
>>>>> qt5\qtdeclarative\src\quick\scenegraph\coreapi\qsgbatchrenderer.cpp:620
>>>>> Qt5Quick.dll QSGBatchRenderer::Renderer::nodeChanged
>>>>> qt5\qtdeclarative\src\quick\scenegraph\coreapi\qsgbatchrenderer.cpp:1212
>>>>> Qt5Quick.dll QSGNode::markDirty
>>>>> qt5\qtdeclarative\src\quick\scenegraph\coreapi\qsgnode.cpp:672
>>>>> Qt5Quick.dll QSGDefaultImageNode::setTexture
>>>>> qt5\qtdeclarative\src\quick\scenegraph\qsgdefaultimagenode.cpp:244
>>>>> Qt5Quick.dll QQuickImage::updatePaintNode
>>>>> qt5\qtdeclarative\src\quick\items\qquickimage.cpp:724
>>>>> Qt5Quick.dll QQuickWindowPrivate::updateDirtyNode
>>>>> qt5\qtdeclarative\src\quick\items\qquickwindow.cpp:3061
>>>>> Qt5Quick.dll QQuickWindowPrivate::updateDirtyNodes
>>>>> qt5\qtdeclarative\src\quick\items\qquickwindow.cpp:2806
>>>>> Qt5Quick.dll QQuickWindowPrivate::syncSceneGraph
>>>>> qt5\qtdeclarative\src\quick\items\qquickwindow.cpp:379
>>>>> Qt5Quick.dll QSGWindowsRenderLoop::renderWindow
>>>>> qt5\qtdeclarative\src\quick\scenegraph\qsgwindowsrenderloop.cpp:448
>>>>> Qt5Quick.dll QSGWindowsRenderLoop::render
>>>>> qt5\qtdeclarative\src\quick\scenegraph\qsgwindowsrenderloop.cpp:371
>>>>> Qt5Quick.dll QSGWindowsRenderLoop::exposureChanged
>>>>> qt5\qtdeclarative\src\quick\scenegraph\qsgwindowsrenderloop.cpp:286
>>>>> ...
>>>>>
>>>>> --
>>>>>
>>>>>
>>>>> This email is intended solely for the person or entity to which it is
>>>>> addressed and may contain confidential and/or privileged information. If
>>>>> you are not the intended recipient and have received this email in error,
>>>>> please notify BroadSoft, Inc. immediately by replying to this message, and
>>>>> destroy all copies of this message, along with any attachment, prior to
>>>>> reading, distributing or copying it.
>>>>> _______________________________________________
>>>>> Interest mailing list
>>>>> Interest at qt-project.org
>>>>> http://lists.qt-project.org/mailman/listinfo/interest
>>>>
>>>
>>>
>>>
>>> --
>>> Jani Tykkä
>>> Development Manager | BroadSoft, Inc. | +358 44 596 0587 | jtykka at broadsoft.com <mailto:jtykka at broadsoft.com>
>>>
>>> --
>>>
>>>
>>> This email is intended solely for the person or entity to which it is
>>> addressed and may contain confidential and/or privileged information. If
>>> you are not the intended recipient and have received this email in error,
>>> please notify BroadSoft, Inc. immediately by replying to this message, and
>>> destroy all copies of this message, along with any attachment, prior to
>>> reading, distributing or copying it.
>>
>
>
>
> --
> Jani Tykkä
> Development Manager | BroadSoft, Inc. | +358 44 596 0587 | jtykka at broadsoft.com



-- 
Jani Tykkä
Development Manager | BroadSoft, Inc. | +358 44 596 0587 | jtykka at broadsoft.com

-- 


This email is intended solely for the person or entity to which it is 
addressed and may contain confidential and/or privileged information. If 
you are not the intended recipient and have received this email in error, 
please notify BroadSoft, Inc. immediately by replying to this message, and 
destroy all copies of this message, along with any attachment, prior to 
reading, distributing or copying it.



More information about the Interest mailing list