Skip to content

Instantly share code, notes, and snippets.

@cemerick
Created March 9, 2015 17:46
Show Gist options
  • Save cemerick/6cc2a276f34177ebf52b to your computer and use it in GitHub Desktop.
Save cemerick/6cc2a276f34177ebf52b to your computer and use it in GitHub Desktop.
quartz scheduling job name / key leak
; CIDER 0.6.0alpha (package: 0.5.0) (Clojure 1.6.0, nREPL 0.2.3)
=> (schedule #(println "foo"))
=> (schedule #(println "foo"))
=> (schedule #(println "foo"))
...
=> (def s (immutant.scheduling.internal/scheduler {}))
#<Var@5f67764a:
#<QuartzScheduling org.projectodd.wunderboss.scheduling.QuartzScheduling@450109d4>>
; scheduled job names (and thus their JobKeys) are retained, even if they're not repeating
=> (.scheduledJobs s)
#{"3c1a9db4-d1ac-44dd-b227-c5154e1f3d49" "aa754df5-5ec1-478c-9db4-535baface3f4" "d4475c8b-e3de-4d86-a529-28eb8b181e32"}
; stopping completed jobs returns `true` (seems like a bug?), but that removes the leaked name/JobKey
=> (immutant.scheduling/stop :id (first *1))
true
=> (.scheduledJobs s)
#{"aa754df5-5ec1-478c-9db4-535baface3f4" "d4475c8b-e3de-4d86-a529-28eb8b181e32"}
=> (schedule #(println "foo"))
=> (schedule #(println "foo"))
=> (schedule #(println "foo"))
=> (schedule #(println "foo"))
=> (schedule #(println "foo"))
=> (schedule #(println "foo"))
=> (.scheduledJobs s)
#{"54f38c0f-bef6-42e0-8530-92c709879904" "a98797bd-3e07-4b6e-89c2-1d0d7ca6749c" "aa754df5-5ec1-478c-9db4-535baface3f4" "d4475c8b-e3de-4d86-a529-28eb8b181e32" "7398f583-d23b-49f6-b06c-0472f02e9fca" "a9459289-6b08-4fa9-9a04-df2493ddb7bf" "a77a214c-ae96-4c81-9948-11ac496d9484"}
; looks like there needs to be some cleanup around https://github.com/projectodd/wunderboss/blob/master/modules/scheduling/src/main/java/org/projectodd/wunderboss/scheduling/QuartzScheduling.java#L214,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment