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

Fixing DrabTestApp deployment crash #35

Merged
merged 1 commit into from Aug 8, 2017
Merged

Conversation

OvermindDL1
Copy link
Collaborator

Elixir 1.5.2
OTP 20.1

Starting an app with Drab in deployment is throwing:

15:00:55.851 [info] Application drab exited: exited in: Drab.Supervisor.start(:normal, [])
    ** (EXIT) an exception was raised:
        ** (CaseClauseError) no case clause matching: {:error, :embedded}
            (drab) lib/drab/supervisor.ex:20: Drab.Supervisor.start/2
            (kernel) application_master.erl:273: :application_master.start_it_old/4
{"Kernel pid terminated",application_controller,"{application_start_failure,drab,{bad_return,{{'Elixir.Drab.Supervisor',start,[normal,[]]},{'EXIT',{{case_clause,{error,embedded}},[{'Elixir.Drab.Supervisor',start,2,[{file,\"lib/drab/supervisor.ex\"},{line,20}]},{application_master,start_it_old,4,[{file,\"application_master.erl\"},{line,273}]}]}}}}}"}

It looks like it is missing a case clause at: https://github.com/grych/drab/blob/master/lib/drab/supervisor.ex#L20

As per the docs at https://hexdocs.pm/elixir/Code.html#ensure_compiled/1 it can return a variety of different returns, and {:error, :embedded} is the one it returns when the system is deployed and no code can change (always assume the code exists in embedded mode if it is included at all).

Thus I'm altering the :error clause to be {:error, :_} as this file does not exist in your releases anyway (you really should be using a macro'd Mix environment call to test this).

Had to make the change locally as well, meaning it will be wiped when I update, so please have this PR in by then. ^.^;

Altering the DrabTestApp to not be loaded if it does not exist, properly.

This whole case block and such really should not exist at all though, rather a proper mix test scaffold should be done that starts it on demand for testing, but this code should not even exist in hex releases.  This is the easiest work-around for now and is tested locally.
@grych grych merged commit 0f74355 into grych:master Aug 8, 2017
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.

None yet

2 participants