This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-10-26
Channels
- # announcements (7)
- # babashka (6)
- # beginners (41)
- # clara (27)
- # clerk (2)
- # cljs-dev (6)
- # clojure (121)
- # clojure-europe (31)
- # clojure-nl (2)
- # clojure-norway (98)
- # clojure-uk (12)
- # clojuredesign-podcast (7)
- # conjure (5)
- # cursive (22)
- # holy-lambda (22)
- # hoplon (9)
- # hyperfiddle (19)
- # leiningen (9)
- # malli (4)
- # music (1)
- # nbb (6)
- # off-topic (10)
- # podcasts-discuss (1)
- # polylith (4)
- # re-frame (2)
- # reitit (2)
- # releases (1)
- # sci (1)
- # shadow-cljs (59)
- # sql (9)
- # vim (41)
- # xtdb (23)
Can anyone help me with the syntax to fetch the entity via http client library where the eid
is namespaced?
For example the following doesnโt work: (xt/entity (xt/db node) (keyword "movie" "123"))
. Gives me the following error,
; Execution error (ExceptionInfo) at xtdb.remote-api-client/api-request-sync (remote_api_client.clj:88).
; HTTP status 500
Hey again, I don't obviously see what could be going wrong there :thinking_face: Does it return the entity okay when not using the http client lib? Are non-namespaced keyword eids working fine?
Yes the non-namespaced keyword eids work just fine.
It also throws an error via making the direct API call. Can you point out if I am doing anything wrong? The API Call:
curl --location '' \
--header 'Accept: application/edn'
you are possibly hitting some edge case from using a number for the name component of the keyword...which Clojure doesn't properly support, see https://ask.clojure.org/index.php/10225/problem-using-numbers-as-keywords
if so, I don't think XT can easily fix this without it being resolved in Clojure first
Right. Any workaround using eid-json
or just eid
. Or the only workaround right now is not to use number for the name component?
(xt/entity (xt/db node) (keyword "movie" "123"))
This works when node is not the xtdb-http-client
but a node with its own configuration.
I expect it's something getting lost in the transit encode/decode steps. Given the number is essentially stored as string anyway (keywords are handled near enough the same as strings in general), I suggest just prefixing it with an extra char would be simple enough as a workaround (xt/entity (xt/db node) (keyword "movie" (str "n" "123")))
hey all, had a quick question about testing with xtdb... I've gotten testing with clojure.test working pretty well in the repl but having a few issues on the command line... I've noticed that when I run clj -X:test
and there is a test that uses an xtdb node, it always hangs after the tests complete (unless there is a failing test in which case it exits). I've thinned down my test suite to a single xtdb test with no assertions and the hanging is still showing up, here is what the file looks like:
(ns ajakate.seekwence.game-test
(:require [clojure.test :refer :all]
[xtdb.api :as xt]))
(deftest test-xtdb
(testing "xtdb"
(with-open [node (xt/start-node {})]
(xt/submit-tx node
[[::xt/put
{:xt/id "7823"
:game/state :init}]]))))
I've tried all kinds of different ways of using the xtdb node, including with-open
, (.close node)
and test fixtures, but I can't seem to get rid of the hanging... just wondering if anyone has run into this or has any insight (Using kit if that makes any difference)If you leave it alone for a minute or so, do you get the command-line back?
If so, it's due to agents running in the background (that a (shutdown-agents)
call in -main
would normally take care of).
doesn't seem to give it back... there is a lot of xtdb debug logging I see in the console and the repl, the ending output for the command line tests looks like:
2023-10-26 17:44:57,593 [main] DEBUG xtdb.system - Starting [:xtdb/node]
2023-10-26 17:44:57,593 [main] DEBUG xtdb.system - Starting [:xtdb.bus/bus-stop]
2023-10-26 17:44:57,598 [main] DEBUG xtdb.mem-kv - Using fsync on MemKv has no effect.
2023-10-26 17:44:57,598 [xtdb-standalone-submit-tx-1] DEBUG xtdb.memory - :pool-allocation-stats {:allocated 262144, :deallocated 0, :in-use 262144}
2023-10-26 17:44:57,600 [xtdb-tx-subscription-1] DEBUG xtdb.memory - :pool-allocation-stats {:allocated 393216, :deallocated 0, :in-use 393216}
2023-10-26 17:44:57,603 [main] INFO xtdb.tx - Shut down tx-ingester
Ran 2 tests containing 1 assertions.
0 failures, 0 errors.
the last line makes me think at least a shutdown signal is being sent to the xtdb node, but not sure
It may also be futures/agents in your own code or some other library you're using. "shutdown signal [is] being sent to the xtdb node" is not what I'm talking about here, just to be clear.
gotcha, makes sense. I'll poke around further and see if I can figure out what's going on. thanks for the help!
Hey @UR5D2FW06 we had a report about something similar at the beginning of the year https://github.com/xtdb/xtdb/issues/1882
Are you running 1.24.1
?
ah interesting... I tried adding the shutdown-agents
call to my :once fixture, and got that working on the CLI, but then that ended up crashing my repl ๐
FWIW, after playing around with a lot of solutions, changing my command line call from clj -X:test
to clojure -A:test
seemed to do the trick (command line doesn't exit and repl tests work using my code from above). Haven't had a chance yet to poke into why that may be but at least I can get back to doing stuff ๐คท . The alias for test defined in my deps.edn is just the default that comes with kit

looks like I can try bumping to 1.24.1 in that case
@UR5D2FW06 what CLI version are you using? clj -version
1.11.1.1155
OK, that's after the change of behavior in the CLI around thread pools and waiting (1.10.3.933, July 2021) but yours is still a pretty old version (August 2022). So this may be addressed by updating XTDB as above.