OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

osgText 3.6.3 crash


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
Trajce Nikolov NICK
Guest





PostPosted: Wed Sep 12, 2018 12:25 pm    Post subject:
osgText 3.6.3 crash
Reply with quote

Hi Robert,


we are experiencing some crashes in our sim software. And I know you will not like this post since I can not produce minimal case exercising this issue - I tried to mimic the sim code into one simple app but in this minimal app all works just great. So I will try to explain and count on you with hints


The environment is multithreaded:
- high res thread updating labels guarded by mutex
- the osg threads with update callbacks on osgText::Text that is setting the labels with setText(...) guarded  by mutex


The env is XUbuntu 18, NVIDIA GTX 1080


And the crash happens at

Text::drawImplementationSinglePass ln: 1151 glyphquad._primitives->draw(state, usingVertexBufferObjects);


which furthers



DrawElementsUShort::draw ln: 266


if (_numInstances>=1) state.glDrawElementsInstanced(mode, size(), GL_UNSIGNED_SHORT, (const GLvoid *)(ebo->getOffset(getBufferIndex())), _numInstances);
            else glDrawElements(mode, size(), GL_UNSIGNED_SHORT, (const GLvoid *)(ebo->getOffset(getBufferIndex())));



_numInstances is 0 when the crash happens so the crash happens here:


glDrawElements(mode, size(), GL_UNSIGNED_SHORT, (const GLvoid *)(ebo->getOffset(getBufferIndex())));



Any clue or at least a thought when this can happen? Mean while I will continue testing and will really try again to make a small app reproducing this behavior


Thanks a bunch as always!


Cheers,
Nick



--
trajce nikolov nick

------------------
Post generated by Mail2Forum
Back to top
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12149

PostPosted: Wed Sep 12, 2018 2:10 pm    Post subject:
osgText 3.6.3 crash
Reply with quote

Hi Nick,

There are plenty of ways mutlti-thread setting of Text labels could
cause problems if the threads reading from the Text are running in
parallel to the ones setting it. A mutex "might" help but it could
easily be done in the wrong way. If you are modifying text
dynamically then you should set the DataVariance to DYNAMIC. However,
adding mutex and using DataVariance of DYNAMIC might protect things if
you do it all right but performance issues can easily become dominant
as it can easily stall the various threads.

It may be that trying to dynamically update Text is simply the wrong
solution for your application. It might be that writing your own
custom shader to implement text is the better thing to do.

Robert.




On Wed, 12 Sep 2018 at 13:24, Trajce Nikolov NICK
<> wrote:
Quote:

Hi Robert,

we are experiencing some crashes in our sim software. And I know you will not like this post since I can not produce minimal case exercising this issue - I tried to mimic the sim code into one simple app but in this minimal app all works just great. So I will try to explain and count on you with hints

The environment is multithreaded:
- high res thread updating labels guarded by mutex
- the osg threads with update callbacks on osgText::Text that is setting the labels with setText(...) guarded by mutex

The env is XUbuntu 18, NVIDIA GTX 1080

And the crash happens at
Text::drawImplementationSinglePass ln: 1151 glyphquad._primitives->draw(state, usingVertexBufferObjects);

which furthers

DrawElementsUShort::draw ln: 266

if (_numInstances>=1) state.glDrawElementsInstanced(mode, size(), GL_UNSIGNED_SHORT, (const GLvoid *)(ebo->getOffset(getBufferIndex())), _numInstances);
else glDrawElements(mode, size(), GL_UNSIGNED_SHORT, (const GLvoid *)(ebo->getOffset(getBufferIndex())));

_numInstances is 0 when the crash happens so the crash happens here:

glDrawElements(mode, size(), GL_UNSIGNED_SHORT, (const GLvoid *)(ebo->getOffset(getBufferIndex())));

Any clue or at least a thought when this can happen? Mean while I will continue testing and will really try again to make a small app reproducing this behavior

Thanks a bunch as always!

Cheers,
Nick

--
trajce nikolov nick



------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Trajce Nikolov NICK
Guest





PostPosted: Wed Sep 12, 2018 4:58 pm    Post subject:
osgText 3.6.3 crash
Reply with quote

Hi Robert,


That was the right hint and I must admit that I always forget it Smile. Setting the datavaraiance to osg::Object::DYNAMIC fixed the crash! As for the other hints re performance, this is for sort of DEBUG mode for the sim so we are ok, but thanks for these as well!



On Wed, Sep 12, 2018 at 4:09 PM Robert Osfield < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:

Quote:
Hi Nick,

There are plenty of ways mutlti-thread setting of Text labels could
cause problems if the threads reading from the Text are running in
parallel to the ones setting it.  A mutex "might" help but it could
easily be done in the wrong way.  If you are modifying text
dynamically then you should set the DataVariance to DYNAMIC.  However,
adding mutex and using DataVariance of DYNAMIC might protect things if
you do it all right but performance issues can easily become dominant
as it can easily stall the various threads.

It may be that trying to dynamically update Text is simply the wrong
solution for your application.  It might be that writing your own
custom shader to implement text is the better thing to do.

Robert.




On Wed, 12 Sep 2018 at 13:24, Trajce Nikolov NICK
< (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:

Hi Robert,

we are experiencing some crashes in our sim software. And I know you will not like this post since I can not produce minimal case exercising this issue - I tried to mimic the sim code into one simple app but in this minimal app all works just great. So I will try to explain and count on you with hints

The environment is multithreaded:
- high res thread updating labels guarded by mutex
- the osg threads with update callbacks on osgText::Text that is setting the labels with setText(...) guarded  by mutex

The env is XUbuntu 18, NVIDIA GTX 1080

And the crash happens at
Text::drawImplementationSinglePass ln: 1151 glyphquad._primitives->draw(state, usingVertexBufferObjects);

which furthers

DrawElementsUShort::draw ln: 266

if (_numInstances>=1) state.glDrawElementsInstanced(mode, size(), GL_UNSIGNED_SHORT, (const GLvoid *)(ebo->getOffset(getBufferIndex())), _numInstances);
             else glDrawElements(mode, size(), GL_UNSIGNED_SHORT, (const GLvoid *)(ebo->getOffset(getBufferIndex())));

_numInstances is 0 when the crash happens so the crash happens here:

glDrawElements(mode, size(), GL_UNSIGNED_SHORT, (const GLvoid *)(ebo->getOffset(getBufferIndex())));

Any clue or at least a thought when this can happen? Mean while I will continue testing and will really try again to make a small app reproducing this behavior

Thanks a bunch as always!

Cheers,
Nick

--
trajce nikolov nick
_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


--
trajce nikolov nick

------------------
Post generated by Mail2Forum
Back to top
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts Crash when using LineSegmentIntersector sbrkopac General 5 Thu Aug 02, 2018 10:03 pm View latest post
No new posts osgText: two thread-safety issues gwaldron General 1 Tue Jul 31, 2018 2:54 pm View latest post
No new posts [Crash issue] no error info even set ... pwang General 1 Sun Jul 29, 2018 1:20 pm View latest post
No new posts [Crash issue] How to add&remove d... pwang General 2 Thu Jul 26, 2018 10:10 am View latest post
No new posts RayIntersector with KdTree causes a c... Ale General 15 Thu Jul 26, 2018 9:33 am View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP