Boost logo

Boost Users :

Subject: [Boost-users] [ASIO] deadline_timer
From: Caleb (caleb_lyness_at_[hidden])
Date: 2010-06-21 05:21:56


Greetings,

I have a boost ASIO application which is using deadline_timer for operation
timeouts. It has been used for quite some time, but I have noticed some odd
behavior with the timeout cancellation. The following is a brief description of
the problem.

First I initiate a connection request and setup a timeout timer

  set timer for 30 seconds
  async timer wait
  async connection request

A couple of millseconds later the connection is up and in the callback I cancel
the timer and start the next phase

  cancel timer
  start data activity...

Most of the time the cancel is successful and I get the callback with operation
canceled(as expected). But occasionally the cancel fails and returns 0 async
operations effected, however this cannot be as the timer was created and is
active (but not yet timed out)... then ~30 seconds later the timer goes off (and
I treat it as a timeout). This occurs on average about 1 time per 20 connection
attempts. The application is currently single threaded.

Another developer has indicated that he has experienced similar issues. He is
working on a completely different project with a different code base. The other
developer worked around the issue by checking an internal state before
propagating the timeout. I am loathed to do this, but have a similar work around
in mind. Both the projects are building against version 1.39.0. I have done a
diff between the latest version of boost and the 1.39.0 and did not spot any
blaring fixes wrt deadline_timer.

Has anyone else experienced this problem? Any patches/bug fixes in place for it?
I am trying to reproduce this behavior consistently with some small sample code
and have yet to do so.

Thanks in advance for the help.

Cheers
    Caleb


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