init-stm (and reset-stm) are only used for creating an STM that will be used by every client. You only want to call it once, not every time a client connects.
I could be more clever about calling it when it's clear that it hasn't been called before though. I'll dedicate that patch to you :) > I tried looking at the docstrings for each fn but they were both nil :-( Oops, I'll fix that. David On Dec 1, 2011, at 12:36 PM, Sam Aaron wrote: > Out of interest, why is #'init-stm a separate step to #'connect > > I tried looking at the docstrings for each fn but they were both nil :-( > > Sam > > --- > http://sam.aaron.name > > On 1 Dec 2011, at 17:21, David Edgar Liebke wrote: > >> Did you initialize the STM? >> >> (init-stm client) >> >> You only need to do it the first time, to set up the necessary zookeeper >> nodes, it's described in the main tutorial but not the snippet on the top of >> the avout site. >> >> David >> >> On Dec 1, 2011, at 12:15 PM, Sam Aaron wrote: >> >>> Hi David, >>> >>> thanks for looking into this so promptly. Sadly 0.5.1 just throws a >>> different exception: >>> >>> user=> (def client (connect "127.0.0.1")) >>> >>> >>> #'user/client >>> >>> >>> user=> (def r0 (zk-ref client "/r0" 0)) >>> >>> >>> java.lang.RuntimeException: >>> org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = >>> NoNode for /stm/history/t- >>> >>> run-in-transaction exception: #<RuntimeException >>> java.lang.RuntimeException: >>> org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = >>> NoNode for /stm/history/t-> nil >>> at clojure.lang.Util.runtimeException(Util.java:165) >>> >>> >>> at clojure.lang.Reflector.invokeInstanceMethod(Reflector.java:35) >>> >>> >>> at avout.transaction$run_in_transaction.invoke(transaction.clj:356) >>> >>> >>> at avout.core$zk_ref.doInvoke(core.clj:51) >>> >>> >>> at clojure.lang.RestFn.invoke(RestFn.java:445) >>> >>> >>> at clojure.lang.AFn.applyToHelper(AFn.java:167) >>> >>> >>> at clojure.lang.RestFn.applyTo(RestFn.java:132) >>> >>> >>> at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:3337) >>> >>> >>> at clojure.lang.Compiler$DefExpr.eval(Compiler.java:375) >>> >>> >>> at clojure.lang.Compiler.eval(Compiler.java:6470) >>> >>> >>> at clojure.lang.Compiler.eval(Compiler.java:6431) >>> >>> >>> at clojure.core$eval.invoke(core.clj:2795) >>> >>> >>> at clojure.main$repl$read_eval_print__5967.invoke(main.clj:244) >>> >>> >>> at clojure.main$repl$fn__5972.invoke(main.clj:265) >>> >>> >>> at clojure.main$repl.doInvoke(main.clj:265) >>> >>> >>> at clojure.lang.RestFn.invoke(RestFn.java:512) >>> >>> >>> at user$eval27$acc__3869__auto____30$fn__32.invoke(NO_SOURCE_FILE:1) >>> >>> >>> at clojure.lang.AFn.run(AFn.java:24) >>> >>> >>> at java.lang.Thread.run(Thread.java#'user/r0 >>> >>> >>> user=> :680) >>> >>> >>> Caused by: org.apache.zookeeper.KeeperException$NoNodeException: >>> KeeperErrorCode = NoNode for /stm/history/t- >>> >>> at >>> org.apache.zookeeper.KeeperException.create(KeeperException.java:102) >>> >>> >>> at >>> org.apache.zookeeper.KeeperException.create(KeeperException.java:42) >>> >>> >>> at org.apache.zookeeper.ZooKeeper.create(ZooKeeper.java:637) >>> >>> >>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >>> >>> >>> at >>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) >>> >>> >>> at >>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) >>> >>> >>> at java.lang.reflect.Method.invoke(Method.java:597) >>> >>> >>> at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:92) >>> >>> >>> at clojure.lang.Reflector.invokeInstanceMethod(Reflector.java:30) >>> >>> >>> at zookeeper$create.doInvoke(zookeeper.clj:158) >>> >>> >>> at clojure.lang.RestFn.invoke(RestFn.java:521) >>> >>> >>> at avout.transaction$next_point.invoke(transaction.clj:62) >>> >>> >>> at avout.transaction$reincarnate_txn.invoke(transaction.clj:233) >>> >>> >>> at avout.transaction$stop$fn__1104.invoke(transaction.clj:243) >>> >>> >>> at avout.transaction$stop.invoke(transaction.clj:238) >>> >>> >>> at >>> avout.transaction.LockingTransaction$fn__1117.invoke(transaction.clj:323) >>> >>> >>> at >>> avout.transaction.LockingTransaction.runInTransaction(transaction.clj:303) >>> >>> >>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >>> >>> >>> at >>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) >>> >>> >>> at >>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) >>> >>> >>> at java.lang.reflect.Method.invoke(Method.java:597) >>> >>> >>> at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:92) >>> >>> >>> at clojure.lang.Reflector.invokeInstanceMethod(Reflector.java:30) >>> >>> >>> ... 17 more >>> >>> >>> also, trying to avoid setting the value on creation of the ref doesn't work >>> either: >>> >>> >>> >>> >>> user=> (def r1 (zk-ref client "/r1")) >>> >>> >>> #'user/r1 >>> >>> >>> user=> (dosync!! client (ref-set!! r1 0)) >>> >>> >>> java.lang.RuntimeException: >>> org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = >>> NoNode for /stm/history/t- >>> >>> run-in-transaction exception: #<RuntimeException >>> java.lang.RuntimeException: >>> org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = >>> NoNode for /stm/history/t-> nil >>> nil >>> >>> >>> at clojure.lang.Util.runtimeException(Util.java:165) >>> >>> >>> at clojure.lang.Reflector.invokeInstanceMethod(Reflector.java:35) >>> >>> >>> at avout.transaction$run_in_transaction.invoke(transaction.clj:356) >>> >>> >>> at user$eval1426.invoke(NO_SOURCE_FILE:49) >>> >>> >>> at clojure.lang.Compiler.eval(Compiler.java:6465) >>> >>> >>> at clojure.lang.Compiler.eval(Compiler.java:6431) >>> >>> >>> at clojure.core$eval.invoke(core.clj:2795) >>> >>> >>> at clojure.main$repl$read_eval_print__5967.invoke(main.clj:244) >>> >>> >>> at clojure.main$repl$fn__5972.invoke(main.clj:265) >>> >>> >>> at clojure.main$repl.doInvoke(main.clj:265) >>> >>> >>> at clojure.lang.RestFn.invoke(RestFn.java:512) >>> >>> >>> at user$eval27$acc__3869__auto____30$fn__32.invoke(NO_SOURCE_FILE:1) >>> >>> >>> at clojure.lang.AFn.run(AFn.java:24) >>> >>> >>> at java.lang.Thread.run(Thread.java:680) >>> >>> >>> Caused by: org.apache.zookeeper.KeeperException$NoNodeException: >>> KeeperErrorCode = NoNode for /stm/history/t- >>> >>> at >>> org.apache.zookeeper.KeeperException.create(KeeperException.java:102) >>> >>> >>> at >>> org.apache.zookeeper.KeeperException.create(KeeperException.java:42) >>> >>> >>> atuser=> org.apache.zookeeper.ZooKeeper.create(ZooKeeper.java:637) >>> >>> >>> at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source) >>> >>> >>> at >>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) >>> >>> >>> at java.lang.reflect.Method.invoke(Method.java:597) >>> >>> >>> at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:92) >>> >>> >>> at clojure.lang.Reflector.invokeInstanceMethod(Reflector.java:30) >>> >>> >>> at zookeeper$create.doInvoke(zookeeper.clj:158) >>> >>> >>> at clojure.lang.RestFn.invoke(RestFn.java:521) >>> >>> >>> at avout.transaction$next_point.invoke(transaction.clj:62) >>> >>> >>> at avout.transaction$reincarnate_txn.invoke(transaction.clj:233) >>> >>> >>> at avout.transaction$stop$fn__1104.invoke(transaction.clj:243) >>> >>> >>> at avout.transaction$stop.invoke(transaction.clj:238) >>> >>> >>> at >>> avout.transaction.LockingTransaction$fn__1117.invoke(transaction.clj:323) >>> >>> >>> at >>> avout.transaction.LockingTransaction.runInTransaction(transaction.clj:303) >>> >>> >>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >>> >>> >>> at >>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) >>> >>> >>> at >>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) >>> >>> >>> at java.lang.reflect.Method.invoke(Method.java:597) >>> >>> >>> at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:92) >>> >>> >>> at clojure.lang.Reflector.invokeInstanceMethod(Reflector.java:30) >>> >>> >>> ... 12 more >>> >>> Sam >>> >>> --- >>> http://sam.aaron.name >>> >>> On 1 Dec 2011, at 17:04, David Edgar Liebke wrote: >>> >>>> Thanks Sam and Edmund, >>>> >>>> The stack traces were helpful, I think I understand what the immediate >>>> problem is. It appears that the transaction ID in these cases is not >>>> getting set, and then Avout is trying to write data to the ZooKeeper node >>>> /stm/history/ instead of /stm/history/txid. >>>> >>>> Since I can't replicate the problem with my setup, I can't be certain of >>>> the cause, but I've added a patch to make the STM more robust in the face >>>> of a nil transaction ID, and have updated Avout to version 0.5.1. >>>> >>>> Can you guys give the version 0.5.1 a try and see if makes a difference? >>>> >>>> If you still see the problem, another diagnostic would be to create a ref >>>> without an initial value, and see if that succeeds, then try setting the >>>> value. >>>> >>>> (def r1 (zk-ref client "/r1")) >>>> (dosync!! client (ref-set!! r1 0)) >>>> >>>> Thanks again, >>>> David >>>> >>>> >>>> >>>> On Dec 1, 2011, at 11:20 AM, Sam Aaron wrote: >>>> >>>>> Hi David, >>>>> >>>>> I nuked all my zookeeper deps in my lib and ~/.m2 dirs, but similar to >>>>> Edmund experience it doesn't fix anything. My stacktrace is also >>>>> identical: >>>>> >>>>> ∴ /Users/sam/tmp/avv >>>>> >>>>> λ lein deps >>>>> >>>>> Downloading: zookeeper-clj/zookeeper-clj/0.9.0/zookeeper-clj-0.9.0.pom >>>>> from repository clojars at http://clojars.org/repo/ >>>>> Transferring 2K from clojars >>>>> >>>>> Downloading: zookeeper-clj/zookeeper-clj/0.9.0/zookeeper-clj-0.9.0.jar >>>>> from repository clojars at http://clojars.org/repo/ >>>>> Transferring 9K from clojars >>>>> >>>>> Copying 8 files to /Users/sam/tmp/avv/lib >>>>> >>>>> Copying 5 files to /Users/sam/tmp/avv/lib/dev >>>>> >>>>> >>>>> ∴ /Users/sam/tmp/avv >>>>> >>>>> λ lein repl >>>>> >>>>> Listening for transport dt_socket at address: 52602 >>>>> >>>>> REPL started; server listening on localhost port 33063 >>>>> >>>>> user=> (use 'avout.core) >>>>> >>>>> log4j:WARN No appenders could be found for logger >>>>> (org.apache.zookeeper.ZooKeeper). >>>>> >>>>> log4j:WARN Please initialize the log4j system properly. >>>>> >>>>> log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for >>>>> more info. >>>>> nil >>>>> >>>>> user=> (def client (connect "127.0.0.1")) >>>>> >>>>> #'user/client >>>>> >>>>> user=> (def r0 (zk-ref client "/r0" 0)) >>>>> >>>>> java.lang.IllegalArgumentException: Path must not end with / character >>>>> >>>>> run-in-transaction exception: #<IllegalArgumentException >>>>> java.lang.IllegalArgumentException: Path must not end with / character> >>>>> nil >>>>> at >>>>> org.apache.zookeeper.common.PathUtils.validatePath(PathUtils.java:58) >>>>> >>>>> at org.apache.zookeeper.ZooKeeper.setData(ZooKeeper.java:1025) >>>>> >>>>> at zookeeper$set_data.doInvoke(zookeeper.clj:394) >>>>> >>>>> at clojure.lang.RestFn.invoke(RestFn.java:470) >>>>> >>>>> at avout.transaction$update_txn_state.invoke(transaction.clj:82) >>>>> >>>>> at avout.transaction$stop$fn__1104.invoke(transaction.clj:239) >>>>> >>>>> at avout.transaction$stop.invoke(transaction.clj:238) >>>>> >>>>> at >>>>> avout.transaction.LockingTransaction$fn__1117.invoke(transaction.clj:321) >>>>> >>>>> at >>>>> avout.transaction.LockingTransaction.runInTransaction(transaction.clj:301) >>>>> >>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >>>>> >>>>> at >>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) >>>>> >>>>> at >>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) >>>>> >>>>> at java.lang.reflect.Method.invoke(Method.java:597) >>>>> >>>>> at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:92) >>>>> >>>>> at >>>>> clojure.lang.Reflector.invokeInstanceMethod(Reflector.java:30#'user/r0 >>>>> >>>>> user=> ) >>>>> >>>>> at avout.transaction$run_in_transaction.invoke(transaction.clj:354) >>>>> >>>>> at avout.core$zk_ref.doInvoke(core.clj:51) >>>>> >>>>> at clojure.lang.RestFn.invoke(RestFn.java:445) >>>>> >>>>> at clojure.lang.AFn.applyToHelper(AFn.java:167) >>>>> >>>>> at clojure.lang.RestFn.applyTo(RestFn.java:132) >>>>> >>>>> at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:3337) >>>>> >>>>> at clojure.lang.Compiler$DefExpr.eval(Compiler.java:375) >>>>> >>>>> at clojure.lang.Compiler.eval(Compiler.java:6470) >>>>> >>>>> at clojure.lang.Compiler.eval(Compiler.java:6431) >>>>> >>>>> at clojure.core$eval.invoke(core.clj:2795) >>>>> >>>>> at clojure.main$repl$read_eval_print__5967.invoke(main.clj:244) >>>>> >>>>> at clojure.main$repl$fn__5972.invoke(main.clj:265) >>>>> >>>>> at clojure.main$repl.doInvoke(main.clj:265) >>>>> >>>>> at clojure.lang.RestFn.invoke(RestFn.java:512) >>>>> >>>>> at user$eval27$acc__3869__auto____30$fn__32.invoke(NO_SOURCE_FILE:1) >>>>> >>>>> at clojure.lang.AFn.run(AFn.java:24) >>>>> >>>>> at java.lang.Thread.run(Thread.java:680) >>>>> >>>>> >>>>> Sam >>>>> >>>>> --- >>>>> http://sam.aaron.name >>>>> >>>>> On 1 Dec 2011, at 15:39, David Edgar Liebke wrote: >>>>> >>>>>> Hi Sam, >>>>>> >>>>>>> run-in-transaction exception: #<IllegalArgumentException >>>>>>> java.lang.IllegalArgumentException: Path must not end with / character> >>>>>>> nil >>>>>> >>>>>> Very interesting, I wouldn't expect that particular exception unless you >>>>>> named the zk-ref "/r0/" instead of "/r0", which you apparently didn't. >>>>>> >>>>>> And even when I do call it "/r0/" I get the "Path must not end with / >>>>>> character" exception at a different point in the code, which is probably >>>>>> the result of a patch I added to zookeeper-clj yesterday. >>>>>> >>>>>> Can you try deleting the zookeeper-clj jar file from your dependencies, >>>>>> blowing about your ~/.m2/repository/zookeeper-clj directory, reloading >>>>>> your deps, and trying again? >>>>>> >>>>>> David >>>>>> >>>>>> >>>>>> On Dec 1, 2011, at 10:04 AM, Sam Aaron wrote: >>>>>> >>>>>>> Hi David, >>>>>>> >>>>>>> I'm super excited by Avout. It seems *better* than magic in that it not >>>>>>> only appears to make complicated things possible, but also in a >>>>>>> conceptually transparent way. Crazy cool. >>>>>>> >>>>>>> I'm about to look into this in detail, but I thought I'd just post an >>>>>>> issue I'm having with the basic example just on the off-chance that I'm >>>>>>> doing something obviously wrong. >>>>>>> >>>>>>> I have zookeeper 3.3.3 installed running on port 2181 with a valid >>>>>>> dataDir path with the appropriate permissions. I'm got avout 0.5.0 and >>>>>>> in a REPL session I do the following: >>>>>>> >>>>>>> ; SLIME 2009-10-15 >>>>>>> >>>>>>> user> (use 'avout.core) >>>>>>> >>>>>>> nil >>>>>>> >>>>>>> user> (def client (connect "127.0.0.1")) >>>>>>> >>>>>>> #'user/client >>>>>>> >>>>>>> user> (def r0 (zk-ref client "/r0" 0)) >>>>>>> >>>>>>> run-in-transaction exception: #<IllegalArgumentException >>>>>>> java.lang.IllegalArgumentException: Path must not end with / character> >>>>>>> nil >>>>>>> #'user/r0 >>>>>>> >>>>>>> user> r0 >>>>>>> >>>>>>> #<DistributedReference@761b2f32: nil> >>>>>>> >>>>>>> user> @r0 >>>>>>> >>>>>>> nil >>>>>>> >>>>>>> >>>>>>> Sam >>>>>>> >>>>>>> --- >>>>>>> http://sam.aaron.name >>>>>>> >>>>>>> >>>>>>> On 29 Nov 2011, at 17:38, liebke wrote: >>>>>>> >>>>>>>> Today we are releasing Avout, which brings Clojure's in-memory model >>>>>>>> of state to distributed application development by providing a >>>>>>>> distributed implementation of Clojure's Multiversion Concurrency >>>>>>>> Control (MVCC) STM along with distributable, durable, and extendable >>>>>>>> versions of Clojure's Atom and Ref concurrency primitives. >>>>>>>> >>>>>>>> Here's the post announcing the project: >>>>>>>> http://clojure.com/blog/2011/11/29/avout.html >>>>>>>> >>>>>>>> And here's the project's website: http://avout.io >>>>>>>> >>>>>>>> >>>>>>>> David >>>>>>>> >>>>>>>> -- >>>>>>>> You received this message because you are subscribed to the Google >>>>>>>> Groups "Clojure" group. >>>>>>>> To post to this group, send email to clojure@googlegroups.com >>>>>>>> Note that posts from new members are moderated - please be patient >>>>>>>> with your first post. >>>>>>>> To unsubscribe from this group, send email to >>>>>>>> clojure+unsubscr...@googlegroups.com >>>>>>>> For more options, visit this group at >>>>>>>> http://groups.google.com/group/clojure?hl=en >>>>>>> >>>>>>> -- >>>>>>> You received this message because you are subscribed to the Google >>>>>>> Groups "Clojure" group. >>>>>>> To post to this group, send email to clojure@googlegroups.com >>>>>>> Note that posts from new members are moderated - please be patient with >>>>>>> your first post. >>>>>>> To unsubscribe from this group, send email to >>>>>>> clojure+unsubscr...@googlegroups.com >>>>>>> For more options, visit this group at >>>>>>> http://groups.google.com/group/clojure?hl=en >>>>>> >>>>>> -- >>>>>> You received this message because you are subscribed to the Google >>>>>> Groups "Clojure" group. >>>>>> To post to this group, send email to clojure@googlegroups.com >>>>>> Note that posts from new members are moderated - please be patient with >>>>>> your first post. >>>>>> To unsubscribe from this group, send email to >>>>>> clojure+unsubscr...@googlegroups.com >>>>>> For more options, visit this group at >>>>>> http://groups.google.com/group/clojure?hl=en >>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "Clojure" group. >>>>> To post to this group, send email to clojure@googlegroups.com >>>>> Note that posts from new members are moderated - please be patient with >>>>> your first post. >>>>> To unsubscribe from this group, send email to >>>>> clojure+unsubscr...@googlegroups.com >>>>> For more options, visit this group at >>>>> http://groups.google.com/group/clojure?hl=en >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Clojure" group. >>>> To post to this group, send email to clojure@googlegroups.com >>>> Note that posts from new members are moderated - please be patient with >>>> your first post. >>>> To unsubscribe from this group, send email to >>>> clojure+unsubscr...@googlegroups.com >>>> For more options, visit this group at >>>> http://groups.google.com/group/clojure?hl=en >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Clojure" group. >>> To post to this group, send email to clojure@googlegroups.com >>> Note that posts from new members are moderated - please be patient with >>> your first post. >>> To unsubscribe from this group, send email to >>> clojure+unsubscr...@googlegroups.com >>> For more options, visit this group at >>> http://groups.google.com/group/clojure?hl=en >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Clojure" group. >> To post to this group, send email to clojure@googlegroups.com >> Note that posts from new members are moderated - please be patient with your >> first post. >> To unsubscribe from this group, send email to >> clojure+unsubscr...@googlegroups.com >> For more options, visit this group at >> http://groups.google.com/group/clojure?hl=en > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en