a3rk / remix

Remix Core
Other
1 stars 1 forks source link

remix-wallet-rpc seg fault #13

Closed guzzijones closed 6 years ago

guzzijones commented 6 years ago

Describe the bug

cam@west-us:~/remix-linux-x64-v0.1.1.1$ ./remix-wallet-rpc --wallet-file y --prompt-for-password  --rpc-bind-port 16695
This is the RPC RemixCoin wallet. It needs to connect to an RemixCoin
daemon to work correctly.

Remix 'Opere Solverit' (v0.1.1.1-dca708f)
Logging to ./remix-wallet-rpc.log
2018-10-25 23:44:35.820     7f25dae2e740        WARN    wallet.rpc      src/wallet/wallet_rpc_server.cpp:2919   Loading wallet...
Wallet password:
2018-10-25 23:44:39.130     7f25dae2e740        WARN    wallet.wallet2  src/wallet/wallet2.cpp:3365     Loaded wallet keys file, with public address: REMXikw1MeAfr3t7uPBnRX1ziHCxeyKubUKBVn4wt8fGD37DGRdM14B5uWZ5AcftaF22RGMKaRKu1SFCV8s5Pn9DaqXkgSubvd7
2018-10-25 23:44:39.559     7f25dae2e740        WARN    wallet.rpc      src/wallet/wallet_rpc_server.cpp:219    RPC username/password is stored in file remix-wallet-rpc.16695.login
Segmentation fault (core dumped)
cam@west-us:~/remix-linux-x64-v0.1.1.1$

To Reproduce Steps to reproduce the behavior:

  1. run command above

Expected behavior no seg fault

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context older release works fine per camthegeek

cam@west-us:~/ximer$ ./remix-wallet-rpc --wallet-file x --prompt-for-password  --rpc-bind-port 16695
This is the RPC RemixCoin wallet. It needs to connect to an RemixCoin
daemon to work correctly.

Remix 'Initium Novum' (v0.1.0.3-13dce87)
Logging to ./remix-wallet-rpc.log
2018-10-25 23:46:33.756     7f3ae1d23740        WARN    wallet.rpc      src/wallet/wallet_rpc_server.cpp:2919   Loading wallet...
Wallet password:
2018-10-25 23:46:34.719     7f3ae1d23740        WARN    wallet.wallet2  src/wallet/wallet2.cpp:3332     Loaded wallet keys file, with public address: REMXinMPB7TXDZCU3frf4Hgsa7XnHUA5nAbaPfMEGbGPFr8wbUYGoN67d8Ydy8z7YFa1iWHxPq2HW2g5H9VPuZnEDQ6px7a5HNq
2018-10-25 23:46:35.161     7f3ae1d23740        WARN    wallet.rpc      src/wallet/wallet_rpc_server.cpp:219    RPC username/password is stored in file remix-wallet-rpc.16695.login
2018-10-25 23:46:35.161     7f3ae1d23740        INFO    global  contrib/epee/include/net/http_server_impl_base.h:76     Binding on 127.0.0.1:16695
2018-10-25 23:46:35.162     7f3ae1d23740        WARN    wallet.rpc      src/wallet/wallet_rpc_server.cpp:2972   Starting wallet rpc server
guzzijones commented 6 years ago

testnet also works fine.

drparadoxical commented 6 years ago

@routed3 - you had also requested info on how to gdb your own way to tracking down this kind of error.

Brief usage of gdb by example, relative to the latest patch, hope it sheds some light on this for you sir.

  1. gdb ~/git/a3rk/remix/build/release/bin/remix-wallet-rpc
  2. (gdb) run --wallet-file ../mainnet-testing-wallet.bin --prompt-for-password --rpc-bind-port 80085

This is where the seg fault was identified, and step 2, upon entering the password, yielded the following:

Thread 1 "remix-wallet-rp" received signal SIGSEGV, Segmentation fault. 0x000000000071063e in void spdlog::logger::log<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(spdlog::level::level_enum, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()

  1. (gdb) bt

Once the seg fault was isolated, this command generated the following stack trace, useful for establishing context and gathering data when tracking down any other instances of this bug elsewhere in the code (for this particular issue, there were no other instances, but good to verify before pushing in and issuing the PR - just good practice)

#0 0x000000000071063e in void spdlog::logger::log<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(spdlog::level::level_enum, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) () #1 0x000000000075ec6d in epee::http_server_impl_base<tools::wallet_rpc_server, epee::net_utils::connection_context_base>::init(std::function<void (unsigned long, unsigned char*)>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, boost::optional<epee::net_utils::http::login>) () #2 0x000000000069928b in tools::wallet_rpc_server::init(boost::program_options::variables_map const*) () #3 0x00000000006760c0 in main ()

guzzijones commented 6 years ago

Looks to be an issue with the logger is epee interfering with the remix logger

guzzijones commented 6 years ago

this line 77 spd::get("rmx_logger")->info("Binding on " + bind_ip + ":" + bind_port); appears to be the issue

guzzijones commented 6 years ago

I am getting: non symbol get in spd namespace but i am thinking it is just optimized out. I need to compile with no optimization.

I think the issue is we need to include "include_base_utils.h" like other source files have done. The logger doesn't exist and spd::get will return a nullptr by design. then when the member dereference happens it is a crash.

ghost commented 6 years ago

Closed to PR #16