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

Shoehorn.Handler behaviour not working with Elixir 1.16.3 / OTP 26.2.5 #137

Open
alanj853 opened this issue Aug 15, 2024 · 5 comments
Open

Comments

@alanj853
Copy link

Environment

Current behavior

Shoehorn behaviour does not seem to be getting used at all.

Steps to reproduce

  1. First, comment on the "raise" statement in crash_app/lib/crash_app/application.ex (documentation should probably say to do this, as your example does not work as expected without it)
  2. Follow steps in example README
cd my_project
mix deps.get
mix release
RELEASE_BOOT_SCRIPT=shoehorn _build/dev/rel/my_project/bin/my_project start_iex
  1. Run Application.stop :my_project

Expected behavior

Application should restart, and we should see Logger.info print messages

Actual Behaviour

Application exits, and does not restart. Also, there are no Logger.info prints at all, even if the prints in my_project/lib/my_project/shoehorn_handler.ex are switched to IO.puts/1, which shows the code is not being called at all I think.

pokyuser@docker:/workdir/shoehorn/example/my_project$ RELEASE_BOOT_SCRIPT=shoehorn _build/dev/rel/my_project/bin/my_project start_iex

10:59:59.207 [info] System initialization application started!
Erlang/OTP 26 [erts-14.2.5] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [jit:ns]

Interactive Elixir (1.16.3) - press Ctrl+C to exit (type h() ENTER for help)
iex(my_project@docker)1> Application.stop :my_project

11:00:08.784 [notice] Application my_project exited: :stopped
:ok
iex(my_project@docker)2>
nil
iex(my_project@docker)3>
nil
iex(my_project@docker)4> Application.stop :my_project
{:error, {:not_started, :my_project}}
iex(my_project@docker)5> Application.stop :my_project
{:error, {:not_started, :my_project}}
iex(my_project@docker)6> Application.stop :my_project
{:error, {:not_started, :my_project}}
iex(my_project@docker)7> Application.stop :my_project
{:error, {:not_started, :my_project}}
iex(my_project@docker)8> Application.stop :my_project
{:error, {:not_started, :my_project}}
iex(my_project@docker)9> Application.stop :my_project
{:error, {:not_started, :my_project}}
iex(my_project@docker)10>
@fhunleth
Copy link
Member

@alanj853 I've stopped using this feature of Shoehorn, so I'm not in a good spot to help. If you or others can figuring it out and send a patch, I'll gladly merge and make a release. I think we can also bump the lowest version of OTP supported if it's hard to maintain backwards compatibility.

@alanj853
Copy link
Author

alanj853 commented Sep 4, 2024

But is this not the main feature of shoehorn, to provide a means to restart applications that crash without having to go outside the VM?

@fhunleth
Copy link
Member

fhunleth commented Sep 4, 2024

It is.

@alanj853
Copy link
Author

alanj853 commented Sep 4, 2024

With some more trial and error, I found that this is due to some change in Elixir 1.15.0. This all works fine with the 1.14.5. What is happening is the handle_event and handle_call implementations in lib/shoehorn/report_handler.ex are not being called anymore, even though init/1 is.

@alanj853
Copy link
Author

alanj853 commented Sep 9, 2024

I think I have fixed the issue here: #138

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

No branches or pull requests

2 participants