Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logger report callback_mode for gen_statem changed in OTP27 #8605

Closed
sabiwara opened this issue Jun 22, 2024 · 2 comments · Fixed by #8648
Closed

Logger report callback_mode for gen_statem changed in OTP27 #8605

sabiwara opened this issue Jun 22, 2024 · 2 comments · Fixed by #8648
Assignees
Labels
bug Issue is reported as a bug priority:medium team:PS Assigned to OTP team PS
Milestone

Comments

@sabiwara
Copy link
Contributor

Describe the bug

Since this change, the logger:report() emitted by when gen_statem crashes (when using callback_mode=handle_event_function) has a different value for the callback_mode key:

  • it used to be the handle_event_function atom in OTP 26-
  • it is now the module's fun Mod:handle_event/4

Not sure if this is a bug or intentional, feel free to close if it's the latter.
Just reporting in case it wasn't.

To Reproduce

(sorry in Elixir, taken from https://github.com/elixir-lang/elixir/pull/13684/files)

  defmodule MyGenStatemFormatStatus do
    @behaviour :gen_statem

    @impl true
    def callback_mode, do: :handle_event_function

    @impl true
    def init(state) do
      {:ok, :no_state, state}
    end

    @impl true
    def handle_event({:call, _}, :error, :no_state, _data) do
      raise "oops"
    end
  end

Expected behavior
Perhaps it should be consistent with OTP26- and return handle_event_function?

Affected versions

OTP 27.0

@RaimoNiskanen
Copy link
Contributor

I agree that it is a bug introduced when caching of callback functions was implemented. The logger map callback_mode value should be reverted to handle_event_function.

Thank you for reporting this!

@RaimoNiskanen RaimoNiskanen added this to the OTP-27.1 milestone Jul 9, 2024
RaimoNiskanen added a commit that referenced this issue Jul 11, 2024
…9164' into maint

* raimo/stdlib/gen_statem-log-callback_mode/GH-8605/OTP-19164:
  Use the pre cached callback_mode value for logger
@RaimoNiskanen
Copy link
Contributor

Completed by #8648 to be released in OTP 27.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is reported as a bug priority:medium team:PS Assigned to OTP team PS
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants