rivet-dev / rivet-dev/agentos

VM dispose stalls after guest network use

Open
#1,989 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
4.6k
Forks
251
Avg merge
2d 15h
Merged PRs (30d)
34

Description

Disposing a VM after guest code used the network is slow, and very slow when a response body was left unread.

Repro

const vm = await AgentOs.create({ permissions: { network: "allow" } });
await vm.javascript.evaluate(`(await fetch("https://example.com")).status`);
await vm.dispose(); // ~100 s

Actual

  • Dispose logs ERR_AGENTOS_VM_TEARDOWN_DEADLINE: … active_tasks=1 … deadline_ms=5000 and then takes about 100 s to return.
  • Reading the body first (await response.text()) brings the whole call back to ~400 ms, but any guest network use still adds roughly the 5 s teardown deadline.

Expected
Dispose closes guest sockets and returns within the configured shutdown deadline. Untrusted code should not be able to hold a VM open by leaving a connection unread.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the AgentOs.create, vm.javascript.evaluate, and vm.dispose sequence in the issue, comparing unread and fully read response bodies. Trace the VM disposal and guest-network teardown entry points to identify why active_tasks remains; done means guest sockets close and dispose returns within the configured shutdown deadline, including for unread responses.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, rust, wasm
Domain
backend, networking, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.