This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-07-28
Channels
- # announcements (33)
- # aws (2)
- # babashka (14)
- # beginners (128)
- # calva (34)
- # cestmeetup (3)
- # clj-kondo (12)
- # cljdoc (3)
- # clojure (114)
- # clojure-europe (31)
- # clojure-italy (3)
- # clojure-nl (7)
- # clojure-uk (6)
- # clojurescript (35)
- # conjure (20)
- # cursive (3)
- # data-science (3)
- # datomic (16)
- # docker (13)
- # events (1)
- # figwheel-main (22)
- # fulcro (109)
- # jobs (1)
- # kaocha (8)
- # keechma (1)
- # lambdaisland (5)
- # malli (1)
- # meander (8)
- # mid-cities-meetup (1)
- # off-topic (6)
- # overtone (7)
- # pathom (6)
- # re-frame (2)
- # reitit (9)
- # ring (1)
- # shadow-cljs (92)
- # specter (1)
- # tools-deps (311)
- # xtdb (76)
Crosspost #ring Hi, i am trying to compile a ring app as war (lein ring uberwar), to run on tomcat. It is may be a stupid question, but i can't find how to start crux node on launch. Once i start the DB it blocks. I did try to use the
{:ring {:init app.core/init-db ... }
If someone has a tip ? Many thanks and have a nice dayHey @U0F7M1KA7 - if you're starting Crux with crux/start-node
, that call shouldn't block - after all, it needs to return the node to you.
Could you share the app.core/init-db
function, or the relevant parts of it? Happy to go via DM if that's preferable.
Also, are you trying to run it using Crux's http-server module? It's been a while since I've used Tomcat et al, but I suspect you don't want us to be starting up an HTTP server as well
Hi @U050V1N74, many thanks Here is the code :init use start-node and :destroy stop-node
(defonce node (atom nil)))
(defn start-node [storage-dir]
(reset! node
(crux/start-node {:crux.node/topology '[crux.standalone/topology
crux.kv.rocksdb/kv-store]
:crux.standalone/event-log-dir "opt/crux-store/eventlog-1"
:crux.kv/db-dir "opt/crux-store/db")})))
(defn stop-node
[]
(.close @node))
thanks - probably unrelated, but you'll want to include :crux.standalone/event-log-kv-store 'crux.kv.rocksdb/kv
in the topology map too (we've got a docs change coming to clarify this)
hmm :thinking_face: I wonder what's different between that and what lein ring does...
after that, I'd probably try lein ring uberjar
, see whether that starts correctly (taking Tomcat out of the loop)
I don't know of anything in Crux that'd conflict with Tomcat I'm afraid. Will have a think...
Hi @U050V1N74 I had this logs in catalina.out may be it tell you something ? otherwise i continue digging 🙂 Many thanks
28-Jul-2020 17:50:36.434 WARNING [https-jsse-nio-8443-exec-3] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [ehdsicts2] appears to have started a thread named [crux.io.cleaner-thread] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
java.lang.Object.wait(Native Method)
java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:144)
java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:165)
$cleanup_loop.invokeStatic(io.clj:29)
$cleanup_loop.invoke(io.clj:27)
clojure.lang.AFn.run(AFn.java:22)
java.lang.Thread.run(Thread.java:748)
28-Jul-2020 17:50:36.435 SEVERE [https-jsse-nio-8443-exec-3] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [ehdsicts2] created a ThreadLocal with key of type [java.lang.ThreadLocal.SuppliedThreadLocal] (value [java.lang.ThreadLocal$SuppliedThreadLocal@7977fff8]) and a value of type [org.agrona.ExpandableDirectByteBuffer] (value [ExpandableDirectByteBuffer{address=140448946589376, capacity=128, byteBuffer=java.nio.DirectByteBuffer[pos=0 lim=128 cap=128]}]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
Thanks 🙂 I'd be surprised if fixing that fixed your problem, but it is interesting - we evidently assume that some of our namespaces aren't ever going to be unloaded, which doesn't apply if Crux is being run in an application server.
It's probably no more than a handful of references - are you able to create a shutdown function that we could then temporarily populate with manual cleanup, see if that makes a difference? (or, at least, removes those errors 🙂)
I did try to start crux node insert some docs in it and then close the node but still the same problem. Is that what you mean ?
ah - it looks like you have control over a :destroy
function - I wonder whether explicitly closing the resources that Tomcat says we're leaking might fix those logged errors
first one to try would be something like (doto @#'
- that should clear the
but I doubt this'll fix the wider issue, tbh - if it's that the Crux node isn't starting at all
Increasing the allocated memory of tomcat but that is not woking too. The crux node is starting and the insert are working correctly (all the files in the db and eventlog-1 folder are generated but tomcat freeze after that; Each time tomcat reload files, it create more and more folder in the temp folder
mm, it's not a lot of memory that it'll be leaking each time, but will add up over time and many re-deploys
any idea what it's doing when it freezes? cpu to 100, say, or blocked waiting at a specific line?
It seems that there is a problem with threadlocals Memeory protection from tomcat but don't know what do with this 😞 https://github.com/redisson/redisson/issues/599
I did try
(defonce node (atom nil)); (start-node "crux-store"))
(defn start-node [storage-dir]
(reset! node
(crux/start-node {:crux.node/topology '[crux.standalone/topology
crux.kv.rocksdb/kv-store]
:crux.standalone/event-log-dir "/Users/ouvanous/ehdsi-cts/crux-store/eventlog-1"
:crux.standalone/event-log-kv-store 'crux.kv.rocksdb/kv
:crux.kv/db-dir (str "/Users/ouvanous/ehdsi-cts/crux-store/db")}))
nil)
(defn stop-node
[]
(.close @node)
(reset! node nil)
(doto @#' .interrupt .join))
I wonder would it be useful to use jconsole to see where the threads are blocked?
Here is the response from weavejester on lein-ring: "You may want to check whether or not Crux is blocking the current thread, and whether or not Tomcat allows background threads, or what its permission model is like for servlets." Don't know exactly what to do but i'll search 🙂
Hi @U7KD4HQ1W Here are jconsole screenshots
according to SO if you kill -3 <tomcat-pid>
it'll print all that to catalina.out
, save you screenshotting them 🙂
I don't find how to use jstack when deployed as tomcat change process everytime it try to restart
Can this be a problem ? 20-07-30 09:08:50 ouvasam INFO [crux.hash.jnr:1] - dlopen(libgcrypt.dylib, 9): image not found
That should be fine - Crux has a number of hashing strategies, this is saying that it couldn't load one of them.
If it can't find any of them, it falls back to java.security
hi i'm having an issue on crux-jdbc and crux-core 20.07-1.9.2-beta where i get Execution error at crux.topology/resolve-id (topology.clj:15).
No such var: lru/wrap-lru-cache
. nesting details (also should i be posting this here or somewhere else like as a github issue?)
i'm using mount
to manage my crux node:
(defn ^ICruxAPI start-jdbc-sqlite-node []
(crux/start-node
{:crux.node/topology '[crux.jdbc/topology]
:crux.jdbc/dbtype "sqlite"
:crux.jdbc/dbname "glam_db.sqlite"}))
(defstate crux-node
:start (start-jdbc-sqlite-node)
:stop (.close crux-node))
when I call start-jdbc-sqlite-node
on its own without calling mount/start
it works OK, the issue only occurs when I call mount/start
to begin my application. this error doesn't occur when i downgrade to 20.06-1.8.5-alpha, so i'm not positive what's going on but it seems maybe crux is involved somehowprobably a good time to introduce Github 'Discussions' - we were invited into the beta this morning 🙂 https://github.com/juxt/crux/discussions
another strange thing is that this started happening halfway into my development session yesterday, when I feel like I hadn't touched any code that could have changed crux's behavior in the meantime... made me wonder if the root cause had to do with files somewhere that are somehow invalid
Evening all - 1.10.0 is out 🚀 Full release notes at https://github.com/juxt/crux/releases/tag/20.07-1.10.0, but here are the highlights: * SQL query support https://github.com/juxt/crux/tree/20.07-1.10.0/crux-sql * Speculative transactions - 'what if this transaction were applied?' https://github.com/juxt/crux/tree/20.07-1.10.0/docs/speculative.adoc * More types of entity IDs - particularly, strings and longs. This one needs an index version bump - details in the release notes. * EQL Projections (aka 'pull syntax') https://github.com/juxt/crux/tree/20.07-1.10.0/docs/projections.adoc Enjoy 🙂