-
Notifications
You must be signed in to change notification settings - Fork 50
Description
I've got two virtually identical scripts that I'm running on a remote server, both of which succeed and complete on the remote server, but one of which hangs (that is, its scala-ssh session only terminates after command timeout). I'm executing them via this scala code:
def remoteRequest(req: SlackRequest): Either[Throwable, SlackResponse] = for {
server <- findServer(req)
studyOpt <- findStudy(req, server.id)
commandInput <- getCommandInput(req)
commandResult <- {
val domain = studyOpt.map(_.domain).getOrElse("")
SSH(server.host, HostResourceConfig()) {
client =>
for {
result <- {
val command = Command(s"bash -s -- $domain ${req.args.mkString(" ")}", commandInput)
client.exec(command)
}
} yield result
}.toEither
}
response <- processRemoteResult(req, commandResult)
} yield responseHere's the host resource config:
# scala-ssh host config file
login-type = password
username = exxxxxxxxxxr
password = blahblahblah
fingerprint = any
command-timeout = 30000
I've attached two scripts, along with their logs. The lock_user.sh.txt script runs successfully on the remote server and scala-ssh returns normally after the command finishes. The unlock_user.sh.txt script also runs successfully on the remote server but scala-ssh hangs and only terminates when the command timeout is triggered. I've verified the unlock script succeeds, both by running it manually via the command line and because the db update succeeds.
lock_user.sh.txt
lock-ok.log
unlock_user.sh.txt
unlock-fail.log
Can anyone explain what's going on here? I can't tell what's different between these two cases. I've also changed the order of their execution, to no avail (that is, same result...lock always succeeds, unlock always hangs until timeout). I've got other scripts, some of which work and some of which hang even though all succeed in executing and terminating normally on the remote server, so I don't think this has anything to do with the scripts themselves.
Thanks for any insights.