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

segfault using console-solver when checked out from source #16

Closed
ghost opened this issue Aug 18, 2021 · 2 comments
Closed

segfault using console-solver when checked out from source #16

ghost opened this issue Aug 18, 2021 · 2 comments

Comments

@ghost
Copy link

ghost commented Aug 18, 2021

If I build from source on linux I keep getting a segfault when testing the console-solver, here is the backtrace, it seems to work fine when single threaded, but 2 threads or more and it crashes, also the precompiled download works fine with 8 threads.

#run with 2 threads

home:~/TexasSolver/build$ gdb console_solver
(gdb) r -i ../resources/text/commandline_sample_input.txt
Starting program: /home/tj/TexasSolver/build/console_solver -i ../resources/text/commandline_sample_input.txt
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
EXEC FROM FILE

<<>>
Using 2 threads
Iter: 0
[New Thread 0x7ffff79f3700 (LWP 42537)]

Thread 1 "console_solver" received signal SIGSEGV, Segmentation fault.
0x00005555555e08b2 in std::_Hashtable<unsigned long, std::pair<unsigned long const, int>, std::allocator<std::pair<unsigned long const, int> >, std::__detail::_Select1st, std::equal_to, std::hash, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >::_M_find_before_node(unsigned long, unsigned long const&, unsigned long) const ()
(gdb) bt
#0 0x00005555555e08b2 in std::_Hashtable<unsigned long, std::pair<unsigned long const, int>, std::allocator<std::pair<unsigned long const, int> >, std::__detail::_Select1st, std::equal_to, std::hash, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >::_M_find_before_node(unsigned long, unsigned long const&, unsigned long) const
()
#1 0x00005555555df6ae in std::_Hashtable<unsigned long, std::pair<unsigned long const, int>, std::allocator<std::pair<unsigned long const, int> >, std::__detail::_Select1st, std::equal_to, std::hash, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >::_M_find_node(unsigned long, unsigned long const&, unsigned long) const ()
#2 0x00005555555df515 in std::__detail::_Map_base<unsigned long, std::pair<unsigned long const, int>, std::allocator<std::pair<unsigned long const, int> >, std::__detail::_Select1st, std::equal_to, std::hash, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true>, true>::operator[](unsigned long const&) ()
#3 0x00005555555de963 in std::unordered_map<unsigned long, int, std::hash, std::equal_to, std::allocator<std::pair<unsigned long const, int> > >::operator[](unsigned long const&) ()
#4 0x00005555555dd902 in Dic5Compairer::getRank(std::vector<int, std::allocator >) ()
#5 0x00005555555ddbc8 in Dic5Compairer::get_rank(std::vector<int, std::allocator >, std::vector<int, std::allocator >) ()
#6 0x00005555555ddca8 in Dic5Compairer::get_rank(unsigned long, unsigned long) ()
#7 0x0000555555605658 in RiverRangeManager::getRiverCombos(int, std::vector<PrivateCards, std::allocator > const&, unsigned long) ()
#8 0x000055555560c10b in BestResponse::showdownBestResponse(std::shared_ptr, int, std::vector<std::vector<float, std::allocator >, std::allocator<std::vector<float, std::allocator > > > const&, unsigned long, int) ()
#9 0x000055555560a55f in BestResponse::bestResponse(std::shared_ptr, int, std::vector<std::vector<float, std::allocator >, std::allocator<std::vector<float, std::allocator > > > const&, unsigned long, int)
()
#10 0x000055555560afe8 in BestResponse::actionBestResponse(std::shared_ptr, int, std::vector<std::vector<float, std::allocator >, std::allocator<std::vector<float, std::allocator > > > const&, unsigned long, int) ()
#11 0x000055555560a4d0 in BestResponse::bestResponse(std::shared_ptr, int, std::vector<std::vector<float, std::allocator >, std::allocator<std::vector<float, std::allocator > > > const&, unsigned long, int)
()
#12 0x000055555560b784 in BestResponse::actionBestResponse(std::shared_ptr, int, std::vector<std::vector<float, std::allocator >, std::allocator<std::vector<float, std::allocator > > > const&, unsigned long, int) ()
#13 0x000055555560a4d0 in BestResponse::bestResponse(std::shared_ptr, int, std::vector<std::vector<float, std::allocator >, std::allocator<std::vector<float, std::allocator > > > const&, unsigned long, int)
()
#14 0x000055555560cd55 in BestResponse::chanceBestReponse(std::shared_ptr, int, std::vector<std::vector<float, std::allocator >, std::allocator<std::vector<float, std::allocator > > > const&, unsigned long, int) [clone ._omp_fn.0] ()
#15 0x00007ffff7c428e6 in GOMP_parallel () from /lib/x86_64-linux-gnu/libgomp.so.1
#16 0x000055555560aa82 in BestResponse::chanceBestReponse(std::shared_ptr, int, std::vector<std::vector<float, std::allocator >, std::allocator<std::vector<float, std::allocator > > > const&, unsigned long, int) ()
#17 0x000055555560a67d in BestResponse::bestResponse(std::shared_ptr, int, std::vector<std::vector<float, std::allocator >, std::allocator<std::vector<float, std::allocator > > > const&, unsigned long, int)
()
#18 0x000055555560afe8 in BestResponse::actionBestResponse(std::shared_ptr, int, std::vector<std::vector<float, std::allocator >, std::allocator<std::vector<float, std::allocator > > > const&, unsigned long, int) ()
#19 0x000055555560a4d0 in BestResponse::bestResponse(std::shared_ptr, int, std::vector<std::vector<float, std::allocator >, std::allocator<std::vector<float, std::allocator > > > const&, unsigned long, int)
()
#20 0x000055555560b784 in BestResponse::actionBestResponse(std::shared_ptr, int, std::vector<std::vector<float, std::allocator >, std::allocator<std::vector<float, std::allocator > > > const&, unsigned long, int) ()
#21 0x000055555560a4d0 in BestResponse::bestResponse(std::shared_ptr, int, std::vector<std::vector<float, std::allocator >, std::allocator<std::vector<float, std::allocator > > > const&, unsigned long, int)
()
#22 0x000055555560cd55 in BestResponse::chanceBestReponse(std::shared_ptr, int, std::vector<std::vector<float, std::allocator >, std::allocator<std::vector<float, std::allocator > > > const&, unsigned long, int) [clone ._omp_fn.0] ()
#23 0x00007ffff7c428e6 in GOMP_parallel () from /lib/x86_64-linux-gnu/libgomp.so.1
#24 0x000055555560aa82 in BestResponse::chanceBestReponse(std::shared_ptr, int, std::vector<std::vector<float, std::allocator >, std::allocator<std::vector<float, std::allocator > > > const&, unsigned long, int) ()
#25 0x000055555560a67d in BestResponse::bestResponse(std::shared_ptr, int, std::vector<std::vector<float, std::allocator >, std::allocator<std::vector<float, std::allocator > > > const&, unsigned long, int)
()
#26 0x000055555560afe8 in BestResponse::actionBestResponse(std::shared_ptr, int, std::vector<std::vector<float, std::allocator >, std::allocator<std::vector<float, std::allocator > > > const&, unsigned long, int) ()
#27 0x000055555560a4d0 in BestResponse::bestResponse(std::shared_ptr, int, std::vector<std::vector<float, std::allocator >, std::allocator<std::vector<float, std::allocator > > > const&, unsigned long, int)
()
#28 0x000055555560b784 in BestResponse::actionBestResponse(std::shared_ptr, int, std::vector<std::vector<float, std::allocator >, std::allocator<std::vector<float, std::allocator > > > const&, unsigned long, int) ()
#29 0x000055555560a4d0 in BestResponse::bestResponse(std::shared_ptr, int, std::vector<std::vector<float, std::allocator >, std::allocator<std::vector<float, std::allocator > > > const&, unsigned long, int)
()
#30 0x000055555560a1b8 in BestResponse::getBestReponseEv(std::shared_ptr, int, std::vector<std::vector<float, std::allocator >, std::allocator<std::vector<float, std::allocator > > >, unsigned long, int) ()
#31 0x0000555555609f10 in BestResponse::printExploitability(std::shared_ptr, int, float, unsigned long) ()
#32 0x00005555555f5e40 in PCfrSolver::train() ()
#33 0x000055555558e423 in PokerSolver::train(std::__cxx11::basic_string<char, std::char_traits, std::allocator >, std::__cxx11::basic_string<char, std::char_traits, std::allocator >, std::__cxx11::basic_string<char, std::char_traits, std::allocator >, std::__cxx11::basic_string<char, std::char_traits, std::allocator >, int, int, std::__cxx11::basic_string<char, std::char_traits, std::allocator >, int, float, bool, int) ()
#34 0x0000555555588135 in CommandLineTool::processCommand(std::__cxx11::basic_string<char, std::char_traits, std::allocator >) ()
#35 0x00005555555873a4 in CommandLineTool::execFromFile(std::__cxx11::basic_string<char, std::char_traits, std::allocator >) ()
#36 0x000055555555de28 in main ()
(gdb)

#run started using default 8 threads

home:~/TexasSolver/build$ gdb console_solver
(gdb) r -i ../resources/text/commandline_sample_input.txt
Starting program: /home/tj/TexasSolver/build/console_solver -i ../resources/text/commandline_sample_input.txt
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
EXEC FROM FILE

<<>>
Using 8 threads
Iter: 0
[New Thread 0x7ffff79f3700 (LWP 42384)]
[New Thread 0x7ffff71f2700 (LWP 42385)]
[New Thread 0x7ffff69f1700 (LWP 42386)]
[New Thread 0x7ffff61f0700 (LWP 42387)]
[New Thread 0x7ffff59ef700 (LWP 42388)]
[New Thread 0x7ffff51ee700 (LWP 42389)]
[New Thread 0x7ffff49ed700 (LWP 42390)]

Thread 2 "console_solver" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff79f3700 (LWP 42384)]
0x00005555555e08b2 in std::_Hashtable<unsigned long, std::pair<unsigned long const, int>, std::allocator<std::pair<unsigned long const, int> >, std::__detail::_Select1st, std::equal_to, std::hash, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >::_M_find_before_node(unsigned long, unsigned long const&, unsigned long) const ()
(gdb) bt
#0 0x00005555555e08b2 in std::_Hashtable<unsigned long, std::pair<unsigned long const, int>, std::allocator<std::pair<unsigned long const, int> >, std::__detail::_Select1st, std::equal_to, std::hash, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >::_M_find_before_node(unsigned long, unsigned long const&, unsigned long) const
()
#1 0x00005555555df6ae in std::_Hashtable<unsigned long, std::pair<unsigned long const, int>, std::allocator<std::pair<unsigned long const, int> >, std::__detail::_Select1st, std::equal_to, std::hash, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >::_M_find_node(unsigned long, unsigned long const&, unsigned long) const ()
#2 0x00005555555df515 in std::__detail::_Map_base<unsigned long, std::pair<unsigned long const, int>, std::allocator<std::pair<unsigned long const, int> >, std::__detail::_Select1st, std::equal_to, std::hash, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true>, true>::operator[](unsigned long const&) ()
#3 0x00005555555de963 in std::unordered_map<unsigned long, int, std::hash, std::equal_to, std::allocator<std::pair<unsigned long const, int> > >::operator[](unsigned long const&) ()
#4 0x00005555555dd902 in Dic5Compairer::getRank(std::vector<int, std::allocator >) ()
#5 0x00005555555ddbc8 in Dic5Compairer::get_rank(std::vector<int, std::allocator >, std::vector<int, std::allocator >) ()
#6 0x00005555555ddca8 in Dic5Compairer::get_rank(unsigned long, unsigned long) ()
#7 0x0000555555605658 in RiverRangeManager::getRiverCombos(int, std::vector<PrivateCards, std::allocator > const&, unsigned long) ()
#8 0x000055555560c15f in BestResponse::showdownBestResponse(std::shared_ptr, int, std::vector<std::vector<float, std::allocator >, std::allocator<std::vector<float, std::allocator > > > const&, unsigned long, int) ()
#9 0x000055555560a55f in BestResponse::bestResponse(std::shared_ptr, int, std::vector<std::vector<float, std::allocator >, std::allocator<std::vector<float, std::allocator > > > const&, unsigned long, int)
()
#10 0x000055555560afe8 in BestResponse::actionBestResponse(std::shared_ptr, int, std::vector<std::vector<float, std::allocator >, std::allocator<std::vector<float, std::allocator > > > const&, unsigned long, int) ()
#11 0x000055555560a4d0 in BestResponse::bestResponse(std::shared_ptr, int, std::vector<std::vector<float, std::allocator >, std::allocator<std::vector<float, std::allocator > > > const&, unsigned long, int)
()
#12 0x000055555560b784 in BestResponse::actionBestResponse(std::shared_ptr, int, std::vector<std::vector<float, std::allocator >, std::allocator<std::vector<float, std::allocator > > > const&, unsigned long, int) ()
#13 0x000055555560a4d0 in BestResponse::bestResponse(std::shared_ptr, int, std::vector<std::vector<float, std::allocator >, std::allocator<std::vector<float, std::allocator > > > const&, unsigned long, int)
()
#14 0x000055555560cd55 in BestResponse::chanceBestReponse(std::shared_ptr, int, std::vector<std::vector<float, std::allocator >, std::allocator<std::vector<float, std::allocator > > > const&, unsigned long, int) [clone ._omp_fn.0] ()
#15 0x00007ffff7c428e6 in GOMP_parallel () from /lib/x86_64-linux-gnu/libgomp.so.1
#16 0x000055555560aa82 in BestResponse::chanceBestReponse(std::shared_ptr, int, std::vector<std::vector<float, std::allocator >, std::allocator<std::vector<float, std::allocator > > > const&, unsigned long, int) ()
#17 0x000055555560a67d in BestResponse::bestResponse(std::shared_ptr, int, std::vector<std::vector<float, std::allocator >, std::allocator<std::vector<float, std::allocator > > > const&, unsigned long, int)
()
#18 0x000055555560afe8 in BestResponse::actionBestResponse(std::shared_ptr, int, std::vector<std::vector<float, std::allocator >, std::allocator<std::vector<float, std::allocator > > > const&, unsigned long, int) ()
#19 0x000055555560a4d0 in BestResponse::bestResponse(std::shared_ptr, int, std::vector<std::vector<float, std::allocator >, std::allocator<std::vector<float, std::allocator > > > const&, unsigned long, int)
()
#20 0x000055555560b784 in BestResponse::actionBestResponse(std::shared_ptr, int, std::vector<std::vector<float, std::allocator >, std::allocator<std::vector<float, std::allocator > > > const&, unsigned long, int) ()
#21 0x000055555560a4d0 in BestResponse::bestResponse(std::shared_ptr, int, std::vector<std::vector<float, std::allocator >, std::allocator<std::vector<float, std::allocator > > > const&, unsigned long, int)
()
#22 0x000055555560cd55 in BestResponse::chanceBestReponse(std::shared_ptr, int, std::vector<std::vector<float, std::allocator >, std::allocator<std::vector<float, std::allocator > > > const&, unsigned long, int) [clone ._omp_fn.0] ()
#23 0x00007ffff7c4a78e in ?? () from /lib/x86_64-linux-gnu/libgomp.so.1
#24 0x00007ffff7bfb609 in start_thread (arg=) at pthread_create.c:477
#25 0x00007ffff7b22293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
(gdb)

@bupticybee
Copy link
Owner

The problem is most likely related with OPENMP. In the readme file I provided a sample google colab to show how to compile from scratch

https://colab.research.google.com/drive/1NWDb53ypcKpkb3g3orzEBDeHAEkAIC7y

I suggest that:

  • check the version of your cmake, openmp,etc
  • check the colab file to find out exactly where is different between our compile process, I use that colab file to get the Linux release, so it works 100%
  • if both doesn't work, paste your full compile log

@ghost
Copy link
Author

ghost commented Aug 19, 2021

Discovered my error - when using it from the install directory it works fine, I was mistakenly using it from the build directory. Sorry for the error.

@ghost ghost closed this as completed Aug 19, 2021
This issue was closed.
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