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

Assertion `mGlpkContext.find(std::this_thread::get_id()) != mGlpkContext.end()' failed. #15

Open
fefrei opened this issue Mar 16, 2018 · 0 comments

Comments

@fefrei
Copy link
Contributor

fefrei commented Mar 16, 2018

When working with Support Functions, I've run into a multi-threading issue.

Here are reproduction steps:

  1. Be on Carl 17.12, HyPro 1b7a90ef35d2ce43b99023681b6c381c5d47d8e2 and draisine-hypro version 0311070a0994ec8e182c72d72d7774389fe17dba.
  2. Have this bubbles.json file ready: bubbles.zip
  3. Compile draisine-hypro
  4. Run valgrind --leak-check=yes bin/saved-cli -b ../../bubbles.json, adjusting the paths as necessary.

I got the following error:

==1073== Memcheck, a memory error detector
==1073== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==1073== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==1073== Command: bin/saved-cli -b ../../bubbles.json
==1073==
Reading Bubble file...
Initializing...
Analyzing...
  Computing dynamic step...
  Chunking...
saved-cli: /mnt/c/Users/felix/git/hypro/src/hypro/representations/conversion/../Box/../../util/linearOptimization/Optimizer.tpp:336: void hypro::Optimizer<Number>::initialize() const [with Number = double]: Assertion `mGlpkContext.find(std::this_thread::get_id()) != mGlpkContext.end()' failed.
==1073==
==1073== Process terminating with default action of signal 6 (SIGABRT)
==1073==    at 0x6318428: raise (raise.c:54)
==1073==    by 0x631A029: abort (abort.c:89)
==1073==    by 0x6310BD6: __assert_fail_base (assert.c:92)
==1073==    by 0x6310C81: __assert_fail (assert.c:101)
==1073==    by 0xAD251B: hypro::Optimizer<double>::initialize() const (Optimizer.tpp:336)
==1073==    by 0xABDBD5: hypro::Optimizer<double>::updateConstraints() const (Optimizer.tpp:351)
==1073==    by 0xAB8B4F: hypro::Optimizer<double>::evaluate(Eigen::Matrix<double, -1, 1, 0, -1, 1> const&, bool) const (Optimizer.tpp:89)
==1073==    by 0xADE0F1: hypro::PolytopeSupportFunction<double, hypro::PolytopeSupportFunctionSetting>::multiEvaluate(Eigen::Matrix<double, -1, -1, 0, -1, -1> const&, bool, bool) const (PolytopeSupportFunction.tpp:304)
==1073==    by 0xAC82FE: hypro::SupportFunctionContent<double>::multiEvaluate(Eigen::Matrix<double, -1, -1, 0, -1, -1> const&, bool) const (SupportFunctionContent.tpp:432)
==1073==    by 0xAB7111: hypro::SupportFunctionContent<double>::evaluate(Eigen::Matrix<double, -1, 1, 0, -1, 1> const&, bool) const (SupportFunctionContent.tpp:372)
==1073==    by 0xAA7482: hypro::SupportFunctionT<double, hypro::Converter<double> >::satisfiesHalfspaces(Eigen::Matrix<double, -1, -1, 0, -1, -1> const&, Eigen::Matrix<double, -1, 1, 0, -1, 1> const&) const (SupportFunction.tpp:471)
==1073==    by 0xC1091A: std::pair<hypro::CONTAINMENT, boost::variant<hypro::BoxT<double, hypro::Converter<double>, hypro::BoxLinearOptimizationOn>, hypro::ConstraintSetT<double, hypro::Converter<double> >, hypro::SupportFunctionT<double, hypro::Converter<double> >, hypro::ZonotopeT<double, hypro::Converter<double> >, hypro::HPolytopeT<double, hypro::Converter<double>, hypro::HPolytopeSetting>, hypro::VPolytopeT<double, hypro::Converter<double> > > > hypro::genericSatisfiesHalfspacesVisitor<boost::variant<hypro::BoxT<double, hypro::Converter<double>, hypro::BoxLinearOptimizationOn>, hypro::ConstraintSetT<double, hypro::Converter<double> >, hypro::SupportFunctionT<double, hypro::Converter<double> >, hypro::ZonotopeT<double, hypro::Converter<double> >, hypro::HPolytopeT<double, hypro::Converter<double>, hypro::HPolytopeSetting>, hypro::VPolytopeT<double, hypro::Converter<double> > >, double>::operator()<hypro::SupportFunctionT<double, hypro::Converter<double> > >(hypro::SupportFunctionT<double, hypro::Converter<double> > const&) const (Visitors.h:200)
==1073==
==1073== HEAP SUMMARY:
==1073==     in use at exit: 77,723,106 bytes in 173,622 blocks
==1073==   total heap usage: 38,071,769 allocs, 37,898,147 frees, 3,420,284,156 bytes allocated
==1073==
==1073== 516 bytes in 1 blocks are definitely lost in loss record 372 of 852
==1073==    at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1073==    by 0x51954D4: glp_malloc (glpenv05.c:68)
==1073==    by 0x519F0D7: reallocate (glpluf.c:413)
==1073==    by 0x519F0D7: _glp_luf_factorize (glpluf.c:1522)
==1073==    by 0x5196411: _glp_fhv_factorize (glpfhv.c:168)
==1073==    by 0x5194420: _glp_bfd_factorize (glpbfd.c:227)
==1073==    by 0x518FDB2: glp_factorize (glpapi12.c:154)
==1073==    by 0x518D697: solve_lp (glpapi06.c:221)
==1073==    by 0x518DEA2: glp_simplex (glpapi06.c:452)
==1073==    by 0x5183749: hypro::EvaluationResult<double> hypro::glpkOptimizeLinear<double>(glp_prob*, Eigen::Matrix<double, -1, 1, 0, -1, 1> const&, Eigen::Matrix<double, -1, -1, 0, -1, -1> const&, Eigen::Matrix<double, -1, 1, 0, -1, 1> const&, bool) (in /mnt/c/Users/felix/git/hypro/build/libhypro.so.17.09)
==1073==    by 0xAB8D54: hypro::Optimizer<double>::evaluate(Eigen::Matrix<double, -1, 1, 0, -1, 1> const&, bool) const (Optimizer.tpp:117)
==1073==    by 0xADE0F1: hypro::PolytopeSupportFunction<double, hypro::PolytopeSupportFunctionSetting>::multiEvaluate(Eigen::Matrix<double, -1, -1, 0, -1, -1> const&, bool, bool) const (PolytopeSupportFunction.tpp:304)
==1073==    by 0xAC82FE: hypro::SupportFunctionContent<double>::multiEvaluate(Eigen::Matrix<double, -1, -1, 0, -1, -1> const&, bool) const (SupportFunctionContent.tpp:432)
==1073==
==1073== 2,432 bytes in 8 blocks are possibly lost in loss record 555 of 852
==1073==    at 0x4C2FB55: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1073==    by 0x40138A4: allocate_dtv (dl-tls.c:322)
==1073==    by 0x40138A4: _dl_allocate_tls (dl-tls.c:539)
==1073==    by 0x55AD26E: allocate_stack (allocatestack.c:588)
==1073==    by 0x55AD26E: pthread_create@@GLIBC_2.2.5 (pthread_create.c:539)
==1073==    by 0x5AFADC2: std::thread::_M_start_thread(std::shared_ptr<std::thread::_Impl_base>, void (*)()) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21)
==1073==    by 0xC5FCC1: std::thread::thread<std::reference_wrapper<saved::ChunkingWorker>>(std::reference_wrapper<saved::ChunkingWorker>&&) (thread:137)
==1073==    by 0xC577D1: saved::Chunker::parallelChunk() (Chunker.cpp:79)
==1073==    by 0xC57930: saved::Chunker::Chunker(saved::VerificationSettings, std::vector<saved::Bubble, std::allocator<saved::Bubble> > const&, std::vector<boost::optional<hypro::State<double, double, hypro::BoxT<double, hypro::Converter<double>, hypro::BoxLinearOptimizationOn>, hypro::ConstraintSetT<double, hypro::Converter<double> >, hypro::SupportFunctionT<double, hypro::Converter<double> >, hypro::ZonotopeT<double, hypro::Converter<double> >, hypro::HPolytopeT<double, hypro::Converter<double>, hypro::HPolytopeSetting>, hypro::VPolytopeT<double, hypro::Converter<double> > > >, std::allocator<boost::optional<hypro::State<double, double, hypro::BoxT<double, hypro::Converter<double>, hypro::BoxLinearOptimizationOn>, hypro::ConstraintSetT<double, hypro::Converter<double> >, hypro::SupportFunctionT<double, hypro::Converter<double> >, hypro::ZonotopeT<double, hypro::Converter<double> >, hypro::HPolytopeT<double, hypro::Converter<double>, hypro::HPolytopeSetting>, hypro::VPolytopeT<double, hypro::Converter<double> > > > > > const&) (Chunker.cpp:89)
==1073==    by 0xC70620: saved::Verifier::run() (Verifier.cpp:53)
==1073==    by 0xC7F23F: main (main.cpp:62)
==1073==
==1073== LEAK SUMMARY:
==1073==    definitely lost: 516 bytes in 1 blocks
==1073==    indirectly lost: 0 bytes in 0 blocks
==1073==      possibly lost: 2,432 bytes in 8 blocks
==1073==    still reachable: 77,720,158 bytes in 173,613 blocks
==1073==         suppressed: 0 bytes in 0 blocks
==1073== Reachable blocks (those to which a pointer was found) are not shown.
==1073== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==1073==
==1073== For counts of detected and suppressed errors, rerun with: -v
==1073== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
Killed

I was able to reproduce this issue in 1 of 2 tries. 😐

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant