Solved the issue the brute force way. Came up with a trivial application using the existing CMake files. Once it crashed I backed out libraries until it did not. Turns out it was gperftools and tcmalloc.
On Thu, Oct 28, 2021 at 2:48 PM Robert Middleton <[email protected]> wrote: > I don't know how the loader works on OSX, but that seems somewhat > unlikely to me - either it should be complaining that the APR library > doesn't exist, or something related to APR should be in the stack > trace. > > Unfortunately at this moment I'm just guessing wildly as to what the > issue may be. Without a reproducible setup there's only a limited > amount that I can do to help. > > -Robert Middleton > > > On Thu, Oct 28, 2021 at 9:46 AM Bob Kirnum <[email protected]> wrote: > > > > The example applications (at least trivial and console) run fine so > dynamic > > loading alone is not an issue (there are no static libs built). I do see > > that we only reference the liblog4cxx library in our makefile while the > > examples also reference the apr / apu libraries. Perhaps we need to > tweak > > our makefiles? > > > > From your liblog4cxx.pc.in . . . > > > > << > > Libs: -L${libdir} -llog4cxx > > Cflags: -I${includedir} > > Requires.private: apr-1 apr-util-1 > > >> > > > > On Thu, Oct 28, 2021 at 9:29 AM Robert Middleton <[email protected]> > > wrote: > > > > > As far as I'm aware, the unit tests do use the dynamic library. > > > Looking at the stacktrace, I would expect the '--version' argument to > > > not work, since it seems to be happening before main() - my suspicion > > > is that your code has another static initialization(unrelated to > > > log4cxx) someplace, that is messing with memory. > > > > > > I'm not sure how much you know about the startup sequence, so here's a > > > quick overview. > > > When a C++ application starts up, it is going to run through all of > > > the static constructors. Log4cxx has a lot of these in it. So if > > > your code looks like this: > > > > > > static log4cxx::Logger logger = log4cxx::LogManager::getLogger( "foo" > ); > > > int main(){ > > > return 0; > > > } > > > > > > the constructor for 'logger' happens before main is run. In this > > > particular case, it seems that the classnamepatternconverter is trying > > > to register with the Log4cxx core, so that log4cxx will know how to > > > load the class. Perhaps it loads them in alphabetical order? > > > > > > This SO post may provide some insight: > > > > > > > https://stackoverflow.com/questions/335369/finding-c-static-initialization-order-problems > > > > > > -Robert Middleton > > > > > > On Thu, Oct 28, 2021 at 7:18 AM Bob Kirnum <[email protected]> wrote: > > > > > > > > Hey Robert, > > > > > > > > I agree that the socket issue is most likely unrelated. I'll try to > look > > > > at this. > > > > > > > > I just noticed that our application supports '--version' which simply > > > > prints the version and exits. Even using this results in the same > > > segfault > > > > so it seems the issue is more related to dynamic loading of the > log4cxx > > > > library. Anyway, below is the initialization our code has been using > > > for a > > > > while now. Have not seen such a crash until now using Monterey. I > see > > > no > > > > reference to our code in the back trace, just the dynamic library > > > loading. > > > > Do the unit tests also use the dynamic library? > > > > > > > > Thanks, > > > > Bob > > > > > > > > << > > > > int main(int argc, char* argv[]) { > > > > IGNORE_WARNINGS_ASIO; > > > > if (2 == argc && 0 == strcmp("--version", argv[1])) { > > > > printVersion(); > > > > return 0; > > > > } else if (3 != argc) { > > > > printUsage(); > > > > return 1; > > > > } > > > > > > > > std::string logging_property_file(argv[2]); > > > > > > > > if (stringEndsWith(logging_property_file, ".xml")) { > > > > > > > > log4cxx::xml::DOMConfigurator::configure(logging_property_file.c_str()); > > > > } else { > > > > PropertyConfigurator::configure(logging_property_file.c_str()); > > > > } > > > > >> > > > > > > > > On Wed, Oct 27, 2021 at 4:15 PM Robert Middleton < > [email protected]> > > > > wrote: > > > > > > > > > The 'socketservertestcase' is probably not related to the issue at > > > > > all, but I've said that before about plenty of things and been > wrong, > > > > > so I would recommend that you look into the reason that's failing > > > > > first. You may need to run the test manually in order to get more > > > > > useful output information. (maybe you don't have Java installed?) > > > > > > > > > > Otherwise since it looks like the crash is happening early in > > > > > startup(before main), my best guess is that there is something in > your > > > > > code that is messing with the startup sequence - overwriting memory > > > > > someplace? If it was a problem with log4cxx directly, I would > expect > > > > > that all of the tests would fail with the same error. > > > > > > > > > > -Robert Middleton > > > > > > > > > > On Wed, Oct 27, 2021 at 2:38 PM Matt Sicker <[email protected]> > wrote: > > > > > > > > > > > > Could this be a firewall configuration issue? > > > > > > > > > > > > Matt Sicker > > > > > > > > > > > > > On Oct 27, 2021, at 11:52, Bob Kirnum <[email protected]> > wrote: > > > > > > > > > > > > > > I am concerned that something may have changed on my system > not > > > > > directly > > > > > > > related to the Monterey upgrade. We normally just use the > dynamic > > > > > library, > > > > > > > I only built it now in order to help debug the issue. I was > > > getting > > > > > the > > > > > > > same segmentation fault prior to building from source. > > > > > > > > > > > > > > Just ran the unit tests, all but one passes. > > > > > > > > > > > > > > make test > > > > > > > Running tests... > > > > > > > Test project > /Users/bkirnum/Documents/GitHub/logging-log4cxx/build > > > > > > > Start 1: asyncappendertestcase > > > > > > > 1/62 Test #1: asyncappendertestcase .................. > Passed > > > > > 23.82 > > > > > > > sec > > > > > > > Start 2: consoleappendertestcase > > > > > > > 2/62 Test #2: consoleappendertestcase ................ > Passed > > > > > 0.08 > > > > > > > sec > > > > > > > Start 3: decodingtest > > > > > > > 3/62 Test #3: decodingtest ........................... > Passed > > > > > 0.08 > > > > > > > sec > > > > > > > Start 4: encodingtest > > > > > > > 4/62 Test #4: encodingtest ........................... > Passed > > > > > 0.08 > > > > > > > sec > > > > > > > Start 5: fileappendertest > > > > > > > 5/62 Test #5: fileappendertest ....................... > Passed > > > > > 0.08 > > > > > > > sec > > > > > > > Start 6: filetestcase > > > > > > > 6/62 Test #6: filetestcase ........................... > Passed > > > > > 0.08 > > > > > > > sec > > > > > > > Start 7: hierarchytest > > > > > > > 7/62 Test #7: hierarchytest .......................... > Passed > > > > > 0.07 > > > > > > > sec > > > > > > > Start 8: hierarchythresholdtestcase > > > > > > > 8/62 Test #8: hierarchythresholdtestcase ............. > Passed > > > > > 0.09 > > > > > > > sec > > > > > > > Start 9: jsonlayouttest > > > > > > > 9/62 Test #9: jsonlayouttest ......................... > Passed > > > > > 0.10 > > > > > > > sec > > > > > > > Start 10: l7dtestcase > > > > > > > 10/62 Test #10: l7dtestcase ............................ > Passed > > > > > 0.08 > > > > > > > sec > > > > > > > Start 11: leveltestcase > > > > > > > 11/62 Test #11: leveltestcase .......................... > Passed > > > > > 0.07 > > > > > > > sec > > > > > > > Start 12: loggertestcase > > > > > > > 12/62 Test #12: loggertestcase ......................... > Passed > > > > > 0.19 > > > > > > > sec > > > > > > > Start 13: mdctestcase > > > > > > > 13/62 Test #13: mdctestcase ............................ > Passed > > > > > 0.08 > > > > > > > sec > > > > > > > Start 14: minimumtestcase > > > > > > > 14/62 Test #14: minimumtestcase ........................ > Passed > > > > > 0.10 > > > > > > > sec > > > > > > > Start 15: ndctestcase > > > > > > > 15/62 Test #15: ndctestcase ............................ > Passed > > > > > 0.08 > > > > > > > sec > > > > > > > Start 16: patternlayouttest > > > > > > > 16/62 Test #16: patternlayouttest ...................... > Passed > > > > > 0.14 > > > > > > > sec > > > > > > > Start 17: propertyconfiguratortest > > > > > > > 17/62 Test #17: propertyconfiguratortest ............... > Passed > > > > > 0.28 > > > > > > > sec > > > > > > > Start 18: rollingfileappendertestcase > > > > > > > 18/62 Test #18: rollingfileappendertestcase ............ > Passed > > > > > 0.10 > > > > > > > sec > > > > > > > Start 19: streamtestcase > > > > > > > 19/62 Test #19: streamtestcase ......................... > Passed > > > > > 2.32 > > > > > > > sec > > > > > > > Start 20: multithreadtest > > > > > > > 20/62 Test #20: multithreadtest ........................ > Passed > > > > > 0.26 > > > > > > > sec > > > > > > > Start 21: absolutetimedateformattestcase > > > > > > > 21/62 Test #21: absolutetimedateformattestcase ......... > Passed > > > > > 0.07 > > > > > > > sec > > > > > > > Start 22: cacheddateformattestcase > > > > > > > 22/62 Test #22: cacheddateformattestcase ............... > Passed > > > > > 0.08 > > > > > > > sec > > > > > > > Start 23: casttestcase > > > > > > > 23/62 Test #23: casttestcase ........................... > Passed > > > > > 0.07 > > > > > > > sec > > > > > > > Start 24: charsetdecodertestcase > > > > > > > 24/62 Test #24: charsetdecodertestcase ................. > Passed > > > > > 0.07 > > > > > > > sec > > > > > > > Start 25: charsetencodertestcase > > > > > > > 25/62 Test #25: charsetencodertestcase ................. > Passed > > > > > 0.20 > > > > > > > sec > > > > > > > Start 26: cyclicbuffertestcase > > > > > > > 26/62 Test #26: cyclicbuffertestcase ................... > Passed > > > > > 0.12 > > > > > > > sec > > > > > > > Start 27: datetimedateformattestcase > > > > > > > 27/62 Test #27: datetimedateformattestcase ............. > Passed > > > > > 0.16 > > > > > > > sec > > > > > > > Start 28: filewatchdogtest > > > > > > > 28/62 Test #28: filewatchdogtest ....................... > Passed > > > > > 0.13 > > > > > > > sec > > > > > > > Start 29: inetaddresstestcase > > > > > > > 29/62 Test #29: inetaddresstestcase .................... > Passed > > > > > 0.13 > > > > > > > sec > > > > > > > Start 30: iso8601dateformattestcase > > > > > > > 30/62 Test #30: iso8601dateformattestcase .............. > Passed > > > > > 0.08 > > > > > > > sec > > > > > > > Start 31: messagebuffertest > > > > > > > 31/62 Test #31: messagebuffertest ...................... > Passed > > > > > 0.08 > > > > > > > sec > > > > > > > Start 32: optionconvertertestcase > > > > > > > 32/62 Test #32: optionconvertertestcase ................ > Passed > > > > > 0.10 > > > > > > > sec > > > > > > > Start 33: propertiestestcase > > > > > > > 33/62 Test #33: propertiestestcase ..................... > Passed > > > > > 0.15 > > > > > > > sec > > > > > > > Start 34: relativetimedateformattestcase > > > > > > > 34/62 Test #34: relativetimedateformattestcase ......... > Passed > > > > > 0.07 > > > > > > > sec > > > > > > > Start 35: stringhelpertestcase > > > > > > > 35/62 Test #35: stringhelpertestcase ................... > Passed > > > > > 0.08 > > > > > > > sec > > > > > > > Start 36: stringtokenizertestcase > > > > > > > 36/62 Test #36: stringtokenizertestcase ................ > Passed > > > > > 0.07 > > > > > > > sec > > > > > > > Start 37: syslogwritertest > > > > > > > 37/62 Test #37: syslogwritertest ....................... > Passed > > > > > 0.11 > > > > > > > sec > > > > > > > Start 38: timezonetestcase > > > > > > > 38/62 Test #38: timezonetestcase ....................... > Passed > > > > > 0.08 > > > > > > > sec > > > > > > > Start 39: transcodertestcase > > > > > > > 39/62 Test #39: transcodertestcase ..................... > Passed > > > > > 0.08 > > > > > > > sec > > > > > > > Start 40: threadutilitytestcase > > > > > > > 40/62 Test #40: threadutilitytestcase .................. > Passed > > > > > 0.08 > > > > > > > sec > > > > > > > Start 41: xloggertestcase > > > > > > > 41/62 Test #41: xloggertestcase ........................ > Passed > > > > > 0.09 > > > > > > > sec > > > > > > > Start 42: defaultinittestcase > > > > > > > 42/62 Test #42: defaultinittestcase .................... > Passed > > > > > 0.10 > > > > > > > sec > > > > > > > Start 43: filtertests > > > > > > > 43/62 Test #43: filtertests ............................ > Passed > > > > > 0.10 > > > > > > > sec > > > > > > > Start 44: socketappendertestcase > > > > > > > 44/62 Test #44: socketappendertestcase ................. > Passed > > > > > 0.08 > > > > > > > sec > > > > > > > Start 45: sockethubappendertestcase > > > > > > > 45/62 Test #45: sockethubappendertestcase .............. > Passed > > > > > 2.08 > > > > > > > sec > > > > > > > Start 46: syslogappendertestcase > > > > > > > 46/62 Test #46: syslogappendertestcase ................. > Passed > > > > > 0.08 > > > > > > > sec > > > > > > > Start 47: telnetappendertestcase > > > > > > > 47/62 Test #47: telnetappendertestcase ................. > Passed > > > > > 2.08 > > > > > > > sec > > > > > > > Start 48: xmlsocketappendertestcase > > > > > > > 48/62 Test #48: xmlsocketappendertestcase .............. > Passed > > > > > 0.08 > > > > > > > sec > > > > > > > Start 49: socketservertestcase > > > > > > > 49/62 Test #49: socketservertestcase > ...................***Failed > > > > > 13.20 > > > > > > > sec > > > > > > > Start 50: patternparsertestcase > > > > > > > 50/62 Test #50: patternparsertestcase .................. > Passed > > > > > 0.09 > > > > > > > sec > > > > > > > Start 51: filenamepatterntestcase > > > > > > > 51/62 Test #51: filenamepatterntestcase ................ > Passed > > > > > 0.08 > > > > > > > sec > > > > > > > Start 52: filterbasedrollingtest > > > > > > > 52/62 Test #52: filterbasedrollingtest ................. > Passed > > > > > 0.10 > > > > > > > sec > > > > > > > Start 53: manualrollingtest > > > > > > > 53/62 Test #53: manualrollingtest ...................... > Passed > > > > > 0.09 > > > > > > > sec > > > > > > > Start 54: obsoletedailyrollingfileappendertest > > > > > > > 54/62 Test #54: obsoletedailyrollingfileappendertest ... > Passed > > > > > 5.19 > > > > > > > sec > > > > > > > Start 55: obsoleterollingfileappendertest > > > > > > > 55/62 Test #55: obsoleterollingfileappendertest ........ > Passed > > > > > 5.20 > > > > > > > sec > > > > > > > Start 56: sizebasedrollingtest > > > > > > > 56/62 Test #56: sizebasedrollingtest ................... > Passed > > > > > 0.14 > > > > > > > sec > > > > > > > Start 57: timebasedrollingtest > > > > > > > 57/62 Test #57: timebasedrollingtest ................... > Passed > > > > > 27.70 > > > > > > > sec > > > > > > > Start 58: spitestcase > > > > > > > 58/62 Test #58: spitestcase ............................ > Passed > > > > > 0.09 > > > > > > > sec > > > > > > > Start 59: errorhandlertestcase > > > > > > > 59/62 Test #59: errorhandlertestcase ................... > Passed > > > > > 0.09 > > > > > > > sec > > > > > > > Start 60: levelmatchfiltertestcase > > > > > > > 60/62 Test #60: levelmatchfiltertestcase ............... > Passed > > > > > 0.09 > > > > > > > sec > > > > > > > Start 61: levelrangefiltertestcase > > > > > > > 61/62 Test #61: levelrangefiltertestcase ............... > Passed > > > > > 0.09 > > > > > > > sec > > > > > > > Start 62: xmltests > > > > > > > 62/62 Test #62: xmltests ............................... > Passed > > > > > 0.14 > > > > > > > sec > > > > > > > > > > > > > > 98% tests passed, 1 tests failed out of 62 > > > > > > > > > > > > > > Total Test time (real) = 87.22 sec > > > > > > > > > > > > > > The following tests FAILED: > > > > > > > 49 - socketservertestcase (Failed) > > > > > > > Errors while running CTest > > > > > > > Output from these tests are in: > > > > > > > > > > > > > > > > /Users/bkirnum/Documents/GitHub/logging-log4cxx/build/Testing/Temporary/LastTest.log > > > > > > > Use "--rerun-failed --output-on-failure" to re-run the failed > cases > > > > > > > verbosely. > > > > > > > make: *** [test] Error 8 > > > > > > > > > > > > > >> On Wed, Oct 27, 2021 at 12:35 PM Robert Middleton < > > > > > [email protected]> > > > > > > >> wrote: > > > > > > >> > > > > > > >> Bob, > > > > > > >> > > > > > > >> I don't use MacOS, so I don't know why that would happen. > Builds > > > on > > > > > > >> MacOS through github actions are ok(but that is using 10.15). > > > > > > >> Assuming that your stack trace is correct, it's complaining > about > > > line > > > > > > >> 159 in class.cpp, which is just 'return true'. > > > > > > >> > > > > > > >> Are you able to run the unit tests at all? > > > > > > >> > > > > > > >> -Robert Middleton > > > > > > >> > > > > > > >>> On Wed, Oct 27, 2021 at 11:49 AM Bob Kirnum < > [email protected]> > > > > > wrote: > > > > > > >>> > > > > > > >>> Running application dynamically linked with log4cxx started > > > crashing > > > > > > >> after > > > > > > >>> upgrading MacOs to Monterey. I tried building a debug > version > > > from > > > > > > >> source > > > > > > >>> but get the same error. Back trace shown below. Looks like > > > > > something is > > > > > > >>> missing in the environment but there are no cmake or build > > > errors. > > > > > Any > > > > > > >>> suggestions? I'd rather not have to downgrade back to Big > Sur > > > as it > > > > > > >> would > > > > > > >>> require erasing my MacBook. > > > > > > >>> > > > > > > >>> > > > > > > >>> (lldb) bt > > > > > > >>> * thread #1, stop reason = signal SIGSTOP > > > > > > >>> * frame #0: 0x0000000000000000 > > > > > > >>> frame #1: 0x0000000113f3bd4d > > > > > > >>> > > > > > > >> > > > > > > > > > liblog4cxx.12.dylib`log4cxx::helpers::Class::registerClass(newClass=0x00000001140db358) > > > > > > >>> at class.cpp:159:2 > > > > > > >>> frame #2: 0x0000000113f4034b > > > > > > >>> > > > > > > >> > > > > > > > > > liblog4cxx.12.dylib`log4cxx::helpers::ClassRegistration::ClassRegistration(this=0x00000001140db368, > > > > > > >>> > > > > > > >> > > > > > > > > > accessor=(liblog4cxx.12.dylib`log4cxx::pattern::ClassNamePatternConverter::getStaticClass() > > > > > > >>> at classnamepatternconverter.cpp:32))()) at > > > > > classregistration.cpp:26:2 > > > > > > >>> frame #3: 0x0000000113f4037d > > > > > > >>> > > > > > > >> > > > > > > > > > liblog4cxx.12.dylib`log4cxx::helpers::ClassRegistration::ClassRegistration(this=0x00000001140db368, > > > > > > >>> > > > > > > >> > > > > > > > > > accessor=(liblog4cxx.12.dylib`log4cxx::pattern::ClassNamePatternConverter::getStaticClass() > > > > > > >>> at classnamepatternconverter.cpp:32))()) at > > > > > classregistration.cpp:25:1 > > > > > > >>> frame #4: 0x0000000113f3e83d > > > > > > >>> > > > > > > >> > > > > > > > > > liblog4cxx.12.dylib`log4cxx::pattern::ClassNamePatternConverter::registerClass() > > > > > > >>> at classnamepatternconverter.cpp:32:1 > > > > > > >>> frame #5: 0x0000000113f40309 > > > > > > >>> liblog4cxx.12.dylib`::__cxx_global_var_init() at > > > > > > >>> classnamepatternconverter.cpp:32:1 > > > > > > >>> frame #6: 0x0000000113f40329 > > > > > > >>> > liblog4cxx.12.dylib`_GLOBAL__sub_I_classnamepatternconverter.cpp > > > at > > > > > > >>> classnamepatternconverter.cpp:0 > > > > > > >>> frame #7: 0x000000011e9e2b49 dyld`invocation function for > > > block in > > > > > > >>> > dyld4::Loader::findAndRunAllInitializers(dyld4::RuntimeState&) > > > const > > > > > + > > > > > > >> 182 > > > > > > >>> frame #8: 0x000000011ea0929b dyld`invocation function for > > > block in > > > > > > >>> dyld3::MachOAnalyzer::forEachInitializer(Diagnostics&, > > > > > > >>> dyld3::MachOAnalyzer::VMAddrConverter const&, void (unsigned > int) > > > > > > >>> block_pointer, void const*) const + 242 > > > > > > >>> frame #9: 0x000000011ea00893 dyld`invocation function for > > > block in > > > > > > >>> dyld3::MachOFile::forEachSection(void > > > (dyld3::MachOFile::SectionInfo > > > > > > >>> const&, bool, bool&) block_pointer) const + 566 > > > > > > >>> frame #10: 0x000000011e9cfd91 > > > > > > >>> dyld`dyld3::MachOFile::forEachLoadCommand(Diagnostics&, void > > > > > > >> (load_command > > > > > > >>> const*, bool&) block_pointer) const + 129 > > > > > > >>> frame #11: 0x000000011ea0061b > > > > > > >>> dyld`dyld3::MachOFile::forEachSection(void > > > > > (dyld3::MachOFile::SectionInfo > > > > > > >>> const&, bool, bool&) block_pointer) const + 179 > > > > > > >>> frame #12: 0x000000011ea08df2 > > > > > > >>> dyld`dyld3::MachOAnalyzer::forEachInitializer(Diagnostics&, > > > > > > >>> dyld3::MachOAnalyzer::VMAddrConverter const&, void (unsigned > int) > > > > > > >>> block_pointer, void const*) const + 466 > > > > > > >>> frame #13: 0x000000011e9e2a7c > > > > > > >>> > > > dyld`dyld4::Loader::findAndRunAllInitializers(dyld4::RuntimeState&) > > > > > > >> const + > > > > > > >>> 144 > > > > > > >>> frame #14: 0x000000011e9e2c08 > > > > > > >>> > dyld`dyld4::Loader::runInitializersBottomUp(dyld4::RuntimeState&, > > > > > > >>> dyld3::Array<dyld4::Loader const*>&) const + 178 > > > > > > >>> frame #15: 0x000000011e9e2beb > > > > > > >>> > dyld`dyld4::Loader::runInitializersBottomUp(dyld4::RuntimeState&, > > > > > > >>> dyld3::Array<dyld4::Loader const*>&) const + 149 > > > > > > >>> frame #16: 0x000000011e9e2cac > > > > > > >>> > > > > > > >> > > > > > > > > > dyld`dyld4::Loader::runInitializersBottomUpPlusUpwardLinks(dyld4::RuntimeState&) > > > > > > >>> const + 108 > > > > > > >>> frame #17: 0x000000011e9f632e > > > > > > >>> dyld`dyld4::APIs::runAllInitializersForMain() + 222 > > > > > > >>> frame #18: 0x000000011e9d4358 > > > dyld`dyld4::prepare(dyld4::APIs&, > > > > > > >>> dyld3::MachOAnalyzer const*) + 3438 > > > > > > >>> frame #19: 0x000000011e9d34b4 dyld`start + 388 > > > > > > >> > > > > > > > > >
