[boost] [ASIO] Having a hard time after upgrading my boost libraries

0 views
Skip to first unread message

Arpan Sen

unread,
May 19, 2013, 8:54:21 AM5/19/13
to bo...@lists.boost.org
Folks,

I recently moved to boost 1.52, been using a pretty old version of boost earlier. Quite a number of pieces of my code have stopped working since then, but the one that's really a pain is the ASIO piece. I have a lot of code that makes use of ASIO's async read/write and other calls and there seems to be a problem reading data from socket with async_read_until - sometimes I get empty string, there's valid data at other times.

My code is heavily multi-threaded. This problem doesn't show up in single threaded environment at all. My OS is SUSE 11 and g++-4.3.3 as the compiler. I may have to post some code eventually but on the top off your head - do you have any pointers for me?

Thanks for your time.

Arpan

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Antony Polukhin

unread,
May 20, 2013, 4:33:21 AM5/20/13
to bo...@lists.boost.org
2013/5/19 Arpan Sen <arpa...@gmail.com>:
> Folks,
>
> I recently moved to boost 1.52, been using a pretty old version of boost earlier. Quite a number of pieces of my code have stopped working since then, but the one that's really a pain is the ASIO piece. I have a lot of code that makes use of ASIO's async read/write and other calls and there seems to be a problem reading data from socket with async_read_until - sometimes I get empty string, there's valid data at other times.
>
> My code is heavily multi-threaded. This problem doesn't show up in single threaded environment at all. My OS is SUSE 11 and g++-4.3.3 as the compiler. I may have to post some code eventually but on the top off your head - do you have any pointers for me?

I have no solution, but following thoughts popped up in my head:

Maybe some error occur during read/write. Do you check const
boost::system::error_code& error in all handlers?

Are buffers modified from only a single thread at a moment of time
(each handler has its own buffer?)?

Does OS limits allow you to create required amount of threads/sockets?

--
Best regards,
Antony Polukhin

Gaetano Mendola

unread,
May 20, 2013, 3:47:52 PM5/20/13
to bo...@lists.boost.org
On 19/05/2013 14.54, Arpan Sen wrote:
> Folks,
>
> I recently moved to boost 1.52, been using a pretty old version of boost earlier. Quite a number of pieces of my code have stopped working since then, but the one that's really a pain is the ASIO piece. I have a lot of code that makes use of ASIO's async read/write and other calls and there seems to be a problem reading data from socket with async_read_until - sometimes I get empty string, there's valid data at other times.
>
> My code is heavily multi-threaded. This problem doesn't show up in single threaded environment at all. My OS is SUSE 11 and g++-4.3.3 as the compiler. I may have to post some code eventually but on the top off your head - do you have any pointers for me?

Consider that the buffer you are passing to your async calls has to
survive the handler.
How many threads are running the io_service::run ?
Consider that boost::asio::sockets are not multithread so only one
thread at time can call the async calls on it.
Can the handlers running concurrently ? If not you have to use the
strand.


Regards
Gaetano Mendola
Reply all
Reply to author
Forward
0 new messages