Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: assertion failed: tws-api/cpp/suppl/EPosixClientSocket.cpp:412:virtual int EPosixClientSocket::receive(char*, size_t): sz > 0 #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jankratochvil
Copy link

(gdb) bt
%0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
%1  0x00007ffff6131895 in __GI_abort () at abort.c:79
%2  0x000000000136a43d in fatal (fmt=0x1503d48 "ib __assert_fail: %s:%d:%s: %s") at lib/log.C:29
%3  0x0000000001072a11 in IBSTOCK__assert_fail (assertion=0x1503cf9 "sz > 0", file=0x1503bb0 "tws-api/cpp/suppl/EPosixClientSocket.cpp", line=412, function=0x1506760 <EPosixClientSocket::receive(char*, unsigned long)::__PRETTY_FUNCTION__> "virtual int EPosixClientSocket::receive(char*, size_t)") at iblib.C:44
%4  0x00000000010715a8 in EPosixClientSocket::receive (this=0x2e3a5f0, buf=0x2e626a0 "", sz=0) at tws-api/cpp/suppl/EPosixClientSocket.cpp:412
%5  0x000000000106cace in EReaderST::onReceive (this=0x2e3adb8) at tws-api/cpp/suppl/EReaderST.cpp:132
%6  0x0000000000secret in secret (this=0x2e3a5f0) at secret.C:secret
...
(gdb) frame 5
132             int nRes = m_pClientSocket->receive(m_buf->begin + m_buf->offset, sz );
(gdb) p m_buf->size
$8 = 106496
(gdb) p m_buf->offset
$9 = 106496

That is because I read data as long as they are available (POLLIN) and only
then I start processing them.

The last chunk with newsize is unrelated a bit and not so important, it is
just the optimal size of m_buf which is IMO what the code tried to do.

…irtual int EPosixClientSocket::receive(char*, size_t): sz > 0

(gdb) bt
%0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
%1  0x00007ffff6131895 in __GI_abort () at abort.c:79
%2  0x000000000136a43d in fatal (fmt=0x1503d48 "ib __assert_fail: %s:%d:%s: %s") at lib/log.C:29
%3  0x0000000001072a11 in IBSTOCK__assert_fail (assertion=0x1503cf9 "sz > 0", file=0x1503bb0 "tws-api/EPosixClientSocket.cpp", line=412, function=0x1506760 <EPosixClientSocket::receive(char*, unsigned long)::__PRETTY_FUNCTION__> "virtual int EPosixClientSocket::receive(char*, size_t)") at iblib.C:44
%4  0x00000000010715a8 in EPosixClientSocket::receive (this=0x2e3a5f0, buf=0x2e626a0 "", sz=0) at tws-api/EPosixClientSocket.cpp:412
%5  0x000000000106cace in EReaderST::onReceive (this=0x2e3adb8) at tws-api/EReaderST.cpp:132
%6  0x0000000000f2984e in IbClientBackend::tick (this=0x2e3a5f0, wait=true) at ib.C:2153
...
(gdb) frame 5
132             int nRes = m_pClientSocket->receive(m_buf->begin + m_buf->offset, sz );
(gdb) p m_buf->size
$8 = 106496
(gdb) p m_buf->offset
$9 = 106496

That is because I read data as long as they are available (POLLIN) and only
then I start processing them.

The last chunk with `newsize` is unrelated a bit and not so important, it is
just the optimal size of `m_buf` which is IMO what the code tried to do.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant