Skip to content

GetFSxFilesystem panics on a filesystem that is still CREATING (nil DNSName / MountName) #618

Closed

Description

@scttfrdmn

Found while implementing #613's visibility fixes (#617), which had to route around this rather than change shared behaviour.

The bug

(*Client).GetFSxFilesystem (pkg/aws/fsx.go:262) dereferences two fields unconditionally when building its return value:

return &FSxInfo{
	FileSystemID:    *fs.FileSystemId,
	DNSName:         *fs.DNSName,                          // nil while CREATING
	MountName:       *fs.LustreConfiguration.MountName,    // nil while CREATING
	StorageCapacity: *fs.StorageCapacity,
	...
}, nil

A filesystem in CREATING has neither a DNSName nor a LustreConfiguration — both are populated when it becomes AVAILABLE. So calling this against a filesystem that is still provisioning is a nil-pointer dereference, not an error return.

*fs.StorageCapacity is unguarded too, though in practice FSx sets it at create time.

Why it matters

CREATING is not a rare state — it is the state #613 actually hit. FSx Lustre takes minutes to provision, and #613's reporter terminated the instance while the filesystem was still CREATING. Any code path that reaches this function during that window crashes the CLI rather than reporting something useful.

Both callers are reachable in that window:

  • cmd/launch_single.go:540 — resolving an existing filesystem by id during launch
  • cmd/task.go:966 — the task path's FSx lookup

A panic here is worse than the missing data: the user gets a stack trace instead of "filesystem fs-… is still provisioning", on a code path that is otherwise about to do real work.

Suggested fix

Make the derefs nil-safe and let the zero value mean "not ready yet" — FSxInfo.DNSName/MountName empty is already meaningful, since a mount can't be constructed without them. Callers that genuinely require a mountable filesystem should check for that explicitly and say so.

FSxBrief / DescribeFSxBrief (added in #617, same file) is the nil-safe shape and can be the model, but the fix here is to stop GetFSxFilesystem panicking — #617 deliberately left it alone to avoid changing behaviour shared by the launch and task paths.

Test: a DescribeFileSystems response with LifecycleStatus: CREATING, nil DNSName and nil LustreConfiguration must return a usable FSxInfo (or a clear error), and must not panic. That test fails against current main.

Refs #613.

Activity

  1. scttfrdmn commented on Oct 1, 2026

    @scttfrdmn
    ContributorAuthor

    Fixed in #627 (merged as 52ea114).

    The mapping is extracted as a pure fsxInfoFrom(types.FileSystem) so it can be exercised against any lifecycle state without AWS. Verified by reintroducing the old unguarded derefs and running the new test:

    --- FAIL: TestFSxInfoFromCreatingFilesystem
    panic: runtime error: invalid memory address or nil pointer dereference
    

    With the fix it passes. A CREATING filesystem now yields empty DNSName/MountName and zero StorageCapacity — meaningful values, since a mount cannot be constructed without them — rather than crashing the CLI.

    The tag scan had the same unconditional-deref shape (Tag.Key/Tag.Value are both optional) and is fixed alongside, with its own test.

  2. added a commit that references this issue on Oct 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions