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

[all] Fix the cause of failling test scenes (for a greener dashboard) #548

Closed
wants to merge 36 commits into from

Conversation

damienmarchal
Copy link
Contributor

@damienmarchal damienmarchal commented Dec 26, 2017


This PR:

  • builds with SUCCESS for all platforms on the CI.
  • do generate LESS warnings.
  • do generate LESS unit test failures.
  • do generate LESS scene test failures.
  • does not break API compatibility.
  • is more than 1 week old (or has fast-merge label).

Reviewers will merge only if all these checks are true.

Those file have been merge by mistake some time ago but they have no
meaning in the current Sofa version. So I remove them.
Otherwise some test scenes using Fluid2D & Fluid3D are failing.
The <include> directive was using local path instead of relative to the 'example'
directory as other examples.

NB: I wonder why the shared "Object" directory is in examples. If it is shared.
it should be in the 'share' directory ?
…d on a plugin.HighOrder

NB: It would be better to generate the .scene-tests from the cmake
depending on the other plugin found.
… as this make the scene fail.

This scene is failing since its addition in
PR: sofa-framework#270
@sofa-framework sofa-framework deleted a comment from sofabot Dec 27, 2017
…is printed.

This is implemened only at init & reinit.
… since PR sofa-framework#521

The more I see PR the more I wonder why the algorithm allow 'den'
to be zero. Shouldn't this issue a warning saying that the scene is
probably broken ?
The plugin is broken since PR sofa-framework#549 as it removes the initialization
of the mutex. Possible explaination is that v_ is implementation
dependent but the existing initialization was done incorrectly
using a (int).

Now use BOOST_DETAIL_SPINLOCK_INIT which insure that the initialization
is coherent with the implementation used.

(I also cannot prevent myself to remove the two ugly commented lines)
…e merge of #PR 243

In #PR 243 the following change was introduced in MechanicalObject.inl::init():
```cpp
  if (!l_topology && d_useTopology.getValue())
    {
        l_topology.set( this->getContext()->getActiveMeshTopology() );
    }
```

In place of
```cpp
    //Look at a topology associated to this instance of MechanicalObject by a tag
    this->getContext()->get(m_topology, this->getTags());
    // If no topology found, no association, then look to the nearest one
    if(m_topology == NULL)
        m_topology = this->getContext()->getMeshTopology();
```

I assume that the in the scene was the EdgeSetTopologyContainer is not returned by
the getActiveMeshTopology method.

NB: All those implicit linking looks really problematic to me as they are error prone.
@hugtalbot hugtalbot added pr: status ready Approved a pull-request, ready to be squashed pr: status to review To notify reviewers to review this pull-request and removed pr: status ready Approved a pull-request, ready to be squashed labels Jan 3, 2018
@@ -165,7 +161,7 @@ namespace sofa



mutable boost::detail::spinlock mTaskMutex;
mutable boost::detail::spinlock mTaskMutex {BOOST_DETAIL_SPINLOCK_INIT};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GG for the fix!
I think you should choose between keeping a TAB indentation or fixing it with spaces for the whole file ;-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well...I'm not in favor of changing the whole file indent for a one line modification. In that case isn't it better to apply the astyle just before merging the PR ?

Shouldn't I wait for the automatic application of the astyle formatting sheet by the CI ?

@guparan guparan added the pr: fix Fix a bug label Jan 5, 2018
if( verbose )
{
sout<<"CGLinearSolver, den = "<<den<<", smallDenominatorThreshold = "<<f_smallDenominatorThreshold.getValue()<<sendl;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi @damienmarchal
I thought it over, my fix was wrong but yours is still not optimal.
I would like to fix it in another PR, would you agree ? I will revert this in your PR as well if you agree.

Copy link
Contributor Author

@damienmarchal damienmarchal Jan 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course, if you think it is relevant you can fix it in another PR, just do it, but please keep in mind that if everyone open PR to fix scenes it will be a big mess very quickly and we will have to "ping pong" between all the PRs.

EDIT: pushing regularly & working in this single PR have the advantage that we can see each other progress and activity.

EDIT: I didn't responded clearly but yes you can fix everything you want I didn't planned to work on this one and the commited version was just there to show you the problems.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed for the working one single for this purpose, just the CG case is wider than just scenes. It's a real bug.
New PR for the CG: #556

if( fabs(den) == 0.0 )
{
endcond = "div by zero. You scene is probably buggy.";
if( verbose )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

by the way @damienmarchal shouldn't we choose between verbose and printLog .. isn't it redundant ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well...

yes but no but yes but no :)

the only totally redundent thing is:

if(printLog.getValue())
     msg_info() << "Blahblah"

printLog is the way to activate or deactive all the messages going through msg_info() but as it is implemented there is no fine grain control. This is why adding an additional option like "verbose" (boolean or int) allows to implement multiple level of 'info' verbosity for your component.

In sofa there is a lot of component that hard code multi-levels verbosity but in my component I prefer to stick to printLog as it make things easier and more consistant.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, you would not remove the 'verbose' use (despite the ugly multi-levels verbosity) ?

Copy link
Contributor Author

@damienmarchal damienmarchal Jan 8, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR was initially on fixing the failing test...thus I'm not sure it is good if we add too much cleaning or refactoring or cosmetic changes as it will make the review harder. I just cannot prevent myself to force the printLog when verbose is set to simplify a bit the things (in init & reinit).

@hugtalbot
Copy link
Contributor

I did not have a lot of time to progess here but still a reminder for later:

  • in Flexible : BezierTetrahedron.scn should not be built anymore since it depends on SofaHighOrderTopologies
  • CubeTopology : crashes since the CubeTopology does not implement the position (point) topology

@sofa-framework sofa-framework deleted a comment from guparan Jan 8, 2018
@sofa-framework sofa-framework deleted a comment from guparan Jan 8, 2018
@sofa-framework sofa-framework deleted a comment from guparan Jan 8, 2018
@sofa-framework sofa-framework deleted a comment from guparan Jan 8, 2018
@damienmarchal
Copy link
Contributor Author

[ci-build][with-scene-tests]

@damienmarchal
Copy link
Contributor Author

[ci-build][with-scene-tests]

@guparan
Copy link
Contributor

guparan commented Jan 15, 2018

caduceus.scn crashes on both macos_default and macos_options on master when running in batch mode.
See https://ci.inria.fr/sofa-ci/job/mac_clang-3.4_default/1904/warnings2Result/category.94921639/package.-1174366838/

@damienmarchal
Copy link
Contributor Author

@guparan Thank for the report.
As pointed by @untereiner ...the problem is related to the batch mode & opengl function on macos.
My guess is that there is not opengl context and that there is code in sofa that use opengl functions.

@untereiner
Copy link

untereiner commented Jan 15, 2018

Below is the stack. I do not understand why the visual objects are created in the batch mode.
PS: do a search of "batch" in sofa...

frame #0: 0x00007fff35526c44 libGL.dylibglGetIntegerv + 18 frame #1: 0x000000011ef3eac6 libSofaHelper_d.17.12.dev.dylibsofa::helper::gl::FrameBufferObject::getCurrentFramebufferID() at FrameBufferObject.cpp:79
frame #2: 0x00000001176c0882 libSofaOpenglVisual_d.17.12.dev.dylibsofa::component::visualmodel::Light::Light(this=0x000000012080c800, vtt=0x0000000117a0a620) at Light.cpp:86 frame #3: 0x00000001176c6b7b libSofaOpenglVisual_d.17.12.dev.dylibsofa::component::visualmodel::PositionalLight::PositionalLight(this=0x000000012080c800, vtt=0x0000000117a0a618) at Light.cpp:633
frame #4: 0x00000001176c84cf libSofaOpenglVisual_d.17.12.dev.dylibsofa::component::visualmodel::SpotLight::SpotLight(this=0x000000012080c800) at Light.cpp:698 frame #5: 0x00000001176d7ae9 libSofaOpenglVisual_d.17.12.dev.dylibsofa::core::objectmodel::Newsofa::component::visualmodel::SpotLight::New<>(this=0x00007ffeefbf59c8) at SPtr.h:57
frame #6: 0x00000001176d79e5 libSofaOpenglVisual_d.17.12.dev.dylibsofa::core::objectmodel::New<sofa::component::visualmodel::SpotLight>::New<>(this=0x00007ffeefbf59c8) at SPtr.h:57 frame #7: 0x00000001176d789f libSofaOpenglVisual_d.17.12.dev.dylibsofa::component::visualmodel::SpotLight::SPtr sofa::core::objectmodel::BaseObject::createsofa::component::visualmodel::SpotLight((null)=0x0000000000000000, context=0x0000000122011a00, arg=0x0000000121261df0) at BaseObject.h:100
frame #8: 0x00000001176d7763 libSofaOpenglVisual_d.17.12.dev.dylibsofa::core::ObjectCreator<sofa::component::visualmodel::SpotLight>::createInstance(this=0x000000012071ba90, context=0x0000000122011a00, arg=0x0000000121261df0) at ObjectFactory.h:209 frame #9: 0x000000011bb62cb8 libSofaCore_d.17.12.dev.dylibsofa::core::ObjectFactory::createObject(this=0x000000011c7be9f0, context=0x0000000122011a00, arg=0x0000000121261df0) at ObjectFactory.cpp:186
frame #10: 0x000000011aca2c54 libSofaSimulationCommon_d.17.12.dev.dylibsofa::core::ObjectFactory::CreateObject(context=0x0000000122011a00, arg=0x0000000121261df0) at ObjectFactory.h:157 frame #11: 0x000000011aca0a65 libSofaSimulationCommon_d.17.12.dev.dylibsofa::simulation::xml::ObjectElement::initNode(this=0x0000000121261df0) at ObjectElement.cpp:77
frame #12: 0x000000011aca0177 libSofaSimulationCommon_d.17.12.dev.dylibsofa::simulation::xml::ObjectElement::init(this=0x0000000121261df0) at ObjectElement.cpp:60 frame #13: 0x000000011ac8b407 libSofaSimulationCommon_d.17.12.dev.dylibsofa::simulation::xml::BaseElement::init(this=0x000000012125f6e0) at BaseElement.cpp:149
frame #14: 0x000000011ac9de25 libSofaSimulationCommon_d.17.12.dev.dylibsofa::simulation::xml::NodeElement::init(this=0x000000012125f6e0) at NodeElement.cpp:78 frame #15: 0x000000011ac75d15 libSofaSimulationCommon_d.17.12.dev.dylibsofa::simulation::SceneLoaderXML::processXML(xml=0x000000012125f6e0, filename="../../sofa/examples/Demos/caduceus.scn") at SceneLoaderXML.cpp:117
frame #16: 0x000000011ac75479 libSofaSimulationCommon_d.17.12.dev.dylibsofa::simulation::SceneLoaderXML::load(this=0x00000001212063e0, filename="../../sofa/examples/Demos/caduceus.scn") at SceneLoaderXML.cpp:79 frame #17: 0x000000011aeafa79 libSofaSimulationCore_d.dylibsofa::simulation::Simulation::load(this=0x000000012200d800, filename="../../sofa/examples/Demos/caduceus.scn") at Simulation.cpp:470
frame #18: 0x00000001000213fc runSofa_dmain(argc=8, argv=0x00007ffeefbff928) at Main.cpp:381 frame #19: 0x00007fff536e1115 libdyld.dylibstart + 1
frame #20: 0x00007fff536e1115 libdyld.dylib`start + 1

@damienmarchal
Copy link
Contributor Author

damienmarchal commented Jan 15, 2018

@untereiner I think that this is because batch mode does not "remove" element from the scene
(it would be a nighmare). To me the underlying problem is that the batch mode should have a valid opengl context created (off-screen rendering) as we use it to test file with opengl based components.

Thanks for the stack trace... I will try to make something about it (even on macos).

@untereiner
Copy link

untereiner commented Jan 15, 2018

Launching an opengl context "by hand" is complicated if I remember correctly. I suggest that the batch mode uses GLEW to handle the opengl context. In the other options it is Qt that handles the context creation.
But I do not understand why it works on linux.

The old version of the plugin is loading as plugins the content
of pluginName or, if empty, the "name" of the component.

To improve functionnal consistency this, when the name is use as pluginName,
adds it to the pluginName lists. So that pluginName contains all the
"informations".
@damienmarchal
Copy link
Contributor Author

damienmarchal commented Jan 15, 2018

It is definitively hard to have an opengl context by hand...and having one for offscreen (without a windows) seems even more tricky (anyone's help is welcome). I know @ErwanDouaille search for that in his HeadLessRecorder

I assume it work on linux/windows...because they just don't crash/segfault when gl function are called without a buffer :)
As said in:
https://www.opengl.org/discussion_boards/showthread.php/158904-OpenGL-function-calls-without-available-contexts

Too bad... I tried a lot of approach based on QOffscreenSurface and friends, they work on my system but as soon as I move that to a CI machine (which does not have X or GLX or whatever)...the application crash. I reseted the branch but you can still see the garbage in the Dashboard. I will try a different approach tomorrow.

@damienmarchal
Copy link
Contributor Author

[ci-build][with-scene-tests]

@damienmarchal
Copy link
Contributor Author

Ho damn...two full build + scene that are green builds... and not one to cheers (deep sadness)
https://www.sofa-framework.org/dash/?branch=pr/fixTestScene

@damienmarchal
Copy link
Contributor Author

[ci-build][with-scene-tests]

@guparan
Copy link
Contributor

guparan commented Jan 16, 2018

Wow, such green, very stable, many thanks! ;-)

@damienmarchal
Copy link
Contributor Author

More seriously...I don't know how to fix the MacOS version (and I think the batch mode is fundamentally broken :)).

Tomorrow I will clean the PR, possibly cutting it in pieces because I doubt guys here will accept to merge it "as it is" :)

@guparan
Copy link
Contributor

guparan commented Jan 17, 2018

@epernod Could you quick review the commit 47ef2e6 please? How could CubeTopology.scn have been passing scene-tests without this fix?
(request from @damienmarchal)

@guparan
Copy link
Contributor

guparan commented Jan 24, 2018

This PR seems quite empty now. Shall we close it @damienmarchal ?

@damienmarchal
Copy link
Contributor Author

Yes,
Thank for the help in managing all that.

@guparan
Copy link
Contributor

guparan commented Jan 24, 2018

Thank you for your hard work! :-)

@guparan guparan closed this Jan 24, 2018
@hugtalbot hugtalbot removed the pr: status to review To notify reviewers to review this pull-request label Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: fix Fix a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants