|
Boost Users : |
From: æ³°å¿ (tjisana.lewis_at_[hidden])
Date: 2022-02-11 18:31:08
So, thanks to Marshall for clueing me in on address sanitizer. Realized
that I failed to do bounds checking on a segment of code and solved the
read problem. With that fixed I'm getting stack overflow due, it seems, to
the heavy recursion in my code (and using cpp_dec_). I swapped out
cpp_dec_ for double and the problem has gone away. Will figure out my
banker's rounding while I'm at it. Here's the AddressSanitizer trace for
completeness (below) - maybe there's another issue afoot?
TJ
09:46:38.996500 | SPY 220211C00447000 | root: 0.000 | open: 0.000 |
high: 2.120 | low: 0.000 | close: 1.680 | bid: 1.680 | ask: 1.690 |
1.414 | 0.009 | 0.306 |
09:47:03.456158 | SPY 220211C00447000 | order: MKT | qty: 31.000 |
action: BUY | exchg: SMART
AddressSanitizer:DEADLYSIGNAL
=================================================================
==19612==ERROR: AddressSanitizer: stack-overflow on address 0x7f22fd7d5718
(pc 0x7f2300abe437 bp 0x7f22fd7d6360 sp 0x7f22fd7d5700 T0)
#0 0x7f2300abe437 (/lib64/libasan.so.6+0xb9437)
#1 0x7f2300a418fb in __interceptor_memcpy (/lib64/libasan.so.6+0x3c8fb)
#2 0x7f2300927ba7 in std::basic_streambuf<char, std::char_traits<char>
>::xsputn(char const*, long) (/lib64/libstdc++.so.6+0x147ba7)
#3 0x7f23009197d6 in std::ostream::write(char const*, long)
(/lib64/libstdc++.so.6+0x1397d6)
#4 0x588c8a in EClientSocket::prepareBufferImpl(std::ostream&) const
../src/client/EClientSocket.cpp:217
#5 0x588d7f in EClientSocket::prepareBuffer(std::ostream&) const
../src/client/EClientSocket.cpp:225
#6 0x5548dc in EClient::reqCurrentTime() ../src/client/EClient.cpp:1234
#7 0x4afda3 in ib_trading_engine::current_time()
../src/ib_trading_engine.cpp:409
#8 0x4b6dd5 in ib_trading_engine::tickPrice(long, TickType, double,
TickAttrib const&) ../src/ib_trading_engine.cpp:666
#9 0x58b8f7 in EDecoder::processTickPriceMsg(char const*, char const*)
../src/client/EDecoder.cpp:65
#10 0x5a50c7 in EDecoder::parseAndProcessMsg(char const*&, char const*)
../src/client/EDecoder.cpp:2247
#11 0x5d1f59 in EReader::processMsgs() ../src/client/EReader.cpp:282
#12 0x4afd59 in ib_trading_engine::process_messages()
../src/ib_trading_engine.cpp:405
#13 0x4afdaf in ib_trading_engine::current_time()
../src/ib_trading_engine.cpp:410
#14 0x4b6dd5 in ib_trading_engine::tickPrice(long, TickType, double,
TickAttrib const&) ../src/ib_trading_engine.cpp:666
#15 0x58b8f7 in EDecoder::processTickPriceMsg(char const*, char const*)
../src/client/EDecoder.cpp:65
#16 0x5a50c7 in EDecoder::parseAndProcessMsg(char const*&, char const*)
../src/client/EDecoder.cpp:2247
#17 0x5d1f59 in EReader::processMsgs() ../src/client/EReader.cpp:282
#18 0x4afd59 in ib_trading_engine::process_messages()
../src/ib_trading_engine.cpp:405
#19 0x4afdaf in ib_trading_engine::current_time()
../src/ib_trading_engine.cpp:410
#20 0x4b6dd5 in ib_trading_engine::tickPrice(long, TickType, double,
TickAttrib const&) ../src/ib_trading_engine.cpp:666
#21 0x58b8f7 in EDecoder::processTickPriceMsg(char const*, char const*)
../src/client/EDecoder.cpp:65
#22 0x5a50c7 in EDecoder::parseAndProcessMsg(char const*&, char const*)
../src/client/EDecoder.cpp:2247
#23 0x5d1f59 in EReader::processMsgs() ../src/client/EReader.cpp:282
#24 0x4afd59 in ib_trading_engine::process_messages()
../src/ib_trading_engine.cpp:405
#25 0x4afdaf in ib_trading_engine::current_time()
../src/ib_trading_engine.cpp:410
#26 0x4b6dd5 in ib_trading_engine::tickPrice(long, TickType, double,
TickAttrib const&) ../src/ib_trading_engine.cpp:666
#27 0x58b8f7 in EDecoder::processTickPriceMsg(char const*, char const*)
../src/client/EDecoder.cpp:65
#28 0x5a50c7 in EDecoder::parseAndProcessMsg(char const*&, char const*)
../src/client/EDecoder.cpp:2247
#29 0x5d1f59 in EReader::processMsgs() ../src/client/EReader.cpp:282
#30 0x4afd59 in ib_trading_engine::process_messages()
../src/ib_trading_engine.cpp:405
#31 0x4afdaf in ib_trading_engine::current_time()
../src/ib_trading_engine.cpp:410
#32 0x4b6dd5 in ib_trading_engine::tickPrice(long, TickType, double,
TickAttrib const&) ../src/ib_trading_engine.cpp:666
#33 0x58b8f7 in EDecoder::processTickPriceMsg(char const*, char const*)
../src/client/EDecoder.cpp:65
#34 0x5a50c7 in EDecoder::parseAndProcessMsg(char const*&, char const*)
../src/client/EDecoder.cpp:2247
#35 0x5d1f59 in EReader::processMsgs() ../src/client/EReader.cpp:282
#36 0x4afd59 in ib_trading_engine::process_messages()
../src/ib_trading_engine.cpp:405
#37 0x4afdaf in ib_trading_engine::current_time()
../src/ib_trading_engine.cpp:410
#38 0x4b6dd5 in ib_trading_engine::tickPrice(long, TickType, double,
TickAttrib const&) ../src/ib_trading_engine.cpp:666
#39 0x58b8f7 in EDecoder::processTickPriceMsg(char const*, char const*)
../src/client/EDecoder.cpp:65
#40 0x5a50c7 in EDecoder::parseAndProcessMsg(char const*&, char const*)
../src/client/EDecoder.cpp:2247
#41 0x5d1f59 in EReader::processMsgs() ../src/client/EReader.cpp:282
#42 0x4afd59 in ib_trading_engine::process_messages()
../src/ib_trading_engine.cpp:405
#43 0x4afdaf in ib_trading_engine::current_time()
../src/ib_trading_engine.cpp:410
#44 0x4b6dd5 in ib_trading_engine::tickPrice(long, TickType, double,
TickAttrib const&) ../src/ib_trading_engine.cpp:666
#45 0x58b8f7 in EDecoder::processTickPriceMsg(char const*, char const*)
../src/client/EDecoder.cpp:65
#46 0x5a50c7 in EDecoder::parseAndProcessMsg(char const*&, char const*)
../src/client/EDecoder.cpp:2247
#47 0x5d1f59 in EReader::processMsgs() ../src/client/EReader.cpp:282
#48 0x4afd59 in ib_trading_engine::process_messages()
../src/ib_trading_engine.cpp:405
#49 0x4afdaf in ib_trading_engine::current_time()
../src/ib_trading_engine.cpp:410
#50 0x4b6dd5 in ib_trading_engine::tickPrice(long, TickType, double,
TickAttrib const&) ../src/ib_trading_engine.cpp:666
#51 0x58b8f7 in EDecoder::processTickPriceMsg(char const*, char const*)
../src/client/EDecoder.cpp:65
#52 0x5a50c7 in EDecoder::parseAndProcessMsg(char const*&, char const*)
../src/client/EDecoder.cpp:2247
#53 0x5d1f59 in EReader::processMsgs() ../src/client/EReader.cpp:282
#54 0x4afd59 in ib_trading_engine::process_messages()
../src/ib_trading_engine.cpp:405
#55 0x4afdaf in ib_trading_engine::current_time()
../src/ib_trading_engine.cpp:410
#56 0x4b6dd5 in ib_trading_engine::tickPrice(long, TickType, double,
TickAttrib const&) ../src/ib_trading_engine.cpp:666
#57 0x58b8f7 in EDecoder::processTickPriceMsg(char const*, char const*)
../src/client/EDecoder.cpp:65
#58 0x5a50c7 in EDecoder::parseAndProcessMsg(char const*&, char const*)
../src/client/EDecoder.cpp:2247
#59 0x5d1f59 in EReader::processMsgs() ../src/client/EReader.cpp:282
#60 0x4afd59 in ib_trading_engine::process_messages()
../src/ib_trading_engine.cpp:405
#61 0x4afdaf in ib_trading_engine::current_time()
../src/ib_trading_engine.cpp:410
#62 0x4b6dd5 in ib_trading_engine::tickPrice(long, TickType, double,
TickAttrib const&) ../src/ib_trading_engine.cpp:666
#63 0x58b8f7 in EDecoder::processTickPriceMsg(char const*, char const*)
../src/client/EDecoder.cpp:65
#64 0x5a50c7 in EDecoder::parseAndProcessMsg(char const*&, char const*)
../src/client/EDecoder.cpp:2247
#65 0x5d1f59 in EReader::processMsgs() ../src/client/EReader.cpp:282
#66 0x4afd59 in ib_trading_engine::process_messages()
../src/ib_trading_engine.cpp:405
#67 0x4afdaf in ib_trading_engine::current_time()
../src/ib_trading_engine.cpp:410
#68 0x4b6dd5 in ib_trading_engine::tickPrice(long, TickType, double,
TickAttrib const&) ../src/ib_trading_engine.cpp:666
#69 0x58b8f7 in EDecoder::processTickPriceMsg(char const*, char const*)
../src/client/EDecoder.cpp:65
#70 0x5a50c7 in EDecoder::parseAndProcessMsg(char const*&, char const*)
../src/client/EDecoder.cpp:2247
#71 0x5d1f59 in EReader::processMsgs() ../src/client/EReader.cpp:282
#72 0x4afd59 in ib_trading_engine::process_messages()
../src/ib_trading_engine.cpp:405
#73 0x4afdaf in ib_trading_engine::current_time()
../src/ib_trading_engine.cpp:410
#74 0x4b6dd5 in ib_trading_engine::tickPrice(long, TickType, double,
TickAttrib const&) ../src/ib_trading_engine.cpp:666
#75 0x58b8f7 in EDecoder::processTickPriceMsg(char const*, char const*)
../src/client/EDecoder.cpp:65
#76 0x5a50c7 in EDecoder::parseAndProcessMsg(char const*&, char const*)
../src/client/EDecoder.cpp:2247
#77 0x5d1f59 in EReader::processMsgs() ../src/client/EReader.cpp:282
#78 0x4afd59 in ib_trading_engine::process_messages()
../src/ib_trading_engine.cpp:405
#79 0x4afdaf in ib_trading_engine::current_time()
../src/ib_trading_engine.cpp:410
#80 0x4b6dd5 in ib_trading_engine::tickPrice(long, TickType, double,
TickAttrib const&) ../src/ib_trading_engine.cpp:666
#81 0x58b8f7 in EDecoder::processTickPriceMsg(char const*, char const*)
../src/client/EDecoder.cpp:65
#82 0x5a50c7 in EDecoder::parseAndProcessMsg(char const*&, char const*)
../src/client/EDecoder.cpp:2247
#83 0x5d1f59 in EReader::processMsgs() ../src/client/EReader.cpp:282
#84 0x4afd59 in ib_trading_engine::process_messages()
../src/ib_trading_engine.cpp:405
#85 0x4afdaf in ib_trading_engine::current_time()
../src/ib_trading_engine.cpp:410
#86 0x4b6dd5 in ib_trading_engine::tickPrice(long, TickType, double,
TickAttrib const&) ../src/ib_trading_engine.cpp:666
#87 0x58b8f7 in EDecoder::processTickPriceMsg(char const*, char const*)
../src/client/EDecoder.cpp:65
#88 0x5a50c7 in EDecoder::parseAndProcessMsg(char const*&, char const*)
../src/client/EDecoder.cpp:2247
#89 0x5d1f59 in EReader::processMsgs() ../src/client/EReader.cpp:282
#90 0x4afd59 in ib_trading_engine::process_messages()
../src/ib_trading_engine.cpp:405
#91 0x4afdaf in ib_trading_engine::current_time()
../src/ib_trading_engine.cpp:410
#92 0x4b6dd5 in ib_trading_engine::tickPrice(long, TickType, double,
TickAttrib const&) ../src/ib_trading_engine.cpp:666
#93 0x58b8f7 in EDecoder::processTickPriceMsg(char const*, char const*)
../src/client/EDecoder.cpp:65
#94 0x5a50c7 in EDecoder::parseAndProcessMsg(char const*&, char const*)
../src/client/EDecoder.cpp:2247
#95 0x5d1f59 in EReader::processMsgs() ../src/client/EReader.cpp:282
#96 0x4afd59 in ib_trading_engine::process_messages()
../src/ib_trading_engine.cpp:405
#97 0x4afdaf in ib_trading_engine::current_time()
../src/ib_trading_engine.cpp:410
#98 0x4b6dd5 in ib_trading_engine::tickPrice(long, TickType, double,
TickAttrib const&) ../src/ib_trading_engine.cpp:666
#99 0x58b8f7 in EDecoder::processTickPriceMsg(char const*, char const*)
../src/client/EDecoder.cpp:65
#100 0x5a50c7 in EDecoder::parseAndProcessMsg(char const*&, char
const*) ../src/client/EDecoder.cpp:2247
#101 0x5d1f59 in EReader::processMsgs() ../src/client/EReader.cpp:282
#102 0x4afd59 in ib_trading_engine::process_messages()
../src/ib_trading_engine.cpp:405
#103 0x4ad671 in operator() ../src/ib_trading_engine.cpp:261
#104 0x4c1219 in operator()
/usr/include/boost/coroutine2/detail/push_control_block_cc.ipp:90
#105 0x4c282d in __invoke_impl<boost::context::fiber,
boost::coroutines2::detail::push_coroutine<last_tick>::control_block::control_block<boost::context::basic_fixedsize_stack<boost::context::stack_traits>,
ib_trading_engine::run()::<lambda(boost::coroutines2::coroutine<last_tick>::pull_type&)>
>(boost::context::preallocated,
boost::context::basic_fixedsize_stack<boost::context::stack_traits>&&,
ib_trading_engine::run()::<lambda(boost::coroutines2::coroutine<last_tick>::pull_type&)>&&)::<lambda(boost::context::fiber&&)>&,
boost::context::fiber> /usr/include/c++/11/bits/invoke.h:61
#106 0x4c2618 in
__invoke<boost::coroutines2::detail::push_coroutine<last_tick>::control_block::control_block<boost::context::basic_fixedsize_stack<boost::context::stack_traits>,
ib_trading_engine::run()::<lambda(boost::coroutines2::coroutine<last_tick>::pull_type&)>
>(boost::context::preallocated,
boost::context::basic_fixedsize_stack<boost::context::stack_traits>&&,
ib_trading_engine::run()::<lambda(boost::coroutines2::coroutine<last_tick>::pull_type&)>&&)::<lambda(boost::context::fiber&&)>&,
boost::context::fiber> /usr/include/c++/11/bits/invoke.h:97
#107 0x4c257f in
invoke<boost::coroutines2::detail::push_coroutine<last_tick>::control_block::control_block<boost::context::basic_fixedsize_stack<boost::context::stack_traits>,
ib_trading_engine::run()::<lambda(boost::coroutines2::coroutine<last_tick>::pull_type&)>
>(boost::context::preallocated,
boost::context::basic_fixedsize_stack<boost::context::stack_traits>&&,
ib_trading_engine::run()::<lambda(boost::coroutines2::coroutine<last_tick>::pull_type&)>&&)::<lambda(boost::context::fiber&&)>&,
boost::context::fiber> /usr/include/c++/11/functional:98
#108 0x4c22df in run /usr/include/boost/context/fiber_fcontext.hpp:140
#109 0x4c208b in
fiber_entry<boost::context::detail::fiber_record<boost::context::fiber,
boost::context::basic_fixedsize_stack<boost::context::stack_traits>,
boost::coroutines2::detail::push_coroutine<last_tick>::control_block::control_block<boost::context::basic_fixedsize_stack<boost::context::stack_traits>,
ib_trading_engine::run()::<lambda(boost::coroutines2::coroutine<last_tick>::pull_type&)>
>(boost::context::preallocated,
boost::context::basic_fixedsize_stack<boost::context::stack_traits>&&,
ib_trading_engine::run()::<lambda(boost::coroutines2::coroutine<last_tick>::pull_type&)>&&)::<lambda(boost::context::fiber&&)>
> > /usr/include/boost/context/fiber_fcontext.hpp:80
#110 0x7f2300a0118e in make_fcontext
(/lib64/libboost_context.so.1.78.0+0x118e)
SUMMARY: AddressSanitizer: stack-overflow (/lib64/libasan.so.6+0xb9437)
==19612==ABORTING
On Fri, Feb 11, 2022 at 9:41 AM Phil Endecott via Boost-users <
boost-users_at_[hidden]> wrote:
> Hi,
>
> tjisana wrote:
> > Trying to get to the root of a very intermittent seg fault in my program.
>
> This reminds me of the issue that I found while reviewing
> Boost.Multiprecision back in 2012:
>
> https://lists.boost.org/Archives/boost/2012/06/193862.php
>
> I did track that down and it was fixed, but in the process
> of investigating I got a poor impression of the implementation
> of the library and I felt that other similar issues were
> probably present. In my review, I said that I would not
> be confident using Boost.Multiprecision without verifying
> its answers against another implementation. Of course that's
> a decade ago and things may have changed - or not.
>
>
> Regards, Phil.
>
>
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> https://lists.boost.org/mailman/listinfo.cgi/boost-users
>
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net