Qihoo360/logkafka

add new line to log file, Segmentation fault

jarlyn95 opened this issue · 20 comments

#0 0x00007fff90ef445c in pthread_mutex_lock () from /usr/lib/system/libsystem_pthread.dylib
#1 0x000000010003a912 in base::Mutex::lock() ()
#2 0x000000010003a8dc in base::ScopedLock::ScopedLock(base::Mutex&) ()
#3 0x000000010003a232 in base::ScopedLock::ScopedLock(base::Mutex&) ()
#4 0x00000001001092aa in logkafka::TailWatcher::isActive (this=0x0) at /Users/datasci/develop/logkafka/src/logkafka/tail_watcher.cc:307
#5 0x000000010007715c in logkafka::Manager::updateWatcherRotate (manager=0x10060c490, path_pattern=..., path=..., position_entry=0x102800100) at /Users/datasci/develop/logkafka/src/logkafka/manager.cc:770
#6 0x00000001001087b8 in logkafka::TailWatcher::onRotate (arg=0x1028007e0, file=0x7fff751e0808) at /Users/datasci/develop/logkafka/src/logkafka/tail_watcher.cc:247
#7 0x00000001001048e8 in logkafka::RotateHandler::onNotify (arg=0x100303f50) at /Users/datasci/develop/logkafka/src/logkafka/rotate_handler.cc:83
#8 0x000000010010736d in logkafka::TailWatcher::onNotify (arg=0x1028007e0) at /Users/datasci/develop/logkafka/src/logkafka/tail_watcher.cc:141
#9 0x00000001001284ad in base::TimerWatcher::cb_func (w=0x1003040f0) at /Users/datasci/develop/logkafka/src/base/timer_watcher.cc:64
#10 0x0000000100171d15 in uv__run_timers (loop=0x10100a400) at src/unix/timer.c:165
#11 0x00000001001661a3 in uv_run (loop=0x10100a400, mode=UV_RUN_DEFAULT) at src/unix/core.c:319
#12 0x000000010003eb0c in logkafka::LogKafka::start (this=0x10060c220) at /Users/datasci/develop/logkafka/src/logkafka/logkafka.cc:91
#13 0x000000010003fa25 in run (option=...) at /Users/datasci/develop/logkafka/src/logkafka/main.cc:130
#14 0x000000010003ef8c in main (argc=5, argv=0x7fff5fbff880) at /Users/datasci/develop/logkafka/src/logkafka/main.cc:54

@iwenjun I will check for this as soon as possible :)

Did you update the code to the latest version and try ?

@zheolong yes. My computer is mac.

@zheolong your kafka version?

@iwenjun it's not a problem caused by the kafka version, you better try the linux system now :)

@zheolong I tried in ubuntu, the problem still exists.

@iwenjun Did you try to delete/modify the log config? What's the action which triggers this problem?

which file did mean?

@iwenjun You just run the program and do no other actions?

I appended new lines to the watching log file.
I desire to collect logs in realtime.

@iwenjun OK, let me test on my mac

Thank you.

@iwenjun It is ok on my mac, show me the 'cmake' command you use to compile

cmake -H. -B_build -DCMAKE_INSTALL_PREFIX=_install
-DINSTALL_LIBRDKAFKA=ON
-DINSTALL_LIBZOOKEEPER_MT=ON
-DINSTALL_LIBUV=ON
-DINSTALL_LIBPCRE2=ON

@iwenjun I use the same command, this command will generate the same executables

TailMap::iterator iter = (manager->m_tails).find(path);
the result: iter == manager->m_tails.end()

I solved it.
in void Manager::startWatchers(set paths) method, m_tails[path_pattern] = tw;
in bool Manager::updateWatcherRotate(Manager *manager,
string path_pattern,
string path,
PositionEntry *position_entry) method, TailMap::iterator iter
= (manager->m_tails).find(path_pattern);

@iwenjun Can you create a pull request?