Skip to content

Starting Rust runtime twice (sequentially) fails #9739

Closed
@drrb

Description

@drrb

Rust Version: 0.8
Platform: OSX

Starting the Rust runtime more than once (sequentially) fails with the following error.

task <unnamed> failed at 'assert_once_ever happened twice: last task exiting', /private/tmp/rust-ZPXh/src/libstd/rt/mod.rs:305
libc++abi.dylib: terminate called throwing an exception

This is a simple example that reproduces the problem.

#[start]
fn start(argc: int, argv: **u8) -> int {
    do std::rt::start(argc, argv) {
        println("First invocation");
    };

    do std::rt::start(argc, argv) {
        println("Second invocation");
    };

    0
}

The actual use-case is to call Rust code from Java (through JNI) multiple times. Calling Rust code this way requires starting the runtime for each call, which works for the first invocation, but not for subsequent ones

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