Skip to content

Requests hang when communicating with Incus Socket #22

Open
@mamoss-oss

Description

@mamoss-oss

Hi,
I am trying to use the unix http socket to communicate with Incus. But it seems like any communication I try either hangs, or takes very long time in its first execution and then becomes instant for every consecutive function execution. Not sure from which angle I should try to troubleshoot the issue. Also I am very new to the clojure world, but will try my best to provide details.

Thank you.


Minimal example

(ns incus-clojure.src
  (:require [unixsocket-http.core :as uhttp]))

(def client (uhttp/client "unix:///var/lib/incus/unix.socket"))
(uhttp/get client "/")

As soon as I send the get function to evaluation in the editor repl, it blocks.


Sanity check: Incus socket works when targeted with curl. No delay seen at all.

curl --unix-socket /var/lib/incus/unix.socket http://localhost/
{"type":"sync","status":"Success","status_code":200,"operation":"","error_code":0,"error":"","metadata":["/1.0"]}

I also used the example commands in the repository readme with the docker socket and did not see any issues.


Repl output with delay in the first function execution. Measured with the time function. I have no idea why it sometimes works with delay and sometimes it does not work at all.

clj꞉user꞉> 
nil
clj꞉incus-clojure.src꞉> 
#'incus-clojure.src/client
clj꞉incus-clojure.src꞉> 
; "Elapsed time: 15255.987157 msecs"
{:status 200,
 :headers {"content-type" "application/json", "date" "Wed, 07 Aug 2024 18:49:48 GMT", "content-length" "114"},
 :body
 "{\"type\":\"sync\",\"status\":\"Success\",\"status_code\":200,\"operation\":\"\",\"error_code\":0,\"error\":\"\",\"metadata\":[\"/1.0\"]}\n"}
true
clj꞉incus-clojure.src꞉> 
; "Elapsed time: 0.626226 msecs"
{:status 200,
 :headers {"content-type" "application/json", "date" "Wed, 07 Aug 2024 18:49:59 GMT", "content-length" "114"},
 :body
 "{\"type\":\"sync\",\"status\":\"Success\",\"status_code\":200,\"operation\":\"\",\"error_code\":0,\"error\":\"\",\"metadata\":[\"/1.0\"]}\n"}
clj꞉incus-clojure.src꞉> 
; "Elapsed time: 0.595186 msecs"
{:status 200,
 :headers {"content-type" "application/json", "date" "Wed, 07 Aug 2024 18:50:01 GMT", "content-length" "114"},
 :body
 "{\"type\":\"sync\",\"status\":\"Success\",\"status_code\":200,\"operation\":\"\",\"error_code\":0,\"error\":\"\",\"metadata\":[\"/1.0\"]}\n"}

Environment

:deps  {unixsocket-http/unixsocket-http {:mvn/version "1.0.14"}

java -version
openjdk version "22.0.2" 2024-07-16
OpenJDK Runtime Environment (build 22.0.2+9)
OpenJDK 64-Bit Server VM (build 22.0.2+9, mixed mode, sharing)

clojure -version
Clojure CLI version 1.11.4.1474

uname -a
Linux cachyos-x8664 6.10.3-3-cachyos #1 SMP PREEMPT_DYNAMIC Sun, 04 Aug 2024 15:20:27 +0000 x86_64 GNU/Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions