Fork me on GitHub
#datomic
<
2018-05-24
>
adamfrey15:05:33

is there a way to shutdown a datomic cloud client? I've found that when I create a datomic cloud client in a script, my script will hang instead of exiting. I tried to call shutdown-agents but that didn't work

Alex Miller (Clojure team)16:05:58

can you thread dump and see what threads are still alive?

adamfrey16:05:00

yes, but I don't know how to do that

Alex Miller (Clojure team)16:05:19

don’t trust that guy, he’s an idiot

👍 12
🤳 8
😂 4
adamfrey16:05:54

(def d-client (datomic.init/init-client (datomic.init/conn-config)))
Reflection warning, cognitect/hmac_authn.clj:80:12 - call to static method encodeHex on org.apache.commons.codec.binary.Hex can't be resolved (argument types: unknown, java.lang.Boolean).
Reflection warning, cognitect/hmac_authn.clj:80:3 - call to java.lang.String ctor can't be resolved.
2018-05-24 12:11:56.637:INFO::main: Logging initialized @12428ms
=> #'price-alerts.query-test/d-client

(shutdown-agents)
=> nil

(prn
 (.dumpAllThreads
  (java.lang.management.ManagementFactory/getThreadMXBean)
  false
  false))
#object["[Ljava.lang.management.ThreadInfo;" 0x5ebe1552 "[Ljava.lang.management.ThreadInfo;@5ebe1552"]
=> nil

(on-exit (fn* [] (prn "done.....")))
=> nil

adamfrey16:05:00

here's output from my script

Alex Miller (Clojure team)16:05:12

if you’re in a repl, just ctrl-\

adamfrey16:05:04

this is in Stu's transcriptor, but I've noticed the same hanging behavior in all my clj run tasks that start up a datomic client

sparkofreason18:05:12

For test purposes, I am able to start/stop peer servers by running/killing the run script and its child java process by calling the OS shell from clojure. It's an ugly solution, probably OS-dependent, and every call to run takes a fair amount of time to complete. Dev/test processes would be facilitated if I could run just one peer server process and create/delete mem DBs programatically.

adamfrey20:05:06

I'm using datomic cloud, not the peer server, so I don't have a run script in my case

matthavener21:05:17

is that ctrl-\ documented somewhere? I’d never heard of it until today.. wondering if there’s more 🙂

Alex Miller (Clojure team)21:05:02

it’s a jvm thing (ctrl-break on windows, ctrl-\ in *nix)

👍 4
Alex Miller (Clojure team)21:05:18

I don’t think there are any other standard handlers other than ctrl-c

Alex Miller (Clojure team)21:05:35

and most Clojure repls use ctrl-d to quit (although some use ctrl-c)