Skip to content

[Question] Safety of calling sentry_close(); in on_crash_callback #1054

@conde2

Description

@conde2

Description

I have a game server that create instances for players, I can't garantee that the instance will be up again at any point. Therefore I can't rely on sentry sending the crashs logs on the next startup.

So I'm sending the crash log as an event in the on_crash_callback like this:

static sentry_value_t on_crash_callback(const sentry_ucontext_t* uctx, sentry_value_t event, void* closure)
{
	(void)uctx;
	(void)closure;

	sentry_event_value_add_stacktrace(event, NULL, 0);
	sentry_capture_event(event);
	sentry_close();

	// tell the backend to retain the event
	return event;
}

Its working but I'm not sure if this can cause some problem. I know the recommendation is first write the dump in the disk and then send it, but I have different game instances spawning all the time. So if there is a better way to do this I would love to know.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status

    Done

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions