This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-01-30
Channels
- # announcements (20)
- # asami (26)
- # babashka (10)
- # babashka-sci-dev (18)
- # beginners (81)
- # biff (6)
- # calva (6)
- # cider (1)
- # clerk (1)
- # clj-kondo (34)
- # clojure (50)
- # clojure-belgium (1)
- # clojure-berlin (6)
- # clojure-europe (20)
- # clojure-nl (1)
- # clojure-norway (22)
- # clojure-uk (2)
- # clojurescript (1)
- # clr (4)
- # community-development (3)
- # data-science (8)
- # datomic (3)
- # gratitude (1)
- # honeysql (6)
- # instaparse (2)
- # jobs (1)
- # jobs-discuss (13)
- # kaocha (7)
- # london-clojurians (1)
- # lsp (6)
- # malli (8)
- # matcher-combinators (9)
- # missionary (3)
- # nbb (8)
- # off-topic (20)
- # pathom (16)
- # polylith (2)
- # practicalli (3)
- # rdf (1)
- # re-frame (7)
- # reagent (3)
- # releases (2)
- # reveal (6)
- # rewrite-clj (22)
- # shadow-cljs (64)
- # tools-build (7)
- # xtdb (13)
We are deploying an Uberjar to a Docker container and after about 19 days the docker reports a graceful shutdown:
app | 1702694476 INFO app.core - Shutting down system.
app exited with code 143
app exited with code 0
We are using this as our -main
:
(defn -main [& _]
(let [system (prod-system)
shutdown-promise (promise)]
(.addShutdownHook (Runtime/getRuntime) (Thread. (fn []
(log/info "Shutting down system.")
(component/stop-system system)
(deliver shutdown-promise true))))
(component/start system)
@shutdown-promise))
The strange thing is the container is still running and the app is still responsive. Any suggestions on how to debug this greatly appreciated.exit code 143 means there was SIGTERM signal sent to your application. https://docs.docker.com/engine/reference/commandline/events/ you could monitor docker events to see if this happens due to some error, low memory for example
Through a docker-compose with restart: unless-stopped
and a Dockerfile (`eclipse-temurin:17-jre`) with CMD ["java", "-Dhttp.proxyHost=...", "-Dhttp.proxyPort=80", "-Dhttps.proxyHost=...", "-Dhttps.proxyPort=80", "-Dconf=/app/conf.edn", "-jar", "/app/app.jar"]
.
Oh. The last time it occured was further back than 1000 log entries. I guess I will have to wait until it occurs again.
btw, there are --since
and --until
options for docker events
so you can fetch events around exact time of exit
At the time I didn't realize anything happened since the application kept on working
Figured out what it was when it happened again today. We enabled automatic upgrades with dnf-automatic
and it had an update for containerd which caused docker to restart.
Is there a way to open a repl server in another thread, send some stuff to it and see if it continues to work and then turn it down?
My idea is to have a test to prohibit people to break repl driven with certain commands
👋 I was looking to add a reader macro extension for a symbolic value, along the lines of the existing ##Inf
and ##NaN
, and https://github.com/clojure/tools.reader/blob/v1.3.6/src/main/clojure/clojure/tools/reader.clj#L412-L419
I'm curious if there is a specific reason for that?
For context, I work with a weird database that represents the absence of a date using the smallest date value: (java.sql.Date. -1899 0 1)
.
I got to thinking it would be nice to be able to write queries like [:= :some-field ##null-db-date]
instead of using a tagged literal like [:= :some-field #sql-date "0001-01-01"]
https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LispReader.java#L743 here is the place where actual implementation defined
main idea behind it is not extendable is that clojure code must remains "readable" to the standard Clojure. and that is not achievable if it would be possible to introduce something like you describe in original question.
I'm not sure I follow that reasoning. Like wouldn't that apply to ability to define your own tagged value readers?
to some degree - yes. official, defined through api, scope for tagged literals is clojure.edn/read which accept mapping from tag to function and clojure.core/read which can use redefined mapping. That way it is possible to at least read tagged literal as is even if you don't have the implementation for actual reading function.
symbolic values are a tool for us, not for you :)
at least this is my understanding
tagged literals are a tool for you
just out of curiosity, why the need for a data literal? Wouldn't a (def null-db-date (Date. -1899 0 1))
suffice?
> just out of curiosity, why the need for a data literal? Wouldn't a (def null-db-date (Date. -1899 0 1))
suffice?
also possible, but it would require the namespace that contains null-db-date
to be required. And also doesn't work when writing out to edn files
yeah, it wouldn't work for edn files. I guess you could always define a custom reader, e.g. #null-db-date ""
or maybe #my/sql-date
(i.e. support both #my/sql-date "2020-01-02"
and #my/sql-date "none"
)
> symbolic values are a tool for us, not for you 🙂 I can understand not wanting to expand the surface area of this for a feature that would rarely make sense to use by clojure programmers (especially with the point @U04V4KLKCmade about a default reader). Yet in this case I don't know how much I understand or buy this "us/you" distinction. I see the capability to define and use one's own special constants a useful tool to both Clojure maintainers and maintainers of systems written in Clojure
that's what tagged literals are for
and edn does support https://github.com/edn-format/edn#tagged-elements, not sure I understand that complaint above
I think it is the same as @U05476190 suggested. Totally works, differing only in that it requires requiring the namespace everywhere it is used, but perhaps that is a good thing.
Anyways, wanted to thank everyone for exploring this question. I really love Clojure because it almost never prevents me from implementing the ideas I have in my head. The times that I do run up against the limits of the language, I often realize that it is me that was misguided in my framing of the problem/solution. This feels very mind-expanding and so very contrary to so many other languages out there.
Hey folks. Just about to open-source a number of libraries in case people might find them useful. Any suggestions for how to do that? Just post them here on Clojurians? Or...
To clarify, I'm just referring to the "getting it out there" bit so it reaches whomever might find it useful. Not deploying or whatnot.
If you want to reach as many eyes as possible, I'd post in every place mentioned at https://clojure.org/community/resources#_clojure_discussion
Remember to include the purpose of each library so people know why they should look at them. 😁 I see a lot of things posted in #C06MAR553 that I don't look at because I don't know what they are (and my learning Todo list is already quite long)
What’s a good way to impliment a union find aka https://en.wikipedia.org/wiki/Disjoint-set_data_structure in clojure?
Are there some good blog articles or other resources on investigating memory leaks in Clojure code?
https://www.yourkit.com/java/profiler/ yourkit has very good memory profiler
Thanks @U04V4KLKC! I love the look of that program
That was super effective @U04V4KLKC - thanks for the prod. I've heard about YourKit before and even tried it a bunch of years ago. It's pretty discoverable.
And fixed! It was almost worth writing the buggy code for the fun experience of finding what was wrong. I hope my subconscious isn't listening and getting any ideas. Thanks again.
There's also this https://www.eclipse.org/mat/ which I only used one time when yourkit /visualVM were failing me for discovering a memory leak, and I forgot the details but just remember it seemed magic in the way it just told me directly what was causing my memory leak