Skip to content

Linux bootstrap writes /etc/spawn/plugins.json after starting spored, which reads it only at startup #1023

Closed

Description

@scttfrdmn

Found while working on #1007 (PR #1021). Read from the code, not reproduced live.

BuildLinuxBootstrap (pkg/launcher/bootstrap.go) appends the --plugin declarations (cat > /etc/spawn/plugins.json) after linuxBootstrapBody. The body ends with systemctl start spored, and the unit is Type=simple, so systemctl start returns as soon as the process is forked.

spored reads the file once:

  1. provider.NewEC2Provider calls loadConfigFromEC2Tags, which calls loadPluginDeclarations().
  2. agent.newAgent then calls rt.LoadFromDeclarations only when activate && len(config.Plugins) > 0.

RefreshConfig re-reads config.Plugins later, but nothing loads plugins after startup.

So declared plugins load only if the bootstrap's cat wins a race against spored's IMDS reads and its first DescribeTags. The bootstrap usually wins, because writing a file is fast. Anything that slows the bootstrap between those two points silently drops every plugin: a slow disk, or a check added there (#1021 placed its post-spored check after the plugins block for exactly this reason, with a gate).

Fix: write plugins.json before linuxBootstrapBody, the way /etc/spawn/command and the ready-gates list already are, and gate the order. Note the effect on a Spot replacement: spored would then also load plugins there, concurrently with its #995 retirement check. That is no worse than today, which only depends on the race.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions