#community-help

Troubleshooting Typesense Binary Segmentation Fault on a Mac

TLDR Daniel sought help for a segmentation fault while using Typesense on a MacBook Air. Kishore Nallan guided them through the debugging process and suggested that it might be a compatibility issue with the Mac OS version. Daniel plans to try building Typesense on their own.

Powered by Struct AI
Jun 10, 2021 (30 months ago)
Daniel
Photo of md5-a95c873d292f586581d5716882ae24b5
Daniel
02:19 PM
Hey guys, probably a noob question but I’m trying to run the typesense binary on mac and keep getting a segmentation fault… do you have any ideas how I can debug this or figure out what’s going on?

[1]    42001 segmentation fault  ./typesense-server --data-dir=/tmp/typesense-data --api-key=xyz
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
02:19 PM
Can you please tell me what version of Typesense you are running? Also, are you on the M1 mac?
Daniel
Photo of md5-a95c873d292f586581d5716882ae24b5
Daniel
02:20 PM
typesense-server-0.20.0-darwin-amd64.tar.gz
02:21
Daniel
02:21 PM
It’s a MacBook Air (Retina, 13-inch, 2019)
1.6 GHz Dual-Core Intel Core i5
8 GB 2133 MHz LPDDR3
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
02:23 PM
I just downloaded the binary and ran it on my mac, and it is running fine. We have also not received a report on this issue given that 0.20 has been out for a few weeks now.. So I wonder what's happening.
Daniel
Photo of md5-a95c873d292f586581d5716882ae24b5
Daniel
02:23 PM
Can I run it in verbose mode or output the error somehow?
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
02:23 PM
Is that all you get when you run it?
Daniel
Photo of md5-a95c873d292f586581d5716882ae24b5
Daniel
02:24 PM
Yes, I just download the binary and used tar to unzip it. It just prints out that single line.
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
02:25 PM
Can you do this:

md5sum typesense-server

The sum should be a7cc212256a076fc6b9ddbb32351b3d8
Daniel
Photo of md5-a95c873d292f586581d5716882ae24b5
Daniel
02:26 PM
MD5 (typesense-server) = a7cc212256a076fc6b9ddbb32351b3d8
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
02:26 PM
Yeah that matches. :thinking_face: What version of Mac OS are you on?
Daniel
Photo of md5-a95c873d292f586581d5716882ae24b5
Daniel
02:27 PM
macOS Catalina: version 10.15.7 (19H1030)
02:28
Daniel
02:28 PM
Let me try run it on my Big Sur mac…
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
02:28 PM
The only way to troubleshoot this will be to enable core dump and debug that, as per https://stackoverflow.com/q/9412156/131050
Daniel
Photo of md5-a95c873d292f586581d5716882ae24b5
Daniel
02:41 PM
It seems to run on my mac with Big Sur
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
02:43 PM
Oh I see. The build itself is created on Big Sur, so I wonder if it is a compatibility issue with older versions. Very difficult to handle this given the ever moving OS versions.
Daniel
Photo of md5-a95c873d292f586581d5716882ae24b5
Daniel
02:48 PM
Ok no problem, I’ll try build it myself later and see if that helps.
02:50
Daniel
02:50 PM
This is all I was able to get from the core-dump… not sure if it’s useful. I haven’t used c++ in a long time so not really sure what else I could try.

(lldb) bt 150
* thread #1, stop reason = signal SIGSTOP
  * frame #0: 0x00000001049a46a5 typesense-server`std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__is_long() const + 21
    frame #1: 0x00000001049a3e2c typesense-server`std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::size() const + 28
    frame #2: 0x000000010499a435 typesense-server`std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::empty() const + 21
    frame #3: 0x000000010499b1fc typesense-server`google::LogMessage::Init(char const*, int, int, void (google::LogMessage::*)()) + 1884
    frame #4: 0x000000010499aa76 typesense-server`google::LogMessage::LogMessage(char const*, int, int, int, void (google::LogMessage::*)()) + 102
    frame #5: 0x000000010499d768 typesense-server`google::ErrnoLogMessage::ErrnoLogMessage(char const*, int, int, int, void (google::LogMessage::*)()) + 104
    frame #6: 0x000000010499d7d8 typesense-server`google::ErrnoLogMessage::ErrnoLogMessage(char const*, int, int, int, void (google::LogMessage::*)()) + 104
    frame #7: 0x0000000104321690 typesense-server`bvar::ProcIOReader::operator()(bvar::ProcIO*) const + 208
    frame #8: 0x000000010432154c typesense-server`bvar::ProcIO const& bvar::CachedReader<bvar::ProcIO>::get_value<bvar::ProcIOReader>(bvar::ProcIOReader const&) + 156
    frame #9: 0x000000010431c911 typesense-server`unsigned long bvar::ProcIOReader::get_field<unsigned long, 0ul>(void*) + 17
    frame #10: 0x0000000104322ccc typesense-server`bvar::detail::ReducerSampler<bvar::PassiveStatus<long>, long, bvar::detail::AddTo<long>, bvar::detail::MinusFrom<long> >::take_sample() + 300
    frame #11: 0x0000000104350305 typesense-server`bvar::detail::ReducerSampler<bvar::PassiveStatus<unsigned long>, unsigned long, bvar::detail::AddTo<unsigned long>, bvar::detail::MinusFrom<unsigned long> >::ReducerSampler(bvar::PassiveStatus<unsigned long>*) + 85
    frame #12: 0x0000000104350033 typesense-server`bvar::detail::WindowBase<bvar::PassiveStatus<unsigned long>, (bvar::SeriesFrequency)1>::WindowBase(bvar::PassiveStatus<unsigned long>*, long) + 115
    frame #13: 0x000000010431c204 typesense-server`bvar::PerSecond<bvar::PassiveStatus<unsigned long> >::PerSecond(butil::BasicStringPiece<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > const&, bvar::PassiveStatus<unsigned long>*) + 36
    frame #14: 0x0000000104323543 typesense-server`_GLOBAL__sub_I_default_variables.cpp + 1763
    frame #15: 0x000000010c47f1d3 dyld`ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) + 535
    frame #16: 0x000000010c47f5de dyld`ImageLoaderMachO::doInitialization(ImageLoader::LinkContext const&) + 40
    frame #17: 0x000000010c479ffb dyld`ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, char const*, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) + 493
    frame #18: 0x000000010c4780b4 dyld`ImageLoader::processInitializers(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) + 188
    frame #19: 0x000000010c478154 dyld`ImageLoader::runInitializers(ImageLoader::LinkContext const&, ImageLoader::InitializerTimingList&) + 82
    frame #20: 0x000000010c4666a8 dyld`dyld::initializeMainExecutable() + 199
    frame #21: 0x000000010c46bbba dyld`dyld::_main(macho_header const*, unsigned long, int, char const**, char const**, char const**, unsigned long*) + 6667
    frame #22: 0x000000010c465227 dyld`dyldbootstrap::start(dyld3::MachOLoaded const*, int, char const**, dyld3::MachOLoaded const*, unsigned long*) + 453
    frame #23: 0x000000010c465025 dyld`_dyld_start + 37

02:51
Daniel
02:51 PM
Thanks for the help anyway!
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
03:05 PM
You're welcome! Thanks for the trace -- I will take a look to see if I can do something.