Skip to content

Loading…

This solves race condition in unit tests if you try to shutdown a worker... #523

Open
wants to merge 1 commit into from

2 participants

@jasonjckn
Collaborator

... which cleans up worker state while you also try to wait for worker to launch by reading the same

state.

@jasonjckn jasonjckn referenced this pull request
Merged

Added SystemBolt. #517

Jason Jackson This solves race condition in unit tests if you try to shutdown a wor…
…ker which cleans up worker state while you also try to wait for worker to launch by reading the same

state.
b7fbd28
@nathanmarz
Owner

I don't understand this patch. I recently changed LocalState to check for FileNotFoundException's. Also the state's for workers are independent as each worker is given a unique id on launching.

@jasonjckn
Collaborator

Which branch did you "changed LocalState to check for FileNotFoundException" I saw nothing in master.
The race condition is between https://github.com/nathanmarz/storm/blob/master/src/clj/backtype/storm/daemon/supervisor.clj#L141 and https://github.com/nathanmarz/storm/blob/master/src/clj/backtype/storm/daemon/supervisor.clj#L115

if L141 happens first then you get the exception.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 26, 2013
  1. This solves race condition in unit tests if you try to shutdown a wor…

    Jason Jackson committed
    …ker which cleans up worker state while you also try to wait for worker to launch by reading the same
    
    state.
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 1 deletion.
  1. +6 −1 src/clj/backtype/storm/daemon/supervisor.clj
View
7 src/clj/backtype/storm/daemon/supervisor.clj
@@ -112,7 +112,12 @@
(defn- wait-for-worker-launch [conf id start-time]
(let [state (worker-state conf id)]
(loop []
- (let [hb (.get state LS-WORKER-HEARTBEAT)]
+ (let [hb (try (.get state LS-WORKER-HEARTBEAT)
+ (catch java.io.FileNotFoundException e
+ ;; This solves race condition in unit tests if you try to shutdown
+ ;; a worker which cleans up worker state while you also try to wait
+ ;; for worker to launch by reading the same state.
+ nil))]
(when (and
(not hb)
(<
Something went wrong with that request. Please try again.