curator-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From madrob <>
Subject [GitHub] curator pull request: CURATOR-157 Avoid stack traces on close
Date Fri, 06 Feb 2015 16:02:05 GMT
Github user madrob commented on the pull request:
    Looks like I neglected to respond to this for a while. Here is why I think the logic is
    T2: `processResult()` method entry
    T2: `synchronized (backgroundTaskMonitor)` acquire lock
    T2: `if (state.get().equals(State.CLOSED)) { }` evaluates false
    T1: `close()` method entry
    T1: `if ( state.compareAndSet(State.STARTED, State.CLOSED) )` evaluates true
    T1: `listeners.clear()`
    T1:  `client.getConnectionStateListenable().removeListener(connectionStateListener)`
    T1 suspends waiting for the lock
    T2: `processBackgroundResult(event)` gets called on a closed connection
    I think the solution is to put all of the `close()` method into the `synchronized` block,
but that is not a super appealing answer. Maybe it will be fine though.
    The other concern is that now we can only process a single background event at a time,
which seems like it could be a pretty high price to pay.

If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at or file a JIRA ticket
with INFRA.

View raw message