aatxe / awebot-plugins

A collection of plugins for awebot.
2 stars 0 forks source link

Call server.config() in plugin crash process. #1

Closed chtotut closed 9 years ago

chtotut commented 9 years ago

Try start awebot with quote plugin. Call server.config() from this srting crash process with Process didn't exit successfully:target/debug/awebot(signal: 4). In plugin did not work Server trait functions. Call server.config() from awebot work.

Rust version: rustc 1.0.0-nightly (083b8a404 2015-04-05) (built 2015-04-05)

aatxe commented 9 years ago

Do you have a proper config.json file in your working directory that has a nickname declared? If you don't, it will cause the program to panic because there's no nickname for the bot to identify with.

Here's an example config.json:

{
    "owners": ["awe"],
    "nickname": "awebot",
    "alt_nicks": ["awebot_"],
    "server": "irc.pdgn.co",
    "use_ssl": true,
    "channels": ["#pdgn"],
    "options": {}
}

You can find other options here. The only required options are the nickname and the server. Everything else has defaults.

chtotut commented 9 years ago

Yes I have, It will work if comment server.config() in plugin code.

aatxe commented 9 years ago

Can you get a backtrace with gdb or lldb?

chtotut commented 9 years ago

src/lib.rs:34:

let resp = if chan == server.config().nickname() {

sry, I did not use gdb before. Is this info need?:

...

:bf_tv!bf_tv@bf_tv.tmi.twitch.tv PRIVMSG #bf_tv :this_is_message
user: "bf_tv"
Ok

Program received signal SIGSEGV, Segmentation fault.
0x000055555559e5d0 in awebot::client::server::utils::ServerExt::send_ctcp<irc::client::server::IrcServer<std::io::buffered::BufReader<irc::client::conn::NetStream>, std::io::buffered::BufWriter<irc::client::conn::NetStream>>> (self=0x0, target=..., msg=...) at /home/g/.cargo/registry/src/github.com-1ecc6299db9ec823/irc-0.8.13/src/client/server/utils.rs:144
144         fn send_ctcp(&self, target: &str, msg: &str) -> Result<()> {
(gdb) backtrace
#0  0x000055555559e5d0 in awebot::client::server::utils::ServerExt::send_ctcp<irc::client::server::IrcServer<std::io::buffered::BufReader<irc::client::conn::NetStream>, std::io::buffered::BufWriter<irc::client::conn::NetStream>>> (self=0x0, target=..., msg=...) at /home/g/.cargo/registry/src/github.com-1ecc6299db9ec823/irc-0.8.13/src/client/server/utils.rs:144
#1  0x00007ffff527d0df in quote::process_internal<std::io::buffered::BufReader<irc::client::conn::NetStream>,std::io::buffered::BufWriter<irc::client::conn::NetStream>> (server=..., 
    message=0x7fffffffc690) at src/lib.rs:34
#2  0x00007ffff527cd8f in quote::process (server=..., message=...) at src/lib.rs:17
#3  0x000055555559cb8a in awebot::process_message_dynamic (server=..., message=..., cache=0x7fffffffd310) at src/main.rs:85
#4  0x0000555555573164 in awebot::main () at src/main.rs:37
#5  0x0000555555709209 in rust_try_inner ()
#6  0x00005555557091f6 in rust_try ()
#7  0x0000555555706d7f in rt::lang_start::ha69071984e32814cXOI ()
#8  0x0000555555573465 in main ()
(gdb) bt full
#0  0x000055555559e5d0 in awebot::client::server::utils::ServerExt::send_ctcp<irc::client::server::IrcServer<std::io::buffered::BufReader<irc::client::conn::NetStream>, std::io::buffered::BufW
riter<irc::client::conn::NetStream>>> (self=0x0, target=..., msg=...) at /home/g/.cargo/registry/src/github.com-1ecc6299db9ec823/irc-0.8.13/src/client/server/utils.rs:144
No locals.
#1  0x00007ffff527d0df in quote::process_internal<std::io::buffered::BufReader<irc::client::conn::NetStream>,std::io::buffered::BufWriter<irc::client::conn::NetStream>> (server=..., 
    message=0x7fffffffc690) at src/lib.rs:34
        resp = {data_ptr = 0x7ffff602e0e0 "this_is_message", length = 14}
        tokens = {ptr = {pointer = {0x5}, _marker = {<No data fields>}}, len = 5, cap = 140737488339512}
        message = {vec = {ptr = {pointer = {0x7ffff602e0d0 "this_is_message"}, _marker = {<No data fields>}}, len = 15, cap = 15}}
        chan = {vec = {ptr = {pointer = {0x7ffff60231f0 "#bf_tvt"}, _marker = {<No data fields>}}, len = 6, cap = 6}}
        user = {data_ptr = 0x7ffff602d360 "bf_tv!bf_tv@bf_tv.tmi.twitch.tv", length = 5}
#2  0x00007ffff527cd8f in quote::process (server=..., message=...) at src/lib.rs:17
No locals.
#3  0x000055555559cb8a in awebot::process_message_dynamic (server=..., message=..., cache=0x7fffffffd310) at src/main.rs:85
        path = {inner = {inner = {inner = {ptr = {pointer = {0x7ffff60271c0 "plugins/libquote-b8d5a210fa6a3c97.soVMSG #bf_tv :this_is_message"}, _marker = {<No data fields>}}, len = 36, 
                cap = 64}}}}
        modified = 1428270235448
        key = {vec = {ptr = {pointer = {0x7ffff60241e0 "plugins/libquote-b8d5a210fa6a3c97.so"}, _marker = {<No data fields>}}, len = 36, cap = 36}}
        path = {{RUST$ENUM$DISR = Ok, {{buf = {ptr = {pointer = {0x1d1d1d1d1d1d1d1d <error: Cannot access memory at address 0x1d1d1d1d1d1d1d1d>}, _marker = {<No data fields>}}, 
                  len = 2097865012304223517, cap = 2097865012304223517}, root = {_ptr = {0x1d1d1d1d1d1d1d1d}}}}}, {RUST$ENUM$DISR = Ok, {repr = {{RUST$ENUM$DISR = (Custom | unknown: 28), 
                  488447261}, {RUST$ENUM$DISR = (Custom | unknown: 28), 0x1d1d1d1d1d1d1d1d}}}}}
        iter = {cur = {RUST$ENCODED$ENUM$0$0$1$0$0$None = {{{dirp = {0x555555a5b560}, root = {_ptr = {0x7ffff6024180}}}}}}, stack = {ptr = {pointer = {0x1}, _marker = {<No data fields>}}, 
            len = 0, cap = 0}}
        result = 0
        valid = {0x555555738836 <str6166>, 0x5, 0x55555573883b <str6167>}
#4  0x0000555555573164 in awebot::main () at src/main.rs:37
        message = {prefix = {RUST$ENCODED$ENUM$0$0$0$0$0$None = {{vec = {ptr = {pointer = {0x1d1d1d1d1d1d1d1d <error: Cannot access memory at address 0x1d1d1d1d1d1d1d1d>}, 
                    _marker = {<No data fields>}}, len = 2097865012304223517, cap = 2097865012304223517}}}}, command = {vec = {ptr = {pointer = {
                  0x1d1d1d1d1d1d1d1d <error: Cannot access memory at address 0x1d1d1d1d1d1d1d1d>}, _marker = {<No data fields>}}, len = 2097865012304223517, cap = 2097865012304223517}}, 
          args = {ptr = {pointer = {0x1d1d1d1d1d1d1d1d}, _marker = {<No data fields>}}, len = 2097865012304223517, cap = 2097865012304223517}, suffix = {RUST$ENCODED$ENUM$0$0$0$0$0$None = {{
                vec = {ptr = {pointer = {0x1d1d1d1d1d1d1d1d <error: Cannot access memory at address 0x1d1d1d1d1d1d1d1d>}, _marker = {<No data fields>}}, len = 2097865012304223517, 
                  cap = 2097865012304223517}}}}}
        message = {{RUST$ENUM$DISR = Ok, {prefix = {RUST$ENCODED$ENUM$0$0$0$0$0$None = {{vec = {ptr = {pointer = {
                          0x1d1d1d1d1d1d1d1d <error: Cannot access memory at address 0x1d1d1d1d1d1d1d1d>}, _marker = {<No data fields>}}, len = 2097865012304223517, 
                      cap = 2097865012304223517}}}}, command = {vec = {ptr = {pointer = {0x1d1d1d1d1d1d1d1d <error: Cannot access memory at address 0x1d1d1d1d1d1d1d1d>}, 
                    _marker = {<No data fields>}}, len = 2097865012304223517, cap = 2097865012304223517}}, args = {ptr = {pointer = {0x1d1d1d1d1d1d1d1d}, _marker = {<No data fields>}}, 
                len = 2097865012304223517, cap = 2097865012304223517}, suffix = {RUST$ENCODED$ENUM$0$0$0$0$0$None = {{vec = {ptr = {pointer = {
                          0x1d1d1d1d1d1d1d1d <error: Cannot access memory at address 0x1d1d1d1d1d1d1d1d>}, _marker = {<No data fields>}}, len = 2097865012304223517, 
                      cap = 2097865012304223517}}}}}}, {RUST$ENUM$DISR = Ok, {repr = {{RUST$ENUM$DISR = (Custom | unknown: 28), 488447261}, {RUST$ENUM$DISR = (Custom | unknown: 28), 
                  0x1d1d1d1d1d1d1d1d}}}}}
---Type <return> to continue, or q <return> to quit---
        iter = {server = 0x7fffffffd5f0}
        result = 0
        cache = {hash_state = {k0 = 4949180865769828552, k1 = 15716507992583041326}, table = {capacity = 32, size = 1, hashes = {pointer = {0x7ffff6072000}, _marker = {<No data fields>}}, 
            marker = {<No data fields>}}, resize_policy = {<No data fields>}}
        server = {conn = {reader = {inner = 0x7ffff60240f0, data = {value = {inner = {{RUST$ENUM$DISR = UnsecuredTcpStream, {{inner = {{fd = 4}}}}}, {RUST$ENUM$DISR = UnsecuredTcpStream, {
                        stream = {{inner = {{fd = 212}}}}, ssl = {_ptr = {0x158}}, buf = {ptr = {pointer = {0x1d00000001 <error: Cannot access memory at address 0x1d00000001>}, 
                            _marker = {<No data fields>}}, len = 140737488338840, cap = 140737488339288}}}}, buf = {ptr = {pointer = {
                        0x7ffff6051000 ":bf_tv!bf_tv@bf_tv.tmi.twitch.tv PRIVMSG #bf_tv :this_is_message\r\nch.tv 353 bf_bot = #bf_bot :bf_bot\r\n:bf_bot.tmi.twitch.tv 366 bf_bot #bf_bot :End 
of /NAMES list\r\n :This server is rather new\r\n:tmi.tw"...}, _marker = {<No data fields>}}, len = 65536, cap = 65536}, pos = 66, cap = 66}}}, writer = {inner = 0x7ffff6024120, data = {
                value = {inner = {{RUST$ENUM$DISR = Some}, {RUST$ENUM$DISR = Some, {{RUST$ENUM$DISR = UnsecuredTcpStream, {{inner = {{fd = 3}}}}}, {RUST$ENUM$DISR = UnsecuredTcpStream, {
                            stream = {{inner = {{fd = 212}}}}, ssl = {_ptr = {0x7fffffffbc30}}, buf = {ptr = {pointer = {
                                  0x5555555f2e0d <irc::btree::node::Node<K, V>.Drop::drop+301> "H\211\205X\377\377\377H\213\205X\377\377\377H\213u\370H\211\006\351Z\377\377\377H\201İ"}, 
                                _marker = {<No data fields>}}, len = 140737320828928, cap = 0}}}}}}, buf = {ptr = {pointer = {
                        0x7ffff6061000 "JOIN #bf_bot\r\n* :bf_bot\r\n5cyafchqmp6wlfp8a\r\n"}, _marker = {<No data fields>}}, len = 0, cap = 65536}}}}}, config = {owners = {
              RUST$ENCODED$ENUM$0$0$0$0$None = {{ptr = {pointer = {0x7ffff602d080}, _marker = {<No data fields>}}, len = 1, cap = 1}}}, nickname = {RUST$ENCODED$ENUM$0$0$0$0$0$None = {{
                  vec = {ptr = {pointer = {0x7ffff6023030 "bf_botme001gins/bf_botmeNAKR amebf_botme\020u\245UUU"}, _marker = {<No data fields>}}, len = 6, cap = 8}}}}, nick_password = {
              RUST$ENCODED$ENUM$0$0$0$0$0$None = {{vec = {ptr = {pointer = {0x0}, _marker = {<No data fields>}}, len = 0, cap = 0}}}}, alt_nicks = {RUST$ENCODED$ENUM$0$0$0$0$None = {{ptr = {
                    pointer = {0x0}, _marker = {<No data fields>}}, len = 0, cap = 0}}}, username = {RUST$ENCODED$ENUM$0$0$0$0$0$None = {{vec = {ptr = {pointer = {
                        0x7ffff6023040 "bf_botmeNAKR amebf_botme\020u\245UUU"}, _marker = {<No data fields>}}, len = 6, cap = 8}}}}, realname = {RUST$ENCODED$ENUM$0$0$0$0$0$None = {{vec = {
                    ptr = {pointer = {0x7ffff6023050 "bf_botme\020u\245UUU"}, _marker = {<No data fields>}}, len = 6, cap = 8}}}}, server = {RUST$ENCODED$ENUM$0$0$0$0$0$None = {{vec = {
                    ptr = {pointer = {0x7ffff602e020 "irc.twitch.tv4jktmi.twitch.tvv "}, _marker = {<No data fields>}}, len = 13, cap = 16}}}}, port = {{RUST$ENUM$DISR = Some}, {
                RUST$ENUM$DISR = Some, 6667}}, password = {RUST$ENCODED$ENUM$0$0$0$0$0$None = {{vec = {ptr = {pointer = {0x7ffff6027080 "oauth:dfmbkmykmjtyimmp6wlfp8a"}, 
                      _marker = {<No data fields>}}, len = 36, cap = 64}}}}, use_ssl = {{RUST$ENUM$DISR = None}, {RUST$ENUM$DISR = None, false}}, encoding = {
              RUST$ENCODED$ENUM$0$0$0$0$0$None = {{vec = {ptr = {pointer = {0x7ffff6023078 "UTF-8ing*SER8:ng366gins/#bf_tv"}, _marker = {<No data fields>}}, len = 5, cap = 8}}}}, channels = {
              RUST$ENCODED$ENUM$0$0$0$0$None = {{ptr = {pointer = {0x7ffff60240c0}, _marker = {<No data fields>}}, len = 2, cap = 2}}}, umodes = {RUST$ENCODED$ENUM$0$0$0$0$0$None = {{vec = {
                    ptr = {pointer = {0x0}, _marker = {<No data fields>}}, len = 0, cap = 0}}}}, user_info = {RUST$ENCODED$ENUM$0$0$0$0$0$None = {{vec = {ptr = {pointer = {0x0}, 
                      _marker = {<No data fields>}}, len = 0, cap = 0}}}}, options = {RUST$ENCODED$ENUM$0$1$2$0$0$None = {{hash_state = {k0 = 4600270323910363144, k1 = 7091107444592601207}, 
                  table = {capacity = 32, size = 0, hashes = {pointer = {0x7ffff604a000}, _marker = {<No data fields>}}, marker = {<No data fields>}}, resize_policy = {<No data fields>}}}}}, 
          chanlists = {inner = 0x7ffff6024150, data = {value = {hash_state = {k0 = 14316319034754929272, k1 = 15587462643158245307}, table = {capacity = 32, size = 2, hashes = {pointer = {
                      0x7ffff604a700}, _marker = {<No data fields>}}, marker = {<No data fields>}}, resize_policy = {<No data fields>}}}}, alt_nick_index = {inner = 0x7ffff60270c0, data = {
              value = 0}}}
#5  0x0000555555709209 in rust_try_inner ()
No symbol table info available.
#6  0x00005555557091f6 in rust_try ()
No symbol table info available.
#7  0x0000555555706d7f in rt::lang_start::ha69071984e32814cXOI ()
No symbol table info available.
#8  0x0000555555573465 in main ()
No symbol table info available.
aatxe commented 9 years ago

Judging from this, the problem doesn't seem to be with that line. I'm encountering similar issues now trying to use the quote plugin, but my backtrace differs from yours. I'll need to investigate further.

aatxe commented 9 years ago

Whatever issue I was having before but was vague about was resolved, but I am now reproducing this issue with server.config() calls on Linux.

aatxe commented 9 years ago

This issue was caused by differences between the Server trait in irc compiled into the plugins versus compiled into the awebot core. It was resolved in 70190bffac2f9ee732c7f7b96023b671b0f1f1e8.