blackbird icon indicating copy to clipboard operation
blackbird copied to clipboard

Crash

Open davidjirovec opened this issue 7 years ago • 7 comments

Blackbird Bitcoin Arbitrage
DISCLAIMER: USE THE SOFTWARE AT YOUR OWN RISK

Log file generated: output/blackbird_log_20180121_191823.log
Blackbird is running... (pid 420)

terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_M_construct null not valid
Aborted (core dumped)
[ 01/22/2018 07:58:00 ]
   Bitfinex: 	11,602.00 / 11,611.00
   OKCoin: 	12,738.70 / 12,841.95
   Kraken: 	11,667.60 / 11,667.70
   QuadrigaCX: 	9,960.01 / 11,450.00
   Exmo: 	13,000.00 / 13,040.00
   ----------------------------
   OKCoin/Bitfinex:	-9.66% [target  0.80%, min -13.49%, max -8.41%]
   Kraken/Bitfinex:	-0.56% [target  0.80%, min -1.78%, max -0.10%]
   QuadrigaCX/Bitfinex:	 1.33% [target  0.80%, min -10.30%, max  1.55%]   trailing  1.40%  1/1
<Bitfinex> Looking for a limit price to fill 0.004305 BTC...
<Bitfinex> order book: 0.712327@$11,603.00

[ ENTRY FOUND ]
   Date & Time:       01/22/2018 07:58:00
   Exchange Long:     QuadrigaCX (id 3)
   Exchange Short:    Bitfinex (id 0)
   Fees:              0.50% / 0.20%
   Price Long:        11,450.00 (target)
   Price Short:       11,603.00 (target)
   Spread:            1.33%
   Cash used:         49.95 on each exchange
   Exit Target:       -0.57%

davidjirovec avatar Jan 26 '18 23:01 davidjirovec

I think I'm facing a similar issue. Is your terminal window logging the following error also: 'Segmentation fault: 11'?

charlower avatar Feb 11 '18 10:02 charlower

No, but I am not sure if it has something to do with used OS. I am running on Ubuntu on Windows 10.

Anyway, it happened again.

Blackbird Bitcoin Arbitrage
DISCLAIMER: USE THE SOFTWARE AT YOUR OWN RISK

Log file generated: output/blackbird_log_20180211_030735.log
Blackbird is running... (pid 1715)

terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_M_construct null not valid
Aborted (core dumped)
[ 02/11/2018 06:41:33 ]
   Bitfinex:    8,047.20 / 8,047.30
   OKCoin:      8,888.04 / 9,058.02
   Bitstamp:    8,069.01 / 8,072.37
   Kraken:      8,064.40 / 8,070.80
   QuadrigaCX:  7,901.04 / 7,998.99
   Exmo:        8,490.20 / 8,523.96
   Cexio:       8,239.20 / 8,251.00
   ----------------------------
   Bitfinex/Kraken:      0.21% [target  0.80%, min -0.33%, max  0.50%]
   OKCoin/Bitfinex:     -11.16% [target  0.80%, min -12.97%, max -8.66%]
   OKCoin/Kraken:       -10.97% [target  0.80%, min -12.80%, max -8.57%]
   Bitstamp/Bitfinex:   -0.31% [target  0.80%, min -0.89%, max  0.24%]
   Bitstamp/Kraken:     -0.10% [target  0.80%, min -0.84%, max  0.27%]
   Kraken/Bitfinex:     -0.29% [target  0.80%, min -0.69%, max  0.26%]
   QuadrigaCX/Bitfinex:  0.60% [target  0.80%, min -4.93%, max  0.74%]
   QuadrigaCX/Kraken:    0.82% [target  0.80%, min -5.00%, max  0.82%]

[ ENTRY FOUND ]
   Date & Time:       02/11/2018 06:41:33
   Exchange Long:     QuadrigaCX (id 4)
   Exchange Short:    Kraken (id 3)
   Fees:              0.50% / 0.25%
   Price Long:        7,998.99 (target)
   Price Short:       8,065.30 (target)
   Spread:            0.82%
   Cash used:         39.53 on each exchange
   Exit Target:       -1.18%

davidjirovec avatar Feb 11 '18 18:02 davidjirovec

From my two logs, it seems problem is caused when QuadrigaCX is used as Exchange Long? I am really not a C developer, so I what is meaningful way to debug this :)

davidjirovec avatar Feb 11 '18 18:02 davidjirovec

Happened to me too. I think it's a parsing error somewhere in Quadriga

fdoumet avatar Feb 22 '18 19:02 fdoumet

@davidjirovec @fdoumet Could you please try to trace the error? Thanks

  1. Type the command ulimit -c unlimited. This will produce a core file next time Blackbird crashes
  2. Run ./blackbird
  3. When Blackbird crashes you should get a core file in the current directory
  4. Type gdb ./blackbird core to start GNU Debugger. Install it if you don't have it yet
  5. Type backtrace in the debugger. You should be able to see when the crash occurred and hopefully why.

butor avatar Feb 22 '18 19:02 butor

Thanks for the help on how to debug.

#0  0x00007f3bb85d7428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
#1  0x00007f3bb85d902a in __GI_abort () at abort.c:89
#2  0x00007f3bb8f1a84d in __gnu_cxx::__verbose_terminate_handler() ()
   from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#3  0x00007f3bb8f186b6 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#4  0x00007f3bb8f18701 in std::terminate() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#5  0x00007f3bb8f18919 in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#6  0x00007f3bb8f4114f in std::__throw_logic_error(char const*) ()
   from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#7  0x00007f3bb8faca94 in void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char const*>(char const*, char const*, std::forward_iterator_tag) ()
   from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#8  0x00007f3bb8facc4c in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#9  0x000000000044225b in QuadrigaCX::sendLongOrder (params=..., direction="buy", 
    quantity=0.0025641025641025641, price=9750) at /home/adenda/blackbird/src/exchanges/quadrigacx.cpp:88
#10 0x00000000004321e8 in main (argc=1, argv=0x7ffdba353788) at /home/adenda/blackbird/src/main.cpp:607

So yes, looks like the error is with Quadriga in this line: std::string orderId = json_string_value(json_object_get(root.get(), "id"));

It seems like the order never goes through (since the USD balance is never debited), so I think there must be something invalid in the request.

Another thing that's weird, is that the "Trying to send a order" text doesn't get printed in the logs. Any idea why?

fdoumet avatar Feb 23 '18 00:02 fdoumet

Turns out Quadriga has a minimum trade amount of 0.005 BTC. So if you attempt to send a long order with anything else than that, it will return an error.

fdoumet avatar Feb 27 '18 22:02 fdoumet