Skip to content

hooks enabled: an exporter exiting via onFailure: exit reports itself as Available to the controller #245

@evakhoni

Description

@evakhoni

exporter with beforehook fail exit, reports itself as available before closing, so the controller keeps reporting it like this for a while.
also, an attempt to lease it in this state is causing a client to acquire a lease and freeze.

 uv run jmp shell --selector hooks=both --duration 30m 
[02/17/26 19:05:40] INFO     Acquiring lease 019c6c90-935b-70d3-9c0f-79388873f4a3 for selector hooks=both for duration 0:30:00 [jumpstarter.client.lease]
                    INFO     Waiting for ready connection at /run/user/1000/jumpstarter-9rs3mgl_/socket [jumpstarter.client.lease]
                    INFO     Status changed: None -> BEFORE_LEASE_HOOK_FAILED (version=3) [jumpstarter.client.status_monitor]
                    INFO     Releasing Lease 019c6c90-935b-70d3-9c0f-79388873f4a3 [jumpstarter.client.lease]
Error: beforeLease hook failed (on_failure=exit, shutting down): Hook failed with exit code 127


 uv run jmp admin get exporter --namespace jumpstarter-lab
NAME             STATUS     ENDPOINT                               DEVICES  AGE  
hooks-test-both  Available  grpc.jumpstarter.10.0.0.1.nip.io:8082  3        6d21h
hooks-test-none  Offline    grpc.jumpstarter.10.0.0.1.nip.io:8082  0        6d21h


 uv run jmp shell --selector hooks=both --duration 30m 
[02/17/26 19:06:00] INFO     Acquiring lease 019c6c90-e1be-75b2-8891-477cced1ef4c for selector hooks=both for duration 0:30:00 [jumpstarter.client.lease]
                    INFO     Waiting for ready connection at /run/user/1000/jumpstarter-ymsxey97/socket [jumpstarter.client.lease]
^CSIGINT pressed, terminating
[02/17/26 19:06:05] INFO     Releasing Lease 019c6c90-e1be-75b2-8891-477cced1ef4c [jumpstarter.client.lease]

exporter with afterLease fail exit, disconnects the client with connection lost error, and similarly reports as available at the controller

 uv run jmp shell --selector hooks=both --duration 30m 
[02/17/26 19:09:29] INFO     Acquiring lease 019c6c94-12a6-716a-ab0b-ee9994e4bd28 for selector hooks=both for duration 0:30:00 [jumpstarter.client.lease]
                    INFO     Waiting for ready connection at /run/user/1000/jumpstarter-gsahhm8v/socket [jumpstarter.client.lease]
                    INFO     Status changed: None -> LEASE_READY (version=3) [jumpstarter.client.status_monitor]
python ⚡hooks-test-both ➤ 
[02/17/26 19:09:32] INFO     Running afterLease hook (Ctrl+C to skip)... [jumpstarter_cli.shell]
                    INFO     Starting hook subprocess... [exporter:afterLease]
                    INFO     Creating PTY pair... [exporter:afterLease]
                    INFO     PTY created: parent_fd=16, child_fd=17 [exporter:afterLease]
                    INFO     Executing inline script (interpreter: /bin/sh) [exporter:afterLease]
                    INFO     Spawning subprocess with command: ['/bin/sh', '-c', 'echo "exit failure prelease"\nexit 127\n'] [exporter:afterLease]
                    INFO     Subprocess spawned with PID 2728537 [exporter:afterLease]
                    INFO     Starting PTY output reader and process waiter (timeout=60) [exporter:afterLease]
                    INFO     Task group created, starting tasks... [exporter:afterLease]
                    INFO     Waiting for subprocess to complete... [exporter:afterLease]
                    INFO     exit failure prelease [exporter:afterLease]
                    INFO     Subprocess completed with code: 127 [exporter:afterLease]
[02/17/26 19:09:52] INFO     Connection lost (UNAVAILABLE), signaling waiters [jumpstarter.client.status_monitor]
Error: Ready for commands

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions