cocodelabs / znc-palaver

ZNC module for push notifications
MIT License
112 stars 14 forks source link

znc crashing #31

Closed bastianh closed 8 years ago

bastianh commented 9 years ago

Hi, when I'm using the znc-palaver plugin znc is crashing short after the last client disconnected with message:

[2015-10-14 13:54:05.314408] (username/network) IRC -> ZNC [:Paul_Panzer[GREEN]!PaulPanzer@server.info PRIVMSG #lounge :fixed]
terminate called after throwing an instance of 'std::regex_error'
  what():  regex_error

Program received signal SIGABRT, Aborted.

the backtrace:

#0  0x00007ffff623dcc9 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1  0x00007ffff62410d8 in __GI_abort () at abort.c:89
#2  0x00007ffff6d66535 in __gnu_cxx::__verbose_terminate_handler() ()
   from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#3  0x00007ffff6d646d6 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#4  0x00007ffff6d64703 in std::terminate() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#5  0x00007ffff6d64922 in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#6  0x00007ffff6db6935 in std::__throw_regex_error(std::regex_constants::error_type) ()
   from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#7  0x00007ffff4513444 in std::__detail::_Scanner<__gnu_cxx::__normal_iterator<char const*, std::string> >::_M_eat_escape (this=0x7fffffffd088) at /usr/include/c++/4.8/bits/regex_compiler.h:467
#8  0x00007ffff45112d6 in std::__detail::_Scanner<__gnu_cxx::__normal_iterator<char const*, std::string> >::_M_advance (this=0x7fffffffd088) at /usr/include/c++/4.8/bits/regex_compiler.h:229
#9  0x00007ffff450ee33 in std::__detail::_Scanner<__gnu_cxx::__normal_iterator<char const*, std::string> >::_Scanner (this=0x7fffffffd088, __begin=..., __end=..., __flags=17, __loc=...)
    at /usr/include/c++/4.8/bits/regex_compiler.h:112
#10 0x00007ffff450a881 in std::__detail::_Compiler<__gnu_cxx::__normal_iterator<char const*, std::string>, std::regex_traits<char> >::_Compiler (this=0x7fffffffd080, __b=..., __e=..., __traits=...,
    __flags=17) at /usr/include/c++/4.8/bits/regex_compiler.h:722
#11 0x00007ffff45053f2 in std::__detail::__compile<__gnu_cxx::__normal_iterator<char const*, std::string>, std::regex_traits<char> > (__b=..., __e=..., __t=..., __f=17)
    at /usr/include/c++/4.8/bits/regex_compiler.h:1105
#12 0x00007ffff4500348 in std::basic_regex<char, std::regex_traits<char> >::basic_regex<std::char_traits<char>, std::allocator<char> > (this=0x7fffffffd2a0, __s=..., __f=17)
    at /usr/include/c++/4.8/bits/regex.h:444
#13 0x00007ffff44f5ae3 in CDevice::IncludesMentionKeyword (this=0xa423b0, sMessage=..., sNick=...)
    at palaver.cpp:489
#14 0x00007ffff44fb3f1 in CPalaverMod::ParseMessage (this=0xa3fd00, Nick=..., sMessage=...,
    pChannel=0xa48cf0) at palaver.cpp:1004
#15 0x00007ffff44fb5bc in CPalaverMod::OnChanMsg (this=0xa3fd00, Nick=..., Channel=..., sMessage=...)
    at palaver.cpp:1023
#16 0x00000000006b11cb in CModule::OnChanMessage (this=0xa3fd00, Message=...) at src/Modules.cpp:814
#17 0x00000000006c0341 in CModules::OnChanMessage (this=0xa22d60, Message=...) at src/Modules.cpp:1034
#18 0x00000000006749f0 in CIRCSock::OnTextMessage (this=0xa46210, Message=...) at src/IRCSock.cpp:1052
#19 0x000000000066a733 in CIRCSock::ReadLine (this=0xa46210, sData=...) at src/IRCSock.cpp:219
#20 0x00000000005e91f8 in Csock::PushBuff (this=0xa46210,
    data=0xa5bb60 ":Paul_Panzer[GREEN]!PaulPanzer@server.info PRIVMSG #lounge :fixed\r\n",
    len=71, bStartAtZero=false) at src/Csocket.cpp:2350
#21 0x00000000005ec8c2 in CSocketManager::Loop (this=0xa22a18) at src/Csocket.cpp:3404
#22 0x00000000005ecd5b in CSocketManager::DynamicSelectLoop (this=0xa22a18, iLowerBounds=100000,
    iUpperBounds=600000000, iMaxResolution=3600) at src/Csocket.cpp:3462
#23 0x0000000000602a13 in CZNC::Loop (this=0xa22940) at src/znc.cpp:239
#24 0x00000000005ccbfb in main (argc=2, argv=0x7fffffffe698) at src/main.cpp:410

I have tried znc 1.6.1 and current github master.

kylef commented 9 years ago

Hi @bastianh, sorry to hear about this problem.

Firstly, I've made changes in 1735071f3d6b2ae905caf7842df777a36096851c to prevent the crash and instead show regex used for matching and the underlying error code.

Would you be able to pull down these changes and run znc --debug and see what message you get when receiving a message?

Regards,

Kyle

bastianh commented 9 years ago

sure .. I only got the crash about once a day but I'll keep it running with debug enabled and check the log

bastianh commented 9 years ago

I found something in the logs

[2015-10-14 19:02:39.358315] (dafire/bastion) IRC -> ZNC [:Urist_Mcflyship[SRNE]!DirkJohnwood@thebastion.info PRIVMSG #lounge :it'll be 5 hours]
[2015-10-14 19:02:39.358447] Caught regex error '2' from '\.bLeebe\.[2BAD\._\.]\.b'.

I guess it's because this irc server uses/allows [ and ] in the nickname?

kylef commented 9 years ago

@bastianh These should be escaped correctly but looks like they're not. Could you let me know what your IRC nickname is, and which keywords you have configured for mentions in Palaver. One of them looks something like Leebe.[2BAD]. from this error message.

bastianh commented 9 years ago

the nick is Leebe[2BAD_] (no dots). it's assigned from the server based on the usergroup in that community. I have not configured any additional keywords. Thanks for your help.

kylef commented 8 years ago

Looks like older versions of GCC have some significant problems with regex. GCC 4.9 or later should solve most regex related problems. According to the GCC 4.9 release notes (https://gcc.gnu.org/gcc-4.9/changes.html).

I think you'll need to upgrade to a more modern compiler and rebuild ZNC, and the module with it.

kylef commented 8 years ago

I've added checks for when you build the module and mentioned this in the README now (https://github.com/cocodelabs/znc-palaver/commit/e9b61749e7d84c3672d7eba53eb94a0788c28d1d).