Skip to content

"invalid span, this shouldn't happen" panic triggered on iOS #20

Description

Hi, I'm working on an iOS application that uses Rust dylib with tracing-oslog as my subscriber.

When I stop the app and quickly reopen it, it crashes on the line 166 OsLogger::on_event:

		if let Some(parent_id) = ctx.current_span().id() {
			let span = ctx
				.span(parent_id)
				.expect("invalid span, this shouldn't happen");

While maybe I did something wrong with tracing Spans, I'd expect any subscriber to be more graceful while handling missing spans.
Because if the span data is missing, the worst case should be incomplete traces instead of the crash of an application.

So while line 166 is at fault here, I'd suggest removing all .expect() and replace them with if let and other expressions.

Happy to make a PR if agreed its a good way forward ;-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions