Skip to content

SimpleBox.shutdown() crashes: underlying Box has no 'shutdown' attribute #229

@yingjunwu

Description

@yingjunwu

Bug Description

SimpleBox.shutdown() calls self._box.shutdown(), but the underlying Rust Box object only exposes stop(), not shutdown(). This causes an AttributeError at runtime.

Reproduction

import asyncio, boxlite

async def main():
    box = boxlite.SimpleBox(image="python:slim")
    await box.start()
    try:
        result = await box.exec("echo", "hello")
        print(result.stdout)
    finally:
        await box.shutdown()

asyncio.run(main())

Expected: Box shuts down gracefully.

Actual:

AttributeError: 'builtins.Box' object has no attribute 'shutdown'

Root Cause

# simplebox.py
def shutdown(self):
    self._box.shutdown()  # ← Box only has stop(), not shutdown()

The underlying Box object exposes: copy_in, copy_out, exec, id, info, metrics, name, start, stop — no shutdown.

Note

  • SimpleBox also does NOT have a stop() method, so there is no working explicit cleanup method at all
  • The async with context manager presumably works (calls something internally), but the manual lifecycle path is broken
  • shutdown() is also a sync method but the docs show await box.shutdown() (async call on sync method)

Fix

Either:

  1. Change shutdown() to call self._box.stop(), or
  2. Expose stop() on SimpleBox as well

Environment

  • boxlite 0.5.10
  • Python 3.12.3
  • macOS 15.6 (Apple Silicon)

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