Discussion:
[asio-users] Hanging in poll_one
Dan Posluns
2012-12-21 18:50:06 UTC
Permalink
Hi there,

I'm using boost::io_service to manage cross-platform multithreading tasks for
iOS and Android NDK. Occasionally, I get hangs on either platform.

My latest problem is io_service::poll_one on Android, which hangs with the
following callstack:

(std::__atomic0::__atomic_base<long>::load(std::memory_order) const+44)
#02 pc 00454f1c /data/app-lib/com.decarta.myditu.nav-1/libnavlib.so
(std::__atomic0::__atomic_base<long>::operator long() const+20)
#03 pc 0044deac /data/app-lib/com.decarta.myditu.nav-1/libnavlib.so
(boost::asio::detail::task_io_service::poll_one(boost::system::error_code&)+60)



I had a similar problem with io_service::run_one on iOS, where the single worker
thread would occasionally hang in pthread_cond_wait() no matter how many times I
called post() on the service from a different thread. I switched to a poll_one()
implementation with my own condition lock to circumvent it on that platform, but
the bug remains.


I love the functionality of Boost.Asio but these hangs are killing me,
especially on Android. They are extremely infrequent but I have no clue what I
can do about them. (We are using gnustl for our standard library in NDK.)

Any advice?

Thanks,

Dan.
Gruenke, Matt
2012-12-21 19:24:08 UTC
Permalink
Perhaps it would help if you could submit a concise example that demonstrates the problem.

At minimum, please submit a call stack with debug info maxed out (at least enough that we get line numbers & filenames) and all optimizations & inlining disabled. Also, please state the specific version of Boost you're using.


Matt


-----Original Message-----
From: Dan Posluns [mailto:***@danposluns.com]
Sent: December 21, 2012 13:50
To: asio-***@lists.sourceforge.net
Subject: [asio-users] Hanging in poll_one

Hi there,

I'm using boost::io_service to manage cross-platform multithreading tasks for iOS and Android NDK. Occasionally, I get hangs on either platform.

My latest problem is io_service::poll_one on Android, which hangs with the following callstack:

(std::__atomic0::__atomic_base<long>::load(std::memory_order) const+44)
#02 pc 00454f1c /data/app-lib/com.decarta.myditu.nav-1/libnavlib.so
(std::__atomic0::__atomic_base<long>::operator long() const+20)
#03 pc 0044deac /data/app-lib/com.decarta.myditu.nav-1/libnavlib.so
(boost::asio::detail::task_io_service::poll_one(boost::system::error_code&)+60)



I had a similar problem with io_service::run_one on iOS, where the single worker thread would occasionally hang in pthread_cond_wait() no matter how many times I called post() on the service from a different thread. I switched to a poll_one() implementation with my own condition lock to circumvent it on that platform, but the bug remains.


I love the functionality of Boost.Asio but these hangs are killing me, especially on Android. They are extremely infrequent but I have no clue what I can do about them. (We are using gnustl for our standard library in NDK.)

Any advice?

Thanks,

Dan.


------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
asio-users mailing list
asio-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/asio-users
_______________________________________________
Using Asio? List your project at
h
Dan Posluns
2012-12-24 19:06:38 UTC
Permalink
Post by Gruenke, Matt
Perhaps it would help if you could submit a concise example that demonstrates the problem.
At minimum, please submit a call stack with debug info maxed out (at least
enough that we get line numbers &
Post by Gruenke, Matt
filenames) and all optimizations & inlining disabled. Also, please state the
specific version of Boost
Post by Gruenke, Matt
you're using.
Matt
Hi Matt (the web-UI won't allow me to top-post),

I'm using Boost verion 1.50, with BOOST_ASIO_SEPARATE_COMPILATION enabled.

Unfortunately I can't easily reproduce this... we have half a dozen people
running this and it happens pretty infrequently. One of them submitted the stack
trace from bugreport, and our rendering thread has apparently hung in
io_service::poll_one.

I will see if it's possible to get more debug info in there (I'm pretty sure
we're already compiling -O0), but the Android NDK has not generally been very
helpful in this regard.

I guess I'm hoping as much for something anecdotal, if anyone is aware of
conditions which might cause something like poll_one() to hang.

Thanks,

Dan.
Post by Gruenke, Matt
-----Original Message-----
Sent: December 21, 2012 13:50
Subject: [asio-users] Hanging in poll_one
Hi there,
I'm using boost::io_service to manage cross-platform multithreading tasks for
iOS and Android NDK.
Post by Gruenke, Matt
Occasionally, I get hangs on either platform.
My latest problem is io_service::poll_one on Android, which hangs with the
(std::__atomic0::__atomic_base<long>::load(std::memory_order) const+44)
#02 pc 00454f1c /data/app-lib/com.decarta.myditu.nav-1/libnavlib.so
(std::__atomic0::__atomic_base<long>::operator long() const+20)
#03 pc 0044deac /data/app-lib/com.decarta.myditu.nav-1/libnavlib.so
(boost::asio::detail::task_io_service::poll_one(boost::system::error_code&)+60)
I had a similar problem with io_service::run_one on iOS, where the single
worker thread would
Post by Gruenke, Matt
occasionally hang in pthread_cond_wait() no matter how many times I called
post() on the service from a
Post by Gruenke, Matt
different thread. I switched to a poll_one() implementation with my own
condition lock to circumvent it
Post by Gruenke, Matt
on that platform, but the bug remains.
I love the functionality of Boost.Asio but these hangs are killing me,
especially on Android. They are
Post by Gruenke, Matt
extremely infrequent but I have no clue what I can do about them. (We are
using gnustl for our standard
Post by Gruenke, Matt
library in NDK.)
Any advice?
Thanks,
Dan.
------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely
access PCs and mobile
Post by Gruenke, Matt
devices and provide instant support Improve your efficiency, and focus on
delivering more value-add
Post by Gruenke, Matt
services Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
Post by Gruenke, Matt
_______________________________________________
asio-users mailing list
https://lists.sourceforge.net/lists/listinfo/asio-users
_______________________________________________
Using Asio? List your project at
http://think-async.com/Asio/WhoIsUsingAsio
------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
asio-users mailing list
https://lists.sourceforge.net/lists/listinfo/asio-users
_______________________________________________
Using Asio? List your project at
http://think-async.com/Asio/WhoIsUsingAsio
Igor R
2012-12-24 19:54:17 UTC
Permalink
Post by Dan Posluns
I'm using Boost verion 1.50, with BOOST_ASIO_SEPARATE_COMPILATION enabled.
Unfortunately I can't easily reproduce this... we have half a dozen people
running this and it happens pretty infrequently. One of them submitted the stack
trace from bugreport, and our rendering thread has apparently hung in
io_service::poll_one.
I will see if it's possible to get more debug info in there (I'm pretty sure
we're already compiling -O0), but the Android NDK has not generally been very
helpful in this regard.
I guess I'm hoping as much for something anecdotal, if anyone is aware of
conditions which might cause something like poll_one() to hang.
Maybe it just looks like poll_one() hanging, due to some debugger
issue, but actually a completion handlers hangs?
FWIW, perhaps tracing the handlers (see
BOOST_ASIO_ENABLE_HANDLER_TRACKING) could shed some light on the
situation.
vf
2013-01-11 04:37:20 UTC
Permalink
Post by Igor R
Post by Dan Posluns
I'm using Boost verion 1.50, with BOOST_ASIO_SEPARATE_COMPILATION enabled.
Maybe it just looks like poll_one() hanging, due to some debugger
issue, but actually a completion handlers hangs?
So boost.asio is compiled into a static/shared library?
In such instances it would pay to make sure that the compilers and the compiler
switches used to compile the library and the application are identical.

Even seemingly innocent mismatches can cause all sorts of obscure errors.
And symbols and consequently the stack trace could be somewhat screwed.
Loading...