You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Sangjin Lee (JIRA)" <ji...@apache.org> on 2009/06/26 23:01:48 UTC

[jira] Closed: (ASYNCWEB-33) timing problems between messageReceived() and the timeout task

     [ https://issues.apache.org/jira/browse/ASYNCWEB-33?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sangjin Lee closed ASYNCWEB-33.
-------------------------------

    Resolution: Fixed

eliminated several timing related issues:

- canceling the timeout task should be done without interrupt (serves little purpose)
- made the timeoutHandle variable in HttpRequestMessage an atomic reference to ensure correct visibility
- set the timeout handle to null at the beginning of the timeout task to minimize the window during which other events may get a hold of the timeout handle
- marked the request as close pending any time we initiate session closing
- when we check out a session from the cache, check the pending close status so if it has a pending close, do not use it
- in cancelTask(), use the removeTimeoutHandle() method to retrieve and remove the handle atomically
- moved up the Future.set() and Future.setException() operations to prior to the monitoring listener notification
- ensure only one callback method fires for a given request by using a flag
- eat up any Throwable that may result as invoking the callback so the flow continues even if callbacks throw exceptions

> timing problems between messageReceived() and the timeout task
> --------------------------------------------------------------
>
>                 Key: ASYNCWEB-33
>                 URL: https://issues.apache.org/jira/browse/ASYNCWEB-33
>             Project: Asyncweb
>          Issue Type: Bug
>          Components: Client
>    Affects Versions: client-1.0.0
>            Reporter: Sangjin Lee
>            Assignee: Sangjin Lee
>
> The progress of the timeout task and that of messageReceived() are fully concurrent. There are a couple of interesting problems. First, if the timeout task launches and in the meantime the messageReceived() method fires, it is possible for messageReceived() to interrupt the timeout task thread.
> The investigation of this issue led to the discovery of another timing-related issue. Namely, if the timeout task launches and in the meantime the messageReceived() method fires, it is possible for messageReceived() to cache the session back into the cache (although the timeout task will try to close the connection later on) so that there is a small window of opportunity that the connection will be checked out for another request. This might cause unexpected session closings.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.