sprites not shutting off

Yes, a good chunk of improvements have gone out regarding this. Old sprites are likely stuck in their ways, as it were, new sprites will behave better.

Also worth nothing that in all or most of these cases, we won’t be billing for Sprites that are not suspending. The “trying to suspend” state isn’t represented in the Sprite status, but is a trigger for us to stop billing.

3 Likes

New sprite. The script that @phiat posted spins up an entire new sprite from scratch. And there’s nothing on it. It doesn’t go to sleep though. At least, that’s what happened when I tried it yesterday.

2 Likes

Test seems to be succeeding now:

=== Creating sprite: sleep-test-1769525491 ===
cold

=== Touching sprite (quick exec) ===

=== Monitoring status (expecting ‘warm’ after ~30s) ===
Waiting 45s…
[45s] status: warm
SUCCESS: sprite went warm

=== Cleanup ===
Deleted sleep-test-1769525491

Edit: despite this successful test, I continue to have problems - see below.

Hmm - I took my successful test with that script to be a sign that things were working properly with shutdown now. So I deleted my old sprites and decided to start again. I installed the latest version of the sprite CLI and created a new sprite, then logged into it and:

  1. Created an SSH key

  2. Downloaded a git repo

  3. Started Claude Code and authenticated

That’s it. Then I exited.

That was 15 minutes ago and my sprite status is still “running”.

I don’t get why I’m having so much trouble with this. I shelled into the sprite to check processes, not much:

sprite@sprite:~# ps -ax
PID TTY STAT TIME COMMAND
1 ? Ss 0:00 /.pilot/tini – tail -f /dev/null
2 ? S 0:00 tail -f /dev/null
741 pts/0 Ss 0:00 zsh --login
747 pts/0 R+ 0:00 ps -ax

Edit: after 17m, it went warm! Hurray!

1 Like

hi @bglw any update on the status of this?

Things are still in the works! Our dev Sprites are suspending correctly, so once that rolls out this will be fully resolved. Current production Sprites will behave as @adriand shows: They will suspend, but with more of a delay than we would like.

1 Like

A few tricks claude taught me to figure out what’s causing it to be stuck in running:

  • see what processes are running in your sprite, the services command doesn’t show background ones: sprite -s <sprite-id> exec bash -c "cat /proc/*/comm 2>/dev/null | sort -u”
  • kill something: sprite -s <sprite-id> exec bash -c "pkill -f node”
  • and also check max_run_after_disconnect, it should default to 10s but TTY commands stay open

I haven’t quite figured out what makes it go from warm → cold though, since warm counts against your concurrent limit too.

Background processes and services won’t keep your sprite running, only exec commands/sessions, and inbound network requests. Detached exec sessions also won’t keep it running unless they are actively producing stdout.

warm → cold has no particular guarantees either way at the moment, but this isn’t something you’ll have to think about at all. Warm and cold are both non-billed outside of storage, and your processes are not running.

2 Likes

I noticed much better sleeping/shutdown behavior lately. My earlier test above now returns “unknown” for the status, looks like it might take ~1m to get warm status. Either way, less hanging running sprites.

Thanks for the updates, looks like some good progress.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.