This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-03-24
Channels
- # announcements (31)
- # babashka (21)
- # babashka-sci-dev (4)
- # beginners (8)
- # cherry (4)
- # cider (32)
- # clj-kondo (15)
- # cljdoc (4)
- # cljsrn (4)
- # clojure (69)
- # clojure-dev (1)
- # clojure-europe (12)
- # clojure-nl (1)
- # clojure-norway (8)
- # clojure-uk (4)
- # clojurescript (16)
- # clr (6)
- # conjure (4)
- # fulcro (4)
- # hispano (1)
- # honeysql (1)
- # humbleui (5)
- # hyperfiddle (8)
- # lambdaisland (4)
- # lsp (8)
- # malli (24)
- # off-topic (3)
- # polylith (5)
- # reagent (10)
- # remote-jobs (3)
- # rewrite-clj (7)
- # scittle (12)
- # spacemacs (4)
- # sql (2)
- # tools-deps (29)
- # xtdb (7)
Am I hallucinating or is this new?
WARNING: update-vals already refers to: #'clojure.core/update-vals in namespace: clojure.tools.analyzer.utils, being replaced by: #'clojure.tools.analyzer.utils/update-vals
WARNING: update-keys already refers to: #'clojure.core/update-keys in namespace: clojure.tools.analyzer.utils, being replaced by: #'clojure.tools.analyzer.utils/update-keys
Seems benign.No. this is since 1.11 just bump your core.async (usually, core.async is the one that requires the core.analyze)
Hmm. Did not have core.async in there. Might have been some HTTP lib. So I dropped back to Clojure 1.10.3, raising another question: Why am I always bumping my dependencies to the latest version? My thinking is "latest/greatest yay!", but shouldn't I be shooting for "what is the oldest version against which my software will work?". ie, Doesn't an excessive dependency tell people who might need to run against an older Clojure they are out of luck?
lein deps :tree | less
or clj -Stree | less
and search who is requiring the clojure/analyzer
easy solution (i do this): just add the latest analyzer to your deps [org.clojure/tools.analyzer.jvm "1.2.3"]
> Doesn't an excessive dependency tell people who might need to run against an older Clojure they are out of luck? no. it is fine to ignore those warnings. thre is no broken code or anything like that.
Ah, my old buddy cljs.http 0.1.46, with no indication it will ever move forward, pulls in org.clojure/core.async "0.4.474"
I could fork it I suppose and bump the async, but it is there only to support a test.
Thx for the tip on lein deps :tree
, I forgot about that! 🙏
Damn, someday I should read the leiningen
doc! 🙂 But the beauty of lein is that we can get so far without needing to.
Hmm. Did not have core.async in there. Might have been some HTTP lib. So I dropped back to Clojure 1.10.3, raising another question: Why am I always bumping my dependencies to the latest version? My thinking is "latest/greatest yay!", but shouldn't I be shooting for "what is the oldest version against which my software will work?". ie, Doesn't an excessive dependency tell people who might need to run against an older Clojure they are out of luck?
with-redefs
and with-redefs-fn
seem to no longer function?
Compared to: https://clojuredocs.org/clojure.core/with-redefs#example-542692d6c026201cdc3270bc
(with-redefs [type (constantly java.lang.String)
class (constantly 10)]
[(type [])
(class [])])
=> [clojure.lang.PersistentVector clojure.lang.PersistentVector]
Anyone else noticed this?
This could be related to running OpenJDK 19?Works for me
$ java --version
openjdk 19.0.2 2023-01-17
OpenJDK Runtime Environment (Red_Hat-19.0.2.0.7-1.rolling.fc37) (build 19.0.2+7)
OpenJDK 64-Bit Server VM (Red_Hat-19.0.2.0.7-1.rolling.fc37) (build 19.0.2+7, mixed mode, sharing)
$ clj
Clojure 1.11.1
(with-redefs [type (constantly java.lang.String)
class (constantly 10)]
[(type [])
(class [])])
[java.lang.String 10]
@U0JUM502E Do you by any chance have direct linking enabled?
$ clj -J-Dclojure.compiler.direct-linking=true
Clojure 1.10.3
(with-redefs [type (constantly java.lang.String)
class (constantly 10)]
[(type [])
(class [])])
[clojure.lang.PersistentVector clojure.lang.PersistentVector]
Oh ok, yes. Thanks @U04V15CAJ! I've lifted that into the prod profile 😃...
Even in prod this can bite you, if you like to REPL into production and patch things here and there, just something to be aware of :)
^ direct linking (https://clojurians.slack.com/archives/C03S1KBA2/p1679666093842169)
I have a general question about clojure.test with lein test and Exceptions being omitted, any replies would be nice, thanks in advance!
The project I work on relies on mount.lite for state management and uses taoensso.timbre for logging.
The test scenario handling (made by someone other then myself in the past) starts the state-management for each scenario by using use-fixtures
, so far so good. test works fine.
But, I have been scratching my head about one test stopping halfway all day. No error is thrown and the process it should run just stops and state-management stops all started parts and the test ends in a fail without any clues.
I found out that when an Exception is thrown by timbre, this Exception is never printed or logged and the test run just stops.
The following example is exactly what happens and what Exception should be thrown, it just never gets thrown.
(taoensso.timbre/debugf "my % father %s is %s" "living" "john" "nextdoor")
; Execution error (IllegalFormatConversionException) at java.util.Formatter$FormatSpecifier/failConversion (Formatter.java:4442).
; f != java.lang.String
If I execute the above in a repl inside the project, the Exception gets thrown as expected. In the unit test its omitted/ignored, the process does stop as if an Exception was thrown but the Exception isnt printed.
What could cause this?
I am running this on Leiningen 2.10.0, Clojure 1.11.1 and Java17"my *%* father %s is %s" "living"
That first %
needs to be %s
. You have an invalid format string
user=> (taoensso.timbre/debugf "my % father %s is %s" "living" "john" "nextdoor")
Execution error (IllegalFormatConversionException) at java.util.Formatter$FormatSpecifier/failConversion (Formatter.java:4442).
f != java.lang.String
user=> (taoensso.timbre/debugf "my %s father %s is %s" "living" "john" "nextdoor")
2023-03-24T14:52:03.385Z DEBUG [user:1] - my living father john is nextdoor
At first I though it might be because the reduce function its in has side effects, but other side effects get logged / executed just fine.
my guess is the thread you expect to produce a value dies and your test harness is still expecting a value to come from that thread?
It's just the Exception that doesn't get printed/logged when using lein test
but does get logged when running the project
(whatever weirdness with exceptions and fixtures I think I recall may have been fixed)
The Exception should be thrown by the mentioned debugf
from timbre, but isn't. Or atleast, it is probably thrown but not shown or printed or logged anywhere
you might have an uncaught exception handler or something in production that logs things
thing is, if I forcefully create something that should thrown an Exception anywhere in the process, the Exception gets thrown like it should
this specific Exception just isnt logged/printed in the unittest, but is when manually testing the process
are you sure in your tests to force an exception you are doing that on the same thread where the bad logging statement would be run?
I tried testing the separate process function and it does print/log the thrown Exception. But if I wrap the function in a clojure.core.async/thread it's not printed in my repl but I get a message in the Calva terminal:
Exception: clojure.lang.ExceptionInfo thrown from the UncaughtExceptionHandler in thread "async-thread-macro-1"
If I run the process without lein test
with a subset of data the process gets queued using these imports:
[clojure.lang Var]
[java.util.concurrent ConcurrentHashMap Executors RejectedExecutionException]
[java.util.function Function]
The faulty logging gets executed and throws the ExceptionWhen I use the unittest the statemanagement stops the process due to the internal Exception handler catching it, what it does otherwise aswell
when you run the processs outside of testing, does the process hang around after the exception is printed out?
If I do this manually using async/thread it does and I need to interrupt evaluation. It doesn't when testing the process using test data in a live non production environment
its just strange it doesnt get logged. the issue is solved, but for faster debugging it would be a nice to have haha
I would try putting a sleep of a few seconds in before the statemanagement stuff stops anything
not as a fix or anything, but just to see if that causes whatever to get printed / logged
to be clear you expect it to be logged or printed? (going out through print/prn or out through timbre)
I seem to recall timbre failing to flush the stream it is writing to, so you can lose log messages on exit that way (but haven't used timbre in a while, and when I did it drove me nuts so I might be misremembering it unfavorably)
you might also add a class to (flush)
before the statemanagement stuff tears things down
The statemanagement is run by a fixture in the unitest. Ill add the flush there. Might be that is what's not logging the exception as its a try with finally and no catch