1
thread #11: tid = 0x82c51, 0x30fc99f8 libsystem_c.dylib`flockfile, stop reason = EXC_BAD_ACCESS (code=1, address=0x38)
 frame #0: 0x30fc99f8 libsystem_c.dylib`flockfile
 frame #1: 0x30ffd690 libsystem_c.dylib`fseeko + 60
 frame #2: 0x00205310 `std::__1::basic_filebuf<char, std::__1::char_traits<char> >::seekoff(long long, std::__1::ios_base::seekdir, unsigned int) + 516
 frame #3: 0x001d8186 `log4cplus::RollingFileAppender::append(log4cplus::spi::InternalLoggingEvent const&) + 746
 frame #4: 0x001c0758 `log4cplus::Appender::doAppend(log4cplus::spi::InternalLoggingEvent const&) + 484
 frame #5: 0x001c232c `log4cplus::helpers::AppenderAttachableImpl::appendLoopOnAppenders(log4cplus::spi::InternalLoggingEvent const&) const + 336
 frame #6: 0x001eea3a `log4cplus::spi::LoggerImpl::callAppenders(log4cplus::spi::InternalLoggingEvent const&) + 138
 frame #7: 0x001eef9e `log4cplus::spi::LoggerImpl::forcedLog(log4cplus::spi::InternalLoggingEvent const&) + 26
 frame #8: 0x001ee200 `log4cplus::Logger::forcedLog(log4cplus::spi::InternalLoggingEvent const&) const + 28
 frame #9: 0x001f0b94 `log4cplus::detail::macro_forced_log(log4cplus::Logger const&, int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const*, int, char const*) + 160
  • Above is the log of log4cplus crash in ios App. I had set FileMaxSize = 500Kb and MaxBackUp = 5.
  • So, After 5 log File BackUp Taken & When for the 6th Time Going for BackUp Then its Crashing.
  • I had made a static Library in which I had made 8 Logger Instance & that All are dumping Log into Same Log File.
  • Used MultiThreading Environment
Vivek Aditya
  • 1,145
  • 17
  • 46
Nishant
  • 136
  • 12
  • 1
    This looks like the `FILE *` used by the `fstream`'s `filebuf` is `NULL`. I cannot see how that could happen, though. – wilx Sep 12 '15 at 20:38
  • @wilx as per my view, it is problem of Multi Threading Environment Lock Acquiring issue. – Nishant Sep 14 '15 at 07:24
  • Is it possible that you have not linked with equivalent of `-pthread` on MacOS X? – wilx Sep 14 '15 at 07:28
  • in log4cplus its Not Mentioned that i had to link -pthread. – Nishant Sep 14 '15 at 08:14
  • In theory, you should not need to do anything. However, I do not have a way of testing log4cplus on MacOS X. – wilx Sep 14 '15 at 08:18
  • Same Thing Works on Android.. Strange!!! However in .Properties File, i had Mentioned To Consider File Locking Mechanism. – Nishant Sep 14 '15 at 08:23
  • The file locking that log4cplus uses to lock the log files access should use separate "lock file." In any case, worst case, you should get a deadlock, not a NULL pointer dereference in C library. – wilx Sep 14 '15 at 12:26
  • @wilx: i had used https://github.com/log4cplus/log4cplus/blob/master/iOS/scripts/cmake_ios_armv7.sh script to build for ios. need Any Changes?? – Nishant Sep 15 '15 at 11:33
  • @wilx -DLOG4CPLUS_SINGLE_THREADED="TRUE" Macro Seems for Single Thread, Can i Get Macro for MultiThread. – Nishant Sep 15 '15 at 11:35
  • @wilx When MaxSize of a File Reached, Then File Pointer should Point to Another File to Write Log, This Works upto Max No of BackUp File Reached. After That File Pointer Points to the First File & Write Logs into it. as First File MaxSize Reached then File Pointer is Unable to Point to Second File as of BackUp Algorithm.. Hope You Got Exact Scenario.. – Nishant Sep 15 '15 at 11:43
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/89677/discussion-between-nishant-b9-and-wilx). – Nishant Sep 15 '15 at 11:57

0 Answers0