Skip to content

Shorten state in crash reports#163

Merged
zuiderkwast merged 1 commit intoEricsson:mainfrom
zuiderkwast:cluster-format-status
Mar 20, 2026
Merged

Shorten state in crash reports#163
zuiderkwast merged 1 commit intoEricsson:mainfrom
zuiderkwast:cluster-format-status

Conversation

@zuiderkwast
Copy link
Collaborator

Using the gen_server callback format_status/1, rewrite the state used for crash dumps in the following ways:

  1. Convert from record to map, so keys are readable
  2. Replace the huge binary slot map with a list of ranges

Before:

=ERROR REPORT==== 20-Mar-2026::14:38:51.760125 ===
** Generic server <0.962.0> terminating 
** Last message in was {'EXIT',<0.934.0>,crash}
** When Server state == {st,ok,
                            <<1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
                              1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
                              (many lines like this)
                            ...

After:

=ERROR REPORT==== 20-Mar-2026::14:38:51.760125 ===
** Generic server <0.962.0> terminating 
** Last message in was {'EXIT',<0.934.0>,crash}
** When Server state == #{pending => #{},
                          slots =>
                              [{{0,5460},1},
                               {{5461,10922},2},
                               {{10923,16383},3}],
                          ...

Using the gen_server format_status/1 callback, rewrite
the state for crash dumps in the following ways:

1. Convert from record to map, so keys are readable
2. Replace the huge binary slot map with a list of ranges

Signed-off-by: Viktor Söderqvist <viktor.soderqvist@est.tech>
@zuiderkwast
Copy link
Collaborator Author

This failed test shows the new crash report: https://github.com/zuiderkwast/ered/actions/runs/23345634795/job/67910132639#step:5:118

(The test case was flaky before and not affected by this PR.)

@zuiderkwast zuiderkwast requested a review from bjosv March 20, 2026 13:57
Copy link
Collaborator

@bjosv bjosv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool, looks a lot better.

code_change(_OldVsn, State = #st{}, _Extra) ->
{ok, State}.

format_status(Status) ->
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This just affects OTP25+ I guess, but thats fine.
format_status(Status) (since OTP 25.0) (optional)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it will just be ignored on OTP < 25.

Copy link
Collaborator

@WilliamVoong WilliamVoong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zuiderkwast zuiderkwast merged commit 9abae81 into Ericsson:main Mar 20, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants