epiccastle / bbssh

Babashka pod for SSH support.
Eclipse Public License 2.0
56 stars 5 forks source link

Babashka script with bbssh pod gets stuck on exit #14

Closed ramonpin closed 11 months ago

ramonpin commented 1 year ago

While using the pod to download some files from a remote host the script does not terminate, it gets stuck at the end of the main thread code. I thought it might be due to the thread pool used by agents and added the call to (shutdown-agents). However, the script still gets stuck.

I have created a minimal script that reproduces the error:

(ns sample
  (:require [babashka.pods :as pods]))

(def bbsh-pod (pods/load-pod 'epiccastle/bbssh "0.5.0"))
(require '[pod.epiccastle.bbssh.core :as ssh])
(require '[pod.epiccastle.bbssh.scp :as scp])

(def user "user")
(def cert "/home/user/.ssh/id_rsa")

;; Main process
(let [session (ssh/ssh "localhost" {:username user :identity cert})
      opts {:session session}]
  (scp/scp-from "/etc/hosts" "remote-hosts" opts)
  (shutdown-agents)
  (println "shutdown"))

The script actually downloads the file, but does not terminate. Killing the pod manually with (pods/unload-pod bbsh-pod) doesn't work either, it blocks on this call also.

retrogradeorbit commented 11 months ago

The fix has been released in version 0.6.0