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

Enable CGAL on Travis + AppVeyor. #996

Merged
merged 19 commits into from Dec 24, 2018

Conversation

Projects
None yet
5 participants
@jdumas
Copy link
Collaborator

commented Nov 4, 2018

It just occurred to me that since CGAL is now disabled by default, we need to explicitly enable it on Travis and AppVeyor...

Check all that apply (change to [x])

@jdumas

This comment has been minimized.

Copy link
Collaborator Author

commented Nov 4, 2018

And obviously it fails on both Travis and AppVeyor, argh.

jdumas added some commits Nov 4, 2018

@jdumas

This comment has been minimized.

Copy link
Collaborator Author

commented Nov 5, 2018

Any template expert in the room? I'm dumbfounded by the last 3 missing template instantiations, as the offending signatures are literally present in their respective .cpp files...

jdumas added some commits Nov 5, 2018

@jdumas

This comment has been minimized.

Copy link
Collaborator Author

commented Nov 5, 2018

Ok now it compiles on Windows and Linux! (b7db5a8) @qnzhou do you mind taking a look at the unit test that is failing on macOS? And also maybe check that I didn't mess up anything else in this PR.

I've made some slight modifications to make it compile on Windows with CGAL + unit tests:

  • Changed a couple of double c[2] into double *c in orient2D and incircle predicates, otherwise the explicit template instantiation doesn't work on Windows. [] is very much syntactic sugar for * anyway (see this SO thread), it doesn't provide any additional safety.
  • Also fixed a subtle compilation issue introduced in grad_intrinsic.cpp when compiling in header-only mode due to using fixed column size, see this comment for more details (ping @alecjacobson).

jdumas added some commits Nov 6, 2018

@copyme

This comment has been minimized.

Copy link
Contributor

commented Nov 8, 2018

@jdumas Is that normal that some unit tests are missing opening brackets? I could not compile them without adding them.

@jdumas

This comment has been minimized.

Copy link
Collaborator Author

commented Nov 8, 2018

Which one are you talking about? Are you sure you are checking my branch for this PR? I've fixed those missing brackets and it compiles on AppVeyor.

@copyme

This comment has been minimized.

Copy link
Contributor

commented Nov 8, 2018

@jdumas You are right. I was on a wrong branch. Sorry!

@jdumas jdumas self-assigned this Nov 12, 2018

@ikoruk

This comment has been minimized.

Copy link
Contributor

commented Nov 14, 2018

Related to this is compilation also fails when using igl::grad with a MatrixX2/MatrixX3i because of the grad_tet compilation issue.

@jdumas

This comment has been minimized.

Copy link
Collaborator Author

commented Nov 14, 2018

Is it a missing template instantiation? In which case it should be easily fixed.

@ikoruk

This comment has been minimized.

Copy link
Contributor

commented Nov 14, 2018

There are many other places igl::grad is called templated, such as igl::hessian. One option would be to do an explicit copy to a dynamic type but this kind of copy is ugly as well. I think the easiest now would be to expose grad_tri and grad_tet but if this propagates, then maybe the only solution is SFINAE. What do you think?

[Side note: I see igl::hessian already has an explicit copy into grad for some reason, that still doesn't solve the problem but perhaps solved it in the past.]

@jdumas

This comment has been minimized.

Copy link
Collaborator Author

commented Nov 14, 2018

Right. I believe we should do some SFINAE magic then. But I'd rather do it as a separate issue/PR. First goal is to get the test to pass in static mode (right now they randomly fail for some reason).

@copyme

This comment has been minimized.

Copy link
Contributor

commented Nov 14, 2018

@jdumas I do not know the solution for the issue but I have noticed something that IMHO does not look like a good practice with unit testing.

One of the rules of TDD and unit testing says that your tests should not depend on external resources, while you have in CGTree test_common::load_mesh("extrusion.obj", V, F);

Would not that be better to keep such data as small as possible and in a compilation unit file? Then this can be compiled-in and served via, let's say, a UnitTestData class, and accessed without any need for data storage, etc. Some people keep fonts in such way for GUI without font files.

@copyme

This comment has been minimized.

Copy link
Contributor

commented Nov 14, 2018

Anyway, what I wrote above about external deps. is not super important.

I will try to find a machine with os x to check the test failing issue.

@jdumas

This comment has been minimized.

Copy link
Collaborator Author

commented Nov 14, 2018

What's wrong with loading a mesh? True this implies that the mesh loading function has no bugs but... well you need to start somewhere. There's no need to over-engineer any extra class, and it makes it easy to add new test data if need be. Otherwise, you'd still have to trust that you did the conversion correctly from the .obj to the embedded format anyway...

@copyme

This comment has been minimized.

Copy link
Contributor

commented Nov 15, 2018

The problem is that your test may fail due to storage failure. If you have a class that is responsible for serving that you will first have tests to test it. But of course this is not the best solution.

As long as your data are simple you can verfiry them, this is why simplifying these testing data to minimum would be a good thing to do anyway.

@jdumas

This comment has been minimized.

Copy link
Collaborator Author

commented Nov 15, 2018

Unless we start putting gigantic meshes in the testing data I'm not convinced this is worth the effort (and the problem still stands if you cannot preload the embedded data in memory).

@alecjacobson

This comment has been minimized.

Copy link
Contributor

commented Dec 24, 2018

There's a lot here. What's the upshot? What's blocking this from being merged?

@alecjacobson alecjacobson referenced this pull request Dec 24, 2018

Merged

Bug fix: mesh_to_polyhedron compiles #1057

2 of 5 tasks complete
@jdumas

This comment has been minimized.

Copy link
Collaborator Author

commented Dec 24, 2018

Bottom line is that some unit tests are randomly failing on Travis due to what I suspect may be uninitialized memory issue, or something similar. See for example 985ad5d that passes the tests on Travis, but a3f2406 doesn't, and changes in a3f2406 are unlikely to be the cause of the failure.

If you compile this branch and run make tests a couple of times sometimes it will go through, sometimes it won't. Unfortunately I kind of left it aside until I get the chance to investigate this more in depth =/

@alecjacobson

This comment has been minimized.

Copy link
Contributor

commented Dec 24, 2018

I fixed the conflicting files in 85b9382 but I don't know how to append it to this PR. The commands I tried pushing it to jdumas's fork said permission denied. Is there a special command?

@jdumas

This comment has been minimized.

Copy link
Collaborator Author

commented Dec 24, 2018

Did you try pushing directly on my fix-cgal branch? (I have checked the option "allow edits from maintainers" so you should have write permission on this specific branch).

git push https://github.com/jdumas/libigl.git HEAD:fix-cgal

@alecjacobson alecjacobson merged commit a3f2406 into libigl:dev Dec 24, 2018

1 of 2 checks passed

continuous-integration/travis-ci/pr The Travis CI build failed
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
@alecjacobson

This comment has been minimized.

Copy link
Contributor

commented Dec 24, 2018

For posterity: this was merged despite seemingly breaking the continuous integration compilation and unit tests. In fact, those tests were disabled, so this merge now just accurately displays the (poor) state of affairs.

@alecjacobson

This comment has been minimized.

Copy link
Contributor

commented Dec 27, 2018

f186bed fixed the compilation issues. There's some kind of memory issue happening that causes the CGAL test(s) to occasionally fail. If I run it 1000 times I can usually get the /usr/local/libigl/build-debug/libigl_tests "CSGTree: extrusion" test to fail. The memory error might be CGAL's fault which would make this very hard to fix. I think we need @qnzhou 's help to debug this.

@qnzhou

This comment has been minimized.

Copy link
Collaborator

commented Dec 28, 2018

Looking into it.

@qnzhou

This comment has been minimized.

Copy link
Collaborator

commented Dec 29, 2018

Here is a stand alone code that will reproduce the issue on MacOS.

#include <iostream>
#include <Eigen/Core>
#include <igl/read_triangle_mesh.h>
#include <igl/copyleft/cgal/CSGTree.h>

int main() {
    constexpr size_t N=1e6;
    Eigen::MatrixXd V, VC;
    Eigen::MatrixXi F, FC;
    //igl::read_triangle_mesh("extrusion.obj", V, F);
    igl::read_triangle_mesh("ball.obj", V, F);

    for (size_t i=0; i<N; i++) {
        igl::copyleft::cgal::CSGTree tree(V, F);
        igl::copyleft::cgal::CSGTree inter(tree, tree, "i"); // returns error

        Eigen::MatrixXd V2 = inter.cast_V<Eigen::MatrixXd>();
        Eigen::MatrixXi F2 = inter.F();

        if (V2.rows() != V.rows()) {
            throw "V different";
        }
        if (F2.rows() != F.rows()) {
            throw "V different";
        }
    }

    return 0;
}

The issue is quite hard to trace (Thanks to cgal and boost). It has nothing to do with the mesh used. A simple ball or box can also be used to reproduce the problem. However, here are some interesting observations:

Instead of

        igl::copyleft::cgal::CSGTree tree(V, F);
        igl::copyleft::cgal::CSGTree inter(tree, tree, "i");

Replacing it with a simple call to

        igl::copyleft::cgal::mesh_boolean(V, F, V, F, igl::MESH_BOOLEAN_TYPE_INTERSECT, VC, FC);

seems to never fail. Thus, the problem may be related to igl::copyleft::cgal::CSGTree.

Here is another variation that also seems to work:

        igl::copyleft::cgal::CSGTree tree1(V, F);
        igl::copyleft::cgal::CSGTree tree2(V, F);
        igl::copyleft::cgal::CSGTree inter(tree1, tree2, "i");

Thus, the crash disappears by creating two identical trees instead of reusing the same tree. My current suspicion is that the memory deallocation mechanism of CGAL::gmpq is somehow incompatible with either Eigen::Matrix or CSGTree...

@alecjacobson

This comment has been minimized.

Copy link
Contributor

commented Dec 29, 2018

@copyme

This comment has been minimized.

Copy link
Contributor

commented Dec 29, 2018

@qnzhou Your code has seemed to work fine on Linux until I ran it in valgrind. Then I got this exception:

terminate called after throwing an instance of 'CGAL::Assertion_exception'
  what():  CGAL ERROR: assertion violation!
Expr: -CGAL_IA_MUL(-1.1, 10.1) != CGAL_IA_MUL(1.1, 10.1)
File: /home/kacper/Projects/libigl/external/cgal/Installation/lib/cmake/CGAL/../../../../Number_types/include/CGAL/Interval_nt.h
Line: 210
Explanation: Wrong rounding: did you forget the  -frounding-math  option if you use GCC (or  -fp-model strict  for Intel)?

Process finished with exit code 134 (interrupted by signal 6: SIGABRT) 

I am not exacty sure what valgrind changes that the code suddenly brakes, and to be 100% I am not saying that the above issue has anything to od with the OS X problem but it may.

Just my 3 cents, take it easy.

PS valgrind options: /usr/bin/valgrind --tool=memcheck --xml=yes --xml-file=/tmp/valgrind --gen-suppressions=all --leak-check=full --leak-resolution=med --track-origins=yes --vgdb=no <path>

@jdumas

This comment has been minimized.

Copy link
Collaborator Author

commented Dec 30, 2018

@qnzhou

This comment has been minimized.

Copy link
Collaborator

commented Dec 30, 2018

Following @jdumas' suggestion, here is the output from address sanitizer:

=================================================================
==69587==ERROR: AddressSanitizer: heap-use-after-free on address 0x604001b4fc70 at pc 0x000100211fbc bp 0x7ffeefb25e80 sp 0x7ffeefb25e78
READ of size 4 at 0x604001b4fc70 thread T0
    #0 0x100211fbb in CGAL::Handle_for<CGAL::Gmpq_rep, std::__1::allocator<CGAL::Gmpq_rep> >::Handle_for(CGAL::Handle_for<CGAL::Gmpq_rep, std::__1::allocator<CGAL::Gmpq_rep> > const&) Handle_for.h:153
    #1 0x100211eb7 in CGAL::Gmpq::Gmpq(CGAL::Gmpq const&) Gmpq_type.h:72
    #2 0x100210e8c in CGAL::Gmpq::Gmpq(CGAL::Gmpq const&) Gmpq_type.h:72
    #3 0x100296a97 in std::__1::array<CGAL::Gmpq, (1) + (sizeof...(CGAL::Gmpq, CGAL::Gmpq))> CGAL::make_array<CGAL::Gmpq, CGAL::Gmpq, CGAL::Gmpq>(CGAL::Gmpq const&, CGAL::Gmpq const&, CGAL::Gmpq const&) array.h:84
    #4 0x100296a2c in CGAL::VectorC3<CGAL::Simple_cartesian<CGAL::Gmpq> >::VectorC3(CGAL::Gmpq const&, CGAL::Gmpq const&, CGAL::Gmpq const&) Vector_3.h:76
    #5 0x1002969ec in CGAL::VectorC3<CGAL::Simple_cartesian<CGAL::Gmpq> >::VectorC3(CGAL::Gmpq const&, CGAL::Gmpq const&, CGAL::Gmpq const&) Vector_3.h:76
    #6 0x10029695f in CGAL::CartesianKernelFunctors::Construct_vector_3<CGAL::Simple_cartesian<CGAL::Gmpq> >::operator()(CGAL::Return_base_tag, CGAL::Gmpq const&, CGAL::Gmpq const&, CGAL::Gmpq const&) const function_objects.h:3540
    #7 0x1002967ff in CGAL::Vector_3<CGAL::Simple_cartesian<CGAL::Gmpq> >::Vector_3<CGAL::Gmpq, CGAL::Gmpq, CGAL::Gmpq>(CGAL::Gmpq const&, CGAL::Gmpq const&, CGAL::Gmpq const&) Vector_3.h:100
    #8 0x10029668c in CGAL::Vector_3<CGAL::Simple_cartesian<CGAL::Gmpq> >::Vector_3<CGAL::Gmpq, CGAL::Gmpq, CGAL::Gmpq>(CGAL::Gmpq const&, CGAL::Gmpq const&, CGAL::Gmpq const&) Vector_3.h:100
    #9 0x10029664c in CGAL::PointC3<CGAL::Simple_cartesian<CGAL::Gmpq> >::PointC3(CGAL::Gmpq const&, CGAL::Gmpq const&, CGAL::Gmpq const&) Point_3.h:54
    #10 0x10029660c in CGAL::PointC3<CGAL::Simple_cartesian<CGAL::Gmpq> >::PointC3(CGAL::Gmpq const&, CGAL::Gmpq const&, CGAL::Gmpq const&) Point_3.h:54
    #11 0x10029657f in CGAL::CartesianKernelFunctors::Construct_point_3<CGAL::Simple_cartesian<CGAL::Gmpq> >::operator()(CGAL::Return_base_tag, CGAL::Gmpq const&, CGAL::Gmpq const&, CGAL::Gmpq const&) const function_objects.h:3042
    #12 0x1004cc1b9 in CGAL::Lazy_rep_4<CGAL::Point_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::Point_3<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::CartesianKernelFunctors::Construct_point_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::CartesianKernelFunctors::Construct_point_3<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::NT_converter<CGAL::Gmpq, CGAL::Interval_nt<false> > >, CGAL::Return_base_tag, CGAL::Lazy_exact_nt<CGAL::Gmpq>, CGAL::Lazy_exact_nt<CGAL::Gmpq>, CGAL::Lazy_exact_nt<CGAL::Gmpq> >::update_exact() const Lazy.h:455
    #13 0x1004d01ff in CGAL::Lazy_rep<CGAL::Point_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::Point_3<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::NT_converter<CGAL::Gmpq, CGAL::Interval_nt<false> > > >::exact() Lazy.h:276
    #14 0x1004d012c in CGAL::Lazy<CGAL::Point_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::Point_3<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::Gmpq, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::NT_converter<CGAL::Gmpq, CGAL::Interval_nt<false> > > >::exact() const Lazy.h:792
    #15 0x1004ce454 in CGAL::Point_3<CGAL::Simple_cartesian<CGAL::Gmpq> > const& CGAL::exact<CGAL::Point_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::Point_3<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::Gmpq, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::NT_converter<CGAL::Gmpq, CGAL::Interval_nt<false> > > >(CGAL::Lazy<CGAL::Point_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::Point_3<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::Gmpq, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::NT_converter<CGAL::Gmpq, CGAL::Interval_nt<false> > > > const&) Lazy.h:92
    #16 0x1007bfbbc in CGAL::Lazy_rep_4<CGAL::Plane_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::Plane_3<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::CommonKernelFunctors::Construct_plane_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::CommonKernelFunctors::Construct_plane_3<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::NT_converter<CGAL::Gmpq, CGAL::Interval_nt<false> > >, CGAL::Return_base_tag, CGAL::Point_3<CGAL::Epeck>, CGAL::Point_3<CGAL::Epeck>, CGAL::Point_3<CGAL::Epeck> >::update_exact() const Lazy.h:455
    #17 0x100516d5f in CGAL::Lazy_rep<CGAL::Plane_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::Plane_3<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::NT_converter<CGAL::Gmpq, CGAL::Interval_nt<false> > > >::exact() Lazy.h:276
    #18 0x100516c8c in CGAL::Lazy<CGAL::Plane_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::Plane_3<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::Gmpq, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::NT_converter<CGAL::Gmpq, CGAL::Interval_nt<false> > > >::exact() const Lazy.h:792
    #19 0x100516c5b in CGAL::Plane_3<CGAL::Epeck>::ET const& CGAL::Exact_converter<CGAL::Epeck, CGAL::Simple_cartesian<CGAL::Gmpq> >::operator()<CGAL::Plane_3<CGAL::Epeck> >(CGAL::Plane_3<CGAL::Epeck> const&) const Lazy.h:502
    #20 0x1007c1738 in CGAL::Sign CGAL::Filtered_predicate<CGAL::CommonKernelFunctors::Oriented_side_3<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::CommonKernelFunctors::Oriented_side_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::Exact_converter<CGAL::Epeck, CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::Approx_converter<CGAL::Epeck, CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, true>::operator()<CGAL::Plane_3<CGAL::Epeck>, CGAL::Point_3<CGAL::Epeck> >(CGAL::Plane_3<CGAL::Epeck> const&, CGAL::Point_3<CGAL::Epeck> const&) const Filtered_predicate.h:176
    #21 0x1007c0f26 in CGAL::Sign CGAL::Static_filtered_predicate<CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::Filtered_predicate<CGAL::CommonKernelFunctors::Oriented_side_3<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::CommonKernelFunctors::Oriented_side_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::Exact_converter<CGAL::Epeck, CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::Approx_converter<CGAL::Epeck, CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, true>, CGAL::Filtered_predicate<CGAL::CommonKernelFunctors::Oriented_side_3<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::CommonKernelFunctors::Oriented_side_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::Cartesian_converter<CGAL::Type_equality_wrapper<CGAL::Cartesian_base_no_ref_count<double, CGAL::Epick>, CGAL::Epick>, CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::NT_converter<double, CGAL::Gmpq> >, CGAL::Cartesian_converter<CGAL::Type_equality_wrapper<CGAL::Cartesian_base_no_ref_count<double, CGAL::Epick>, CGAL::Epick>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::NT_converter<double, CGAL::Interval_nt<false> > >, true> >::operator()<CGAL::Plane_3<CGAL::Epeck>, CGAL::Point_3<CGAL::Epeck> >(CGAL::Plane_3<CGAL::Epeck> const&, CGAL::Point_3<CGAL::Epeck> const&) const Static_filtered_predicate.h:73
    #22 0x1007bb26a in CGAL::Plane_3<CGAL::Epeck>::oriented_side(CGAL::Point_3<CGAL::Epeck> const&) const Plane_3.h:204
    #23 0x1007a84ad in void igl::copyleft::cgal::order_facets_around_edge<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, unsigned long, unsigned long, std::__1::vector<int, std::__1::allocator<int> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, bool) order_facets_around_edge.cpp:136
    #24 0x1007937a6 in unsigned long igl::copyleft::cgal::extract_cells_single_component<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, unsigned long, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::__1::vector<std::__1::vector<unsigned long, std::__1::allocator<unsigned long> >, std::__1::allocator<std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > > > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&) extract_cells.cpp:484
    #25 0x1001dcf75 in unsigned long igl::copyleft::cgal::extract_cells<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, unsigned long, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::__1::vector<std::__1::vector<unsigned long, std::__1::allocator<unsigned long> >, std::__1::allocator<std::__1::vector<unsigned long, std::__1::allocator<unsigned long> > > > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&) extract_cells.cpp:129
    #26 0x1001cc4cc in bool igl::copyleft::cgal::mesh_boolean<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<unsigned long, 2, 1, 0, 2, 1>, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<long, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<unsigned long, 2, 1, 0, 2, 1> > const&, std::__1::function<int (Eigen::Matrix<int, 1, -1, 1, 1, -1>)> const&, std::__1::function<int (int, int)> const&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<long, -1, 1, 0, -1, 1> >&) mesh_boolean.cpp:253
    #27 0x1001b2991 in bool igl::copyleft::cgal::mesh_boolean<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<long, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::__1::function<int (Eigen::Matrix<int, 1, -1, 1, 1, -1>)> const&, std::__1::function<int (int, int)> const&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<long, -1, 1, 0, -1, 1> >&) mesh_boolean.cpp:123
    #28 0x1001b0e63 in bool igl::copyleft::cgal::mesh_boolean<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<long, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, igl::MeshBooleanType const&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<long, -1, 1, 0, -1, 1> >&) mesh_boolean.cpp:56
    #29 0x1001b0597 in igl::copyleft::cgal::CSGTree::CSGTree(igl::copyleft::cgal::CSGTree const&, igl::copyleft::cgal::CSGTree const&, igl::MeshBooleanType const&) CSGTree.h:98
    #30 0x1001a6dac in igl::copyleft::cgal::CSGTree::CSGTree(igl::copyleft::cgal::CSGTree const&, igl::copyleft::cgal::CSGTree const&, igl::MeshBooleanType const&) CSGTree.h:96
    #31 0x1001446cb in igl::copyleft::cgal::CSGTree::CSGTree(igl::copyleft::cgal::CSGTree const&, igl::copyleft::cgal::CSGTree const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) CSGTree.h:120
    #32 0x1001437e4 in main main.cpp:16
    #33 0x7fff5a255014 in start (libdyld.dylib:x86_64+0x1014)

0x604001b4fc70 is located 32 bytes inside of 40-byte region [0x604001b4fc50,0x604001b4fc78)
freed by thread T0 here:
    #0 0x10181c132 in wrap__ZdlPv (libclang_rt.asan_osx_dynamic.dylib:x86_64h+0x63132)
    #1 0x1001d0f0d in CGAL::Handle_for<CGAL::Gmpq_rep, std::__1::allocator<CGAL::Gmpq_rep> >::~Handle_for() Handle_for.h:207
    #2 0x1001d0ca4 in CGAL::Gmpq::~Gmpq() Gmpq_type.h:247
    #3 0x1001d0c84 in CGAL::Gmpq::~Gmpq() Gmpq_type.h:244
    #4 0x100296b92 in std::__1::array<CGAL::Gmpq, 3ul>::~array() array:121
    #5 0x100296b54 in std::__1::array<CGAL::Gmpq, 3ul>::~array() array:121
    #6 0x100296cc4 in CGAL::VectorC3<CGAL::Simple_cartesian<CGAL::Gmpq> >::~VectorC3() Vector_3.h:36
    #7 0x100296d84 in CGAL::Vector_3<CGAL::Simple_cartesian<CGAL::Gmpq> >::~Vector_3() Vector_3.h:43
    #8 0x100296d64 in CGAL::Vector_3<CGAL::Simple_cartesian<CGAL::Gmpq> >::~Vector_3() Vector_3.h:43
    #9 0x100296d44 in CGAL::PointC3<CGAL::Simple_cartesian<CGAL::Gmpq> >::~PointC3() Point_3.h:34
    #10 0x100296da4 in CGAL::Point_3<CGAL::Simple_cartesian<CGAL::Gmpq> >::~Point_3() Point_3.h:40
    #11 0x1002950b4 in CGAL::Point_3<CGAL::Simple_cartesian<CGAL::Gmpq> >::~Point_3() Point_3.h:40
    #12 0x1002aed62 in std::__1::array<CGAL::Point_3<CGAL::Simple_cartesian<CGAL::Gmpq> >, 3ul>::~array() array:121
    #13 0x1002aeb34 in std::__1::array<CGAL::Point_3<CGAL::Simple_cartesian<CGAL::Gmpq> >, 3ul>::~array() array:121
    #14 0x1002aeef4 in CGAL::TriangleC3<CGAL::Simple_cartesian<CGAL::Gmpq> >::~TriangleC3() Triangle_3.h:35
    #15 0x1002aef14 in CGAL::Triangle_3<CGAL::Simple_cartesian<CGAL::Gmpq> >::~Triangle_3() Triangle_3.h:38
    #16 0x1002a5244 in CGAL::Triangle_3<CGAL::Simple_cartesian<CGAL::Gmpq> >::~Triangle_3() Triangle_3.h:38
    #17 0x1004cef55 in CGAL::Lazy_rep<CGAL::Triangle_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::Triangle_3<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::NT_converter<CGAL::Gmpq, CGAL::Interval_nt<false> > > >::~Lazy_rep() Lazy.h:310
    #18 0x1004cf924 in CGAL::Lazy_rep_4<CGAL::Triangle_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::Triangle_3<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::CommonKernelFunctors::Construct_triangle_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::CommonKernelFunctors::Construct_triangle_3<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::NT_converter<CGAL::Gmpq, CGAL::Interval_nt<false> > >, CGAL::Return_base_tag, CGAL::Point_3<CGAL::Epeck>, CGAL::Point_3<CGAL::Epeck>, CGAL::Point_3<CGAL::Epeck> >::~Lazy_rep_4() Lazy.h:455
    #19 0x1004cef94 in CGAL::Lazy_rep_4<CGAL::Triangle_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::Triangle_3<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::CommonKernelFunctors::Construct_triangle_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::CommonKernelFunctors::Construct_triangle_3<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::NT_converter<CGAL::Gmpq, CGAL::Interval_nt<false> > >, CGAL::Return_base_tag, CGAL::Point_3<CGAL::Epeck>, CGAL::Point_3<CGAL::Epeck>, CGAL::Point_3<CGAL::Epeck> >::~Lazy_rep_4() Lazy.h:455
    #20 0x1004cefb8 in CGAL::Lazy_rep_4<CGAL::Triangle_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::Triangle_3<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::CommonKernelFunctors::Construct_triangle_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::CommonKernelFunctors::Construct_triangle_3<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::NT_converter<CGAL::Gmpq, CGAL::Interval_nt<false> > >, CGAL::Return_base_tag, CGAL::Point_3<CGAL::Epeck>, CGAL::Point_3<CGAL::Epeck>, CGAL::Point_3<CGAL::Epeck> >::~Lazy_rep_4() Lazy.h:455
    #21 0x1001b15e1 in CGAL::Handle::~Handle() Handle.h:64
    #22 0x1004d0104 in CGAL::Lazy<CGAL::Triangle_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::Triangle_3<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::Gmpq, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::NT_converter<CGAL::Gmpq, CGAL::Interval_nt<false> > > >::~Lazy() Lazy.h:727
    #23 0x1004d0a14 in CGAL::Triangle_3<CGAL::Epeck>::~Triangle_3() Triangle_3.h:38
    #24 0x1004c6714 in CGAL::Triangle_3<CGAL::Epeck>::~Triangle_3() Triangle_3.h:38
    #25 0x100735251 in std::__1::__vector_base<CGAL::Triangle_3<CGAL::Epeck>, std::__1::allocator<CGAL::Triangle_3<CGAL::Epeck> > >::~__vector_base() vector:441
    #26 0x100734fc4 in std::__1::vector<CGAL::Triangle_3<CGAL::Epeck>, std::__1::allocator<CGAL::Triangle_3<CGAL::Epeck> > >::~vector() iterator:1407
    #27 0x1004c6114 in std::__1::vector<CGAL::Triangle_3<CGAL::Epeck>, std::__1::allocator<CGAL::Triangle_3<CGAL::Epeck> > >::~vector() iterator:1407
    #28 0x1007354f4 in igl::copyleft::cgal::SelfIntersectMesh<CGAL::Epeck, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<long, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >::~SelfIntersectMesh() SelfIntersectMesh.h:49
    #29 0x1001f4ce4 in igl::copyleft::cgal::SelfIntersectMesh<CGAL::Epeck, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<long, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >::~SelfIntersectMesh() SelfIntersectMesh.h:49

previously allocated by thread T2645 here:
    #0 0x10181bb32 in wrap__Znwm (libclang_rt.asan_osx_dynamic.dylib:x86_64h+0x62b32)
    #1 0x1001d11a1 in CGAL::Handle_for<CGAL::Gmpq_rep, std::__1::allocator<CGAL::Gmpq_rep> >::Handle_for() Handle_for.h:76
    #2 0x100216d09 in CGAL::Gmpq::Gmpq(double) Gmpq_type.h:171
    #3 0x100216bde in CGAL::Gmpq::Gmpq(double) Gmpq_type.h:172
    #4 0x1002168b0 in CGAL::Lazy_exact_Cst<CGAL::Gmpq, double>::update_exact() const Lazy_exact_nt.h:153
    #5 0x1002106af in CGAL::Lazy_rep<CGAL::Interval_nt<false>, CGAL::Gmpq, CGAL::To_interval<CGAL::Gmpq> >::exact() Lazy.h:276
    #6 0x10020fbcc in CGAL::Lazy<CGAL::Interval_nt<false>, CGAL::Gmpq, CGAL::Lazy_exact_nt<CGAL::Gmpq>, CGAL::To_interval<CGAL::Gmpq> >::exact() const Lazy.h:792
    #7 0x1004cb114 in CGAL::Gmpq const& CGAL::exact<CGAL::Interval_nt<false>, CGAL::Gmpq, CGAL::Lazy_exact_nt<CGAL::Gmpq>, CGAL::To_interval<CGAL::Gmpq> >(CGAL::Lazy<CGAL::Interval_nt<false>, CGAL::Gmpq, CGAL::Lazy_exact_nt<CGAL::Gmpq>, CGAL::To_interval<CGAL::Gmpq> > const&) Lazy.h:92
    #8 0x1004cc178 in CGAL::Lazy_rep_4<CGAL::Point_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::Point_3<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::CartesianKernelFunctors::Construct_point_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::CartesianKernelFunctors::Construct_point_3<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::NT_converter<CGAL::Gmpq, CGAL::Interval_nt<false> > >, CGAL::Return_base_tag, CGAL::Lazy_exact_nt<CGAL::Gmpq>, CGAL::Lazy_exact_nt<CGAL::Gmpq>, CGAL::Lazy_exact_nt<CGAL::Gmpq> >::update_exact() const Lazy.h:455
    #9 0x1004d01ff in CGAL::Lazy_rep<CGAL::Point_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::Point_3<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::NT_converter<CGAL::Gmpq, CGAL::Interval_nt<false> > > >::exact() Lazy.h:276
    #10 0x1004d012c in CGAL::Lazy<CGAL::Point_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::Point_3<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::Gmpq, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::NT_converter<CGAL::Gmpq, CGAL::Interval_nt<false> > > >::exact() const Lazy.h:792
    #11 0x1004ce454 in CGAL::Point_3<CGAL::Simple_cartesian<CGAL::Gmpq> > const& CGAL::exact<CGAL::Point_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::Point_3<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::Gmpq, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::NT_converter<CGAL::Gmpq, CGAL::Interval_nt<false> > > >(CGAL::Lazy<CGAL::Point_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::Point_3<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::Gmpq, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::NT_converter<CGAL::Gmpq, CGAL::Interval_nt<false> > > > const&) Lazy.h:92
    #12 0x1004cf21f in CGAL::Lazy_rep_4<CGAL::Triangle_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::Triangle_3<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::CommonKernelFunctors::Construct_triangle_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::CommonKernelFunctors::Construct_triangle_3<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::NT_converter<CGAL::Gmpq, CGAL::Interval_nt<false> > >, CGAL::Return_base_tag, CGAL::Point_3<CGAL::Epeck>, CGAL::Point_3<CGAL::Epeck>, CGAL::Point_3<CGAL::Epeck> >::update_exact() const Lazy.h:455
    #13 0x1004d5d22 in CGAL::Lazy_rep<CGAL::Triangle_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::Triangle_3<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::NT_converter<CGAL::Gmpq, CGAL::Interval_nt<false> > > >::exact() Lazy.h:276
    #14 0x1004d5c4c in CGAL::Lazy<CGAL::Triangle_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::Triangle_3<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::Gmpq, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::NT_converter<CGAL::Gmpq, CGAL::Interval_nt<false> > > >::exact() const Lazy.h:792
    #15 0x1004d8214 in CGAL::Triangle_3<CGAL::Simple_cartesian<CGAL::Gmpq> > const& CGAL::exact<CGAL::Triangle_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::Triangle_3<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::Gmpq, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::NT_converter<CGAL::Gmpq, CGAL::Interval_nt<false> > > >(CGAL::Lazy<CGAL::Triangle_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::Triangle_3<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::Gmpq, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::NT_converter<CGAL::Gmpq, CGAL::Interval_nt<false> > > > const&) Lazy.h:92
    #16 0x100517c7c in CGAL::Lazy_rep_1<CGAL::Plane_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::Plane_3<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::CommonKernelFunctors::Construct_supporting_plane_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::CommonKernelFunctors::Construct_supporting_plane_3<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::NT_converter<CGAL::Gmpq, CGAL::Interval_nt<false> > >, CGAL::Triangle_3<CGAL::Epeck> >::update_exact() const Lazy.h:379
    #17 0x100516d5f in CGAL::Lazy_rep<CGAL::Plane_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::Plane_3<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::NT_converter<CGAL::Gmpq, CGAL::Interval_nt<false> > > >::exact() Lazy.h:276
    #18 0x100516c8c in CGAL::Lazy<CGAL::Plane_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::Plane_3<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::Gmpq, CGAL::Cartesian_converter<CGAL::Simple_cartesian<CGAL::Gmpq>, CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::NT_converter<CGAL::Gmpq, CGAL::Interval_nt<false> > > >::exact() const Lazy.h:792
    #19 0x100516c5b in CGAL::Plane_3<CGAL::Epeck>::ET const& CGAL::Exact_converter<CGAL::Epeck, CGAL::Simple_cartesian<CGAL::Gmpq> >::operator()<CGAL::Plane_3<CGAL::Epeck> >(CGAL::Plane_3<CGAL::Epeck> const&) const Lazy.h:502
    #20 0x10051541e in bool CGAL::Filtered_predicate<CGAL::CommonKernelFunctors::Equal_3<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::CommonKernelFunctors::Equal_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::Exact_converter<CGAL::Epeck, CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::Approx_converter<CGAL::Epeck, CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, true>::operator()<CGAL::Plane_3<CGAL::Epeck>, CGAL::Plane_3<CGAL::Epeck> >(CGAL::Plane_3<CGAL::Epeck> const&, CGAL::Plane_3<CGAL::Epeck> const&) const Filtered_predicate.h:176
    #21 0x100513b1e in bool CGAL::Static_filtered_predicate<CGAL::Simple_cartesian<CGAL::Interval_nt<false> >, CGAL::Filtered_predicate<CGAL::CommonKernelFunctors::Equal_3<CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::CommonKernelFunctors::Equal_3<CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, CGAL::Exact_converter<CGAL::Epeck, CGAL::Simple_cartesian<CGAL::Gmpq> >, CGAL::Approx_converter<CGAL::Epeck, CGAL::Simple_cartesian<CGAL::Interval_nt<false> > >, true>, CGAL::internal::Static_filters_predicates::Equal_3<CGAL::Filtered_kernel_base<CGAL::Type_equality_wrapper<CGAL::Cartesian_base_no_ref_count<double, CGAL::Epick>, CGAL::Epick> > > >::operator()<CGAL::Plane_3<CGAL::Epeck>, CGAL::Plane_3<CGAL::Epeck> >(CGAL::Plane_3<CGAL::Epeck> const&, CGAL::Plane_3<CGAL::Epeck> const&) const Static_filtered_predicate.h:73
    #22 0x10051388f in CGAL::Epeck::Boolean CGAL::operator==<CGAL::Epeck>(CGAL::Plane_3<CGAL::Epeck> const&, CGAL::Plane_3<CGAL::Epeck> const&) global_functions_3.h:796
    #23 0x1005123ac in CGAL::Epeck::Boolean CGAL::operator!=<CGAL::Epeck>(CGAL::Plane_3<CGAL::Epeck> const&, CGAL::Plane_3<CGAL::Epeck> const&) global_functions_3.h:802
    #24 0x10050cc1f in igl::copyleft::cgal::SelfIntersectMesh<CGAL::Epeck, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<long, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >::double_shared_vertex(CGAL::Triangle_3<CGAL::Epeck> const&, CGAL::Triangle_3<CGAL::Epeck> const&, long, long, std::__1::vector<std::__1::pair<long, long>, std::__1::allocator<std::__1::pair<long, long> > >) SelfIntersectMesh.h:640
    #25 0x100508b3c in igl::copyleft::cgal::SelfIntersectMesh<CGAL::Epeck, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<long, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >::process_intersecting_boxes()::'lambda'(unsigned long, unsigned long)::operator()(unsigned long, unsigned long) const SelfIntersectMesh.h:894
    #26 0x10050bfb1 in void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, igl::copyleft::cgal::SelfIntersectMesh<CGAL::Epeck, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<long, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >::process_intersecting_boxes()::'lambda'(unsigned long, unsigned long), unsigned long, unsigned long> >(void*) thread:352
    #27 0x7fff5a56d660 in _pthread_body (libsystem_pthread.dylib:x86_64+0x3660)
    #28 0x7fff5a56d50c in _pthread_start (libsystem_pthread.dylib:x86_64+0x350c)
    #29 0x7fff5a56cbf8 in thread_start (libsystem_pthread.dylib:x86_64+0x2bf8)

Thread T2645 created by T0 here:
    #0 0x101807e1d in wrap_pthread_create (libclang_rt.asan_osx_dynamic.dylib:x86_64h+0x4ee1d)
    #1 0x10050b0ec in std::__1::thread::thread<igl::copyleft::cgal::SelfIntersectMesh<CGAL::Epeck, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<long, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >::process_intersecting_boxes()::'lambda'(unsigned long, unsigned long)&, unsigned long, unsigned long, void>(igl::copyleft::cgal::SelfIntersectMesh<CGAL::Epeck, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<long, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >::process_intersecting_boxes()::'lambda'(unsigned long, unsigned long)&&&, unsigned long&&, unsigned long&&) thread:368
    #2 0x10050a1fc in std::__1::thread::thread<igl::copyleft::cgal::SelfIntersectMesh<CGAL::Epeck, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<long, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >::process_intersecting_boxes()::'lambda'(unsigned long, unsigned long)&, unsigned long, unsigned long, void>(igl::copyleft::cgal::SelfIntersectMesh<CGAL::Epeck, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<long, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >::process_intersecting_boxes()::'lambda'(unsigned long, unsigned long)&&&, unsigned long&&, unsigned long&&) thread:360
    #3 0x1004b3d3e in igl::copyleft::cgal::SelfIntersectMesh<CGAL::Epeck, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<long, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >::process_intersecting_boxes() SelfIntersectMesh.h:927
    #4 0x1004af72c in igl::copyleft::cgal::SelfIntersectMesh<CGAL::Epeck, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<long, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >::SelfIntersectMesh(Eigen::MatrixBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, igl::copyleft::cgal::RemeshSelfIntersectionsParam const&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<long, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&) SelfIntersectMesh.h:361
    #5 0x1001f4cc3 in igl::copyleft::cgal::SelfIntersectMesh<CGAL::Epeck, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<long, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >::SelfIntersectMesh(Eigen::MatrixBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, igl::copyleft::cgal::RemeshSelfIntersectionsParam const&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<long, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&) SelfIntersectMesh.h:307
    #6 0x1001d9678 in void igl::copyleft::cgal::remesh_self_intersections<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<long, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, igl::copyleft::cgal::RemeshSelfIntersectionsParam const&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<long, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&) remesh_self_intersections.cpp:79
    #7 0x1001cbd19 in bool igl::copyleft::cgal::mesh_boolean<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<unsigned long, 2, 1, 0, 2, 1>, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<long, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<unsigned long, 2, 1, 0, 2, 1> > const&, std::__1::function<int (Eigen::Matrix<int, 1, -1, 1, 1, -1>)> const&, std::__1::function<int (int, int)> const&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<long, -1, 1, 0, -1, 1> >&) mesh_boolean.cpp:223
    #8 0x1001b2991 in bool igl::copyleft::cgal::mesh_boolean<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<long, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::__1::function<int (Eigen::Matrix<int, 1, -1, 1, 1, -1>)> const&, std::__1::function<int (int, int)> const&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<long, -1, 1, 0, -1, 1> >&) mesh_boolean.cpp:123
    #9 0x1001b0e63 in bool igl::copyleft::cgal::mesh_boolean<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<long, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, igl::MeshBooleanType const&, Eigen::PlainObjectBase<Eigen::Matrix<CGAL::Lazy_exact_nt<CGAL::Gmpq>, -1, 3, 0, -1, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<long, -1, 1, 0, -1, 1> >&) mesh_boolean.cpp:56
    #10 0x1001b0597 in igl::copyleft::cgal::CSGTree::CSGTree(igl::copyleft::cgal::CSGTree const&, igl::copyleft::cgal::CSGTree const&, igl::MeshBooleanType const&) CSGTree.h:98
    #11 0x1001a6dac in igl::copyleft::cgal::CSGTree::CSGTree(igl::copyleft::cgal::CSGTree const&, igl::copyleft::cgal::CSGTree const&, igl::MeshBooleanType const&) CSGTree.h:96
    #12 0x1001446cb in igl::copyleft::cgal::CSGTree::CSGTree(igl::copyleft::cgal::CSGTree const&, igl::copyleft::cgal::CSGTree const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) CSGTree.h:120
    #13 0x1001437e4 in main main.cpp:16
    #14 0x7fff5a255014 in start (libdyld.dylib:x86_64+0x1014)

SUMMARY: AddressSanitizer: heap-use-after-free Handle_for.h:153 in CGAL::Handle_for<CGAL::Gmpq_rep, std::__1::allocator<CGAL::Gmpq_rep> >::Handle_for(CGAL::Handle_for<CGAL::Gmpq_rep, std::__1::allocator<CGAL::Gmpq_rep> > const&)
Shadow bytes around the buggy address:
  0x1c0800369f30: fa fa 00 00 00 00 00 fa fa fa fd fd fd fd fd fd
  0x1c0800369f40: fa fa fd fd fd fd fd fd fa fa fd fd fd fd fd fa
  0x1c0800369f50: fa fa fd fd fd fd fd fa fa fa fd fd fd fd fd fd
  0x1c0800369f60: fa fa fd fd fd fd fd fd fa fa fd fd fd fd fd fd
  0x1c0800369f70: fa fa fd fd fd fd fd fa fa fa fd fd fd fd fd fa
=>0x1c0800369f80: fa fa fd fd fd fd fd fd fa fa fd fd fd fd[fd]fa
  0x1c0800369f90: fa fa fa fa fa fa fa fa fa fa fd fd fd fd fd fd
  0x1c0800369fa0: fa fa fd fd fd fd fd fd fa fa fa fa fa fa fa fa
  0x1c0800369fb0: fa fa fd fd fd fd fd fd fa fa fd fd fd fd fd fd
  0x1c0800369fc0: fa fa fa fa fa fa fa fa fa fa 00 00 00 00 00 fa
  0x1c0800369fd0: fa fa fd fd fd fd fd fa fa fa 00 00 00 00 00 fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==69587==ABORTING
@qnzhou

This comment has been minimized.

Copy link
Collaborator

commented Dec 30, 2018

Another interesting observation: The code also seems to be working in single thread mode (achieved by setting the following environment variable).

export LIBIGL_NUM_THREADS=1

We already have locks for each vertex and each triangle... Maybe CGAL is caching some computed quantity (e.g. Plane_3 for each face)??

@qnzhou

This comment has been minimized.

Copy link
Collaborator

commented Dec 30, 2018

Ah, I know! 😎

We are locking each triangle and each vertex assuming all triangles and vertices are separate entities in memory! However, it is not true for the following line:

        igl::copyleft::cgal::CSGTree inter(tree, tree, "i");

where two different triangles could be mapped to the same memory location... So, when we are locking triangle i, we also need to lock all other triangles that are memory-wise identical to triangle i. One way is to always hard copy the inputs (if CGAL supports hard copying) so all triangles and all vertices are separate memory entities. Another way is to add book keeping code to handle memory-wise duplicates.

@alecjacobson Any thought on this?

@alecjacobson

This comment has been minimized.

Copy link
Contributor

commented Dec 30, 2018

Interesting. Admittedly it will be rare to do exactly this operation. But it is conceivably very possible to merge CSG trees that reference the same primitives...

Ultimately this comes down to the non-read safe nature of CGAL's Epeck type. Do we have an easy way to turn multi-threading on or off?

@qnzhou

This comment has been minimized.

Copy link
Collaborator

commented Dec 31, 2018

The easiest way is to set the environment variable LIBIGL_NUM_THREADS.

@jdumas jdumas referenced this pull request Feb 12, 2019

Closed

Memory issue in CGAL multi-threaded CSG. #1086

1 of 3 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.