Discussion:
Running Programs that use Datomic Client API
Chris Duncan
2017-04-14 10:13:38 UTC
Permalink
Hi, I'm pretty new to Clojure and Datomic and am gradually getting to grips
with things. I've noticed something that has me puzzled and wondered if
anyone has an explanation.

I have the following dependencies in my project.clj -

[[org.clojure/clojure "1.8.0"]
[com.outpace/data.csv "0.1.3"]
[semantic-csv "0.2.1-alpha1"]
[clj-time "0.13.0"]
[com.datomic/clj-client "0.8.606"]
[proto-repl "0.3.1"]]

In my program I define a connection -

(def conn
(<!! (client/connect ...

I create entities successfully and everything looks good.

However, when I run my program using 'lein run' in a bash shell on Ubuntu
16.04, the process keeps running even after the program has completed its
work.

Ctrl + C terminates the process but I can't figure out why it doesn't
terminate on its own.

Also, if I try to create a .jar file with 'lein uberjar', the task never
finishes. Just hangs indefinitely.

Any insight into the above would be much appreciated.
--
You received this message because you are subscribed to the Google Groups "Datomic" group.
To unsubscribe from this group and stop receiving emails from it, send an email to datomic+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Tim Gilbert
2017-04-14 18:13:28 UTC
Permalink
This is purely guesswork, but I've seen issues where logging frameworks
will keep thread pools around for a while after the main thread has
existed. I'd suggest calling (System/exit) at the end of your main routine,
which will quit any lingering threads.

Tim
Post by Chris Duncan
Hi, I'm pretty new to Clojure and Datomic and am gradually getting to
grips with things. I've noticed something that has me puzzled and wondered
if anyone has an explanation.
I have the following dependencies in my project.clj -
[[org.clojure/clojure "1.8.0"]
[com.outpace/data.csv "0.1.3"]
[semantic-csv "0.2.1-alpha1"]
[clj-time "0.13.0"]
[com.datomic/clj-client "0.8.606"]
[proto-repl "0.3.1"]]
In my program I define a connection -
(def conn
(<!! (client/connect ...
I create entities successfully and everything looks good.
However, when I run my program using 'lein run' in a bash shell on Ubuntu
16.04, the process keeps running even after the program has completed its
work.
Ctrl + C terminates the process but I can't figure out why it doesn't
terminate on its own.
Also, if I try to create a .jar file with 'lein uberjar', the task never
finishes. Just hangs indefinitely.
Any insight into the above would be much appreciated.
--
You received this message because you are subscribed to the Google Groups "Datomic" group.
To unsubscribe from this group and stop receiving emails from it, send an email to datomic+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Chris Duncan
2017-04-14 18:31:19 UTC
Permalink
Hi Tim, thanks for the suggestion. (System/exit 0) did the job.
Post by Tim Gilbert
This is purely guesswork, but I've seen issues where logging frameworks
will keep thread pools around for a while after the main thread has
existed. I'd suggest calling (System/exit) at the end of your main routine,
which will quit any lingering threads.
Tim
Post by Chris Duncan
Hi, I'm pretty new to Clojure and Datomic and am gradually getting to
grips with things. I've noticed something that has me puzzled and wondered
if anyone has an explanation.
I have the following dependencies in my project.clj -
[[org.clojure/clojure "1.8.0"]
[com.outpace/data.csv "0.1.3"]
[semantic-csv "0.2.1-alpha1"]
[clj-time "0.13.0"]
[com.datomic/clj-client "0.8.606"]
[proto-repl "0.3.1"]]
In my program I define a connection -
(def conn
(<!! (client/connect ...
I create entities successfully and everything looks good.
However, when I run my program using 'lein run' in a bash shell on Ubuntu
16.04, the process keeps running even after the program has completed its
work.
Ctrl + C terminates the process but I can't figure out why it doesn't
terminate on its own.
Also, if I try to create a .jar file with 'lein uberjar', the task never
finishes. Just hangs indefinitely.
Any insight into the above would be much appreciated.
--
You received this message because you are subscribed to the Google Groups "Datomic" group.
To unsubscribe from this group and stop receiving emails from it, send an email to datomic+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Devin Walters
2017-04-15 07:24:02 UTC
Permalink
Hi Tim,

In addition to or instead of Tim's suggestion, you might also try calling
(shutdown-agents). I consider this to be "polite" even if it isn't always
strictly necessary.

From the docs:
"Note that use of Agents starts a pool of non-daemon background threads
that will prevent shutdown of the JVM. Use shutdown-agents
<https://clojure.github.io/clojure/clojure.core-api.html#clojure.core/shutdown-agents> to
terminate these threads and allow shutdown."

Cheers,
Devin
Post by Chris Duncan
Hi Tim, thanks for the suggestion. (System/exit 0) did the job.
Post by Tim Gilbert
This is purely guesswork, but I've seen issues where logging frameworks
will keep thread pools around for a while after the main thread has
existed. I'd suggest calling (System/exit) at the end of your main routine,
which will quit any lingering threads.
Tim
Post by Chris Duncan
Hi, I'm pretty new to Clojure and Datomic and am gradually getting to
grips with things. I've noticed something that has me puzzled and wondered
if anyone has an explanation.
I have the following dependencies in my project.clj -
[[org.clojure/clojure "1.8.0"]
[com.outpace/data.csv "0.1.3"]
[semantic-csv "0.2.1-alpha1"]
[clj-time "0.13.0"]
[com.datomic/clj-client "0.8.606"]
[proto-repl "0.3.1"]]
In my program I define a connection -
(def conn
(<!! (client/connect ...
I create entities successfully and everything looks good.
However, when I run my program using 'lein run' in a bash shell on
Ubuntu 16.04, the process keeps running even after the program has
completed its work.
Ctrl + C terminates the process but I can't figure out why it doesn't
terminate on its own.
Also, if I try to create a .jar file with 'lein uberjar', the task never
finishes. Just hangs indefinitely.
Any insight into the above would be much appreciated.
Cheers,
Devin
--
You received this message because you are subscribed to the Google Groups "Datomic" group.
To unsubscribe from this group and stop receiving emails from it, send an email to datomic+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Chris Duncan
2017-04-15 08:29:48 UTC
Permalink
Hi Devin,

Thanks for your suggestion. I saw the same entry in the docs and tried
(shutdown-agents), however, it did not halt the process. I suspect that
logback might have something to do with it (as Tim suggested) because I get
the following message when my program runs -

2017-04-15 09:09:23.515:INFO::main: Logging initialized @2848ms

As I understand it, the Datomic transactor uses logback for logging. I
don't know enough about how logback works to say whether or not it is the
source of my issue.

I'm happy to use System/exit for now until a more elegant solution comes to
light.

Chris
Post by Chris Duncan
Hi Tim,
In addition to or instead of Tim's suggestion, you might also try calling
(shutdown-agents). I consider this to be "polite" even if it isn't always
strictly necessary.
"Note that use of Agents starts a pool of non-daemon background threads
that will prevent shutdown of the JVM. Use shutdown-agents
<https://clojure.github.io/clojure/clojure.core-api.html#clojure.core/shutdown-agents> to
terminate these threads and allow shutdown."
Cheers,
Devin
Post by Chris Duncan
Hi Tim, thanks for the suggestion. (System/exit 0) did the job.
Post by Tim Gilbert
This is purely guesswork, but I've seen issues where logging frameworks
will keep thread pools around for a while after the main thread has
existed. I'd suggest calling (System/exit) at the end of your main routine,
which will quit any lingering threads.
Tim
Post by Chris Duncan
Hi, I'm pretty new to Clojure and Datomic and am gradually getting to
grips with things. I've noticed something that has me puzzled and wondered
if anyone has an explanation.
I have the following dependencies in my project.clj -
[[org.clojure/clojure "1.8.0"]
[com.outpace/data.csv "0.1.3"]
[semantic-csv "0.2.1-alpha1"]
[clj-time "0.13.0"]
[com.datomic/clj-client "0.8.606"]
[proto-repl "0.3.1"]]
In my program I define a connection -
(def conn
(<!! (client/connect ...
I create entities successfully and everything looks good.
However, when I run my program using 'lein run' in a bash shell on
Ubuntu 16.04, the process keeps running even after the program has
completed its work.
Ctrl + C terminates the process but I can't figure out why it doesn't
terminate on its own.
Also, if I try to create a .jar file with 'lein uberjar', the task
never finishes. Just hangs indefinitely.
Any insight into the above would be much appreciated.
Cheers,
Devin
--
You received this message because you are subscribed to the Google Groups "Datomic" group.
To unsubscribe from this group and stop receiving emails from it, send an email to datomic+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...