niXman / binapi

Binance API C++ implementation
Apache License 2.0
263 stars 88 forks source link

Segmentation Fault when calling sync_post in api.cpp #69

Closed wyzd03105 closed 1 year ago

wyzd03105 commented 1 year ago

Hi The stack trace is as below. Is there any clue to drill down to the cause of the problem? P.S. The error does not happen each time the sync_post API get called. ` Program terminated with signal 11, Segmentation fault.

0 0x00007f0b62c288c1 in __strlen_sse2_pminub () from /lib64/libc.so.6

Missing separate debuginfos, use: debuginfo-install glibc-2.17-326.el7_9.x86_64 keyutils-libs-1.5.8-3.el7.x86_64 krb5-libs-1.15.1-55.el7_9.x86_64 libcom_err-1.42.9-19.el7.x86_64 libgcc-4.8.5-44.el7.x86_64 libselinux-2.5-15.el7.x86_64 libstdc++-4.8.5-44.el7.x86_64 mysql-community-libs-8.0.32-1.el7.x86_64 openssl-libs-1.0.2k-25.el7_9.x86_64 pcre-8.32-17.el7.x86_64 zlib-1.2.7-20.el7_9.x86_64 (gdb) bt

0 0x00007f0b62c288c1 in __strlen_sse2_pminub () from /lib64/libc.so.6

1 0x00007f0b63435ea9 in std::basic_ostream<char, std::char_traits >& std::operator<< <std::char_traits >(std::basic_ostream<char, std::char_traits >&, char const*) () from /lib64/libstdc++.so.6

2 0x00007f0b5a011a3e in binapi::rest::api::impl::sync_post(char const*, boost::beast::http::verb, std::string) ()

from /root/liveenv/bianshunengine_strategy/bin/output/libqtapibinanceimpl.so

3 0x00007f0b5a03a370 in binapi::rest::api::result binapi::rest::api::impl::post<std::function<bool (char const, int, std::string, binapi::rest::future_order_t)>, std::tuple<char const, int, std::string, binapi::rest::future_order_t>, binapi::rest::future_order_t>(bool, char const, boost::beast::http::verb, std::initializer_list<std::pair<char const, boost::variant<unsigned long, char const> > > const&, std::function<bool (char const, int, std::string, binapi::rest::future_order_t)>) () from /root/liveenv/bianshunengine_strategy/bin/output/libqtapibinanceimpl.so

4 0x00007f0b59ff8dcf in binapi::rest::api::future_new_order(char const, binapi::e_side, binapi::e_position_side, binapi::e_type, binapi::e_time, char const, char const, char const, std::function<bool (char const*, int, std::string, binapi::rest::future_order_t)>) () from /root/liveenv/bianshunengine_strategy/bin/output/libqtapibinanceimpl.so

5 0x00007f0b5a10c053 in BinanceCryptoTrader::Short(char const, char const, double, double) ()

from /root/liveenv/bianshunengine_strategy/bin/output/libqtapibinanceimpl.so

6 0x00007f0b592d424a in CryptoPoliciesAnshul::sendOrder (this=this@entry=0x1f7a490, bs=bs@entry=SideSell,

oc=oc@entry=SideOpen, symbol=0x1f7b820 "dogeusdt", qty=qty@entry=5026, price=price@entry=0.077600000000000002, 

---Type to continue, or q to quit--- orderType=orderType@entry=orderTypeLimit, nResend=nResend@entry=0) at policies_console_anshul.cpp:967

7 0x00007f0b592d47c4 in CryptoPoliciesAnshul::positionSync (this=0x1f7a490) at policies_console_anshul.cpp:780

8 0x00007f0b592d4cb2 in CryptoPoliciesAnshul::OnNewCryptoMD (this=0x1f7a490, pMD=0x7f0a7c04fb30)

at policies_console_anshul.cpp:663

9 0x00007f0b64243fa8 in PolicyThreadProc(void*) () at qtapi.cpp:322

10 0x00007f0b636aeea5 in start_thread () from /lib64/libpthread.so.0

11 0x00007f0b62bb7b0d in clone () from /lib64/libc.so.6

`

niXman commented 1 year ago

as you can see, binapi doesn't provide binapi::rest::api::future_new_order: https://github.com/niXman/binapi/blob/master/include/binapi/api.hpp

wyzd03105 commented 1 year ago

Yes. But it will call sync_post at the lower level. Future_new_order is my newly added function. I think the problem might lie at the lower level.

niXman commented 1 year ago

then why the problem occurs only with the function you added? ;)

please close.

wyzd03105 commented 1 year ago

then why the problem occurs only with the function you added? ;)

please close.

OK.But I'll take further investigation on this issue.