clockworklabs / clockworklabs/SpacetimeDB
[Critical Server Crash] publishing with recursive types like `Option<Box<T>>` can crash the server instance on publish
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 25.2k
- Forks
- 1.1k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 46
Description
i was testing for someone if self nesting of types works and it does with a big *.
the type i'm testing with is
#[derive(Debug, SpacetimeType, Clone)]
pub struct TestNestedType {
pub test_nest: Option<Box<TestNestedType>>
}
when used as only a parameter, it publishes fine and the schema looks good.
when used within another type, table or enum, it crashes the server instance on publish.
thread '<unnamed>' (772) panicked at crates\schema\src\schema.rs:1226:14:
validated module should have all types resolve: RecursiveTypeRef(AlgebraicTypeRef(4))
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
i tried to run the server with spacetime start --enable-tracy but it doesn't change anything nor show more any more info (bug?)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at crates/schema/src/schema.rs:1226:14 and reproduce the panic by publishing TestNestedType through another type, table, or enum. Compare this with publishing it as the sole parameter and inspect the schema validation path. Done means these recursive-type cases publish successfully without crashing the server and retain the expected schema.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100