Skip to content
This repository has been archived by the owner on Apr 6, 2019. It is now read-only.

there is a assert happend if call the cppredis::publish function in multithread at debug mode? #19

Closed
rmb338 opened this issue Oct 22, 2016 · 2 comments
Assignees

Comments

@rmb338
Copy link

rmb338 commented Oct 22, 2016

as my issue says:there is a assert happend if call the cppredis::publish function in multithread at debug mode?
the code is in tcp_client.cpp line 191
191: if (length >= m_write_buffer.front().size())
m_write_buffer.pop_front();
else
m_write_buffer.front().erase(m_write_buffer.front().begin(), m_write_buffer.front().begin() + length);
the std::list::front() function is directly use *begin(),so if m_write_buffer is empty ,the begin() iterator is equal end() ,is a invalid iterator,and VC++ will report a assertion .
my suggestion is add some code before line 191 like this
if(m_write_buffer.empty())
return;
sorry for my poor english...

@Cylix
Copy link
Owner

Cylix commented Oct 22, 2016

Indeed, this is true.

I have done the modification on a branch but still get an assert about 1 time every 10 runs of my automated tests, so the if statement is not enough.

I'm going to give a look into that. I'm not the author of the Windows port, so it might slow me down a bit to debug that, but I'll try to fix that as quick as possible.

Thanks for reporting that issue btw!

@Cylix
Copy link
Owner

Cylix commented Jan 29, 2017

Closing as it is not relevant anymore after the new release v3.0.0 as explained in #39.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants