This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-02-06
Channels
- # announcements (2)
- # architecture (2)
- # aws (18)
- # babashka (7)
- # beginners (149)
- # bristol-clojurians (4)
- # calva (11)
- # chlorine-clover (1)
- # cider (8)
- # clj-kondo (2)
- # cljdoc (2)
- # cljsrn (2)
- # clojure (186)
- # clojure-canada (3)
- # clojure-europe (3)
- # clojure-gamedev (5)
- # clojure-italy (1)
- # clojure-nl (13)
- # clojure-norway (4)
- # clojure-spec (25)
- # clojure-uk (32)
- # clojurescript (75)
- # core-async (2)
- # cursive (16)
- # data-science (3)
- # datomic (20)
- # docker (1)
- # emacs (26)
- # fulcro (7)
- # graphql (1)
- # incanter (1)
- # leiningen (1)
- # luminus (7)
- # malli (7)
- # mount (11)
- # off-topic (19)
- # pathom (15)
- # re-frame (9)
- # reagent (9)
- # remote-jobs (4)
- # ring-swagger (4)
- # shadow-cljs (63)
- # spacemacs (11)
- # sql (2)
- # vscode (7)
I have stumbled upon an interesting edge-case and I'm trying to figure out if I am misinterpreting the facts: • I am using testcontainers to setup postgres for `clojure.tests` • In one of my tests I perform the following steps • i) get 2 seperate PgConnection out of Hikari Connection Pool • ii) query _`pg_try_advisory_lock`_ from connection a). It returns true. • iii) query _`pg_advisory_lock`_ from within a `future` on connection b). It blocks as expected • iv) query _`pg_advisory_unlock`_on connection b). I expected this to return false; *but actually it hangs* This surprises me. Does it surprise all/any of you? Java stack traces reveals that it is blocked on ```org.postgresql.core.v3.QueryExecutorImpl public synchronized void execute(Query query, ParameterList parameters, ResultHandler handler, int maxRows, int fetchSize, int flags) throws SQLException { waitOnLock();``` which is the natural consequence of calling ``` -- :name advisory-unlock :? :1 SELECT (pg_advisory_unlock(:big_figure, :little_figure));``` as a HugSQL query So the fact that there is an acquireLock outstanding means that *all further queries block* until that lock is satisfied; even an unlock This is an edge case; I don't need it In Real Life but I'd like to understand what is happening, and how I can mitigate it.
I have updated my test to wrap the pg_advisory_unlock
inside a future
and then take a friendly interest in when it becomes realized?
and that's probably the best I can do