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

Already on GitHub? Sign in to your account

`erl -mode embedded` crashes #10

Open
weisslj opened this Issue Dec 5, 2013 · 3 comments

Comments

Projects
None yet
2 participants

weisslj commented Dec 5, 2013

With Erlang R16B01 and erlang-history, erl -mode embedded crashes:

{error_logger,{{2013,12,5},{11,29,3}},"~s~n",["Error in process <0.11850.0> with exit value: {undef,[{group_history,load,[],[]},{group,server,3,[{file,\"src/2.16.2/group.erl\"},{line,35}]}]}\n"]}
{error_logger,{{2013,12,5},{11,29,3}},supervisor_report,[{supervisor,{local,kernel_sup}},{errorContext,child_terminated},{reason,{undef,[{group_history,load,[],[]},{group,server,3,[{file,"src/2.16.2/group.erl"},{line,35}]}]}},{offender,[{pid,<0.164.0>},{name,user},{mfargs,{user_sup,start,[]}},{restart_type,temporary},{shutdown,2000},{child_type,supervisor}]}]}
Owner

ferd commented Dec 5, 2013

My guess is that this is due to dynamic loading of code. When is your install from?

We've reworked the compiling of the kernel.app file to include the group_history module in there, although I guess the boot file for your system was generated prior to that.

This will make it so that the boot file will only load files it knows about and the Erlang error handler won't attempt to do dynamic code loading of any unknown module. Short of regenerating a boot file (which I'm not extremely keen on doing as part of erlang-history's build system), there are a few workarounds:

  1. Recompile Erlang now that the module is there. This should generate a new boot file with it inside and work
  2. Call a manual module load when booting (i.e. -eval code:load(...)), which is shitty and cumbersome
  3. Use embedded mode with Erlang releases, which will once again generate a new boot file and will work for you (still annoying)
  4. Modify the default OTP bootfile for your system to copy the 'group.erl' line and add a nearly-identical 'group_history.erl' line

It seems that right now you can do 1. without a problem (although inconvenient). I'm not willing to do 4. just yet because that's scary stuff and I'm afraid of breaking people's regular Erlang nodes in painful ways. I'm open to experimenting with it, though.

weisslj commented Dec 6, 2013

I used erlang-history 22f04dd, the installation is from the distribution (Debian). I could reproduce the bug with R16B02.

I solved the problem for me by patching and recompiling Erlang/OTP directly. Apart from modifying group.erl and adding group_history.erl, I had to include "group_history" in lib/kernel/src/kernel.app.src and lib/kernel/src/Makefile. By replacing /usr/lib/erlang/bin/start.boot with the newly built start.boot the error disappeared.

I see that the problem is hard / impossible to solve with the current installation approach. Maybe the best fix for this issue would be to include erlang-history in OTP itself :-).

Owner

ferd commented Dec 6, 2013

Right, the part about app.src is now covered by the erlang-history build system, but not the boot file generation unless someone manually recompiles their install from source. It wouldn't have helped much with a fresh install, but solves the problem with custom releases after the fact.

I'll be leaving this open and classifying it as a bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment