[PATCH] Fix hang when calling functions in a module with an on_load attribute from a native module

Tuncer Ayaz <>
Sun Oct 3 19:36:52 CEST 2010

On Sun, Oct 3, 2010 at 6:37 PM, Paul Guyot wrote:
>>> --- otp_src_R14B/lib/kernel/src/error_handler.erl.~1~   2010-09-13
>>> 19:00:22.000000000 +0200
>>> +++ otp_src_R14B/lib/kernel/src/error_handler.erl       2010-09-24
>>> 13:44:09.000000000 +0200
>>> @@ -17,6 +17,7 @@
>>>  %% %CopyrightEnd%
>>>  %%
>>>  -module(error_handler).
>>> +-compile(no_native).
>>>  %% A simple error handler.
>> Any objections to applying this fix to dev? Otherwise let's include it
>> as a trivial workaround that makes enable-native-libs useable.


> I can only see three solutions:
> - fix the pointers in each callers (which doesn't sound doable);
> - change the way dynamic linking works in HiPE as Mikael suggests;
> - or add a small stub, as implemented in my patch -- this is still three to
>   five times slower than BEAM.
> Simply ignoring the problem will not make it go away.

I see your point that applying that one-liner may hide the issue and
possibly let it sink into oblivion. I do agree with that.
I wasn't trying to suggest to ignore the issue but see if there's any
downside/objection against this patch. Your point is valid enough
to not include the compiler directive.

enable-native-libs has reduced dialyzer runtime by quite a margin and
is therefore of significant benefit for my use cases.
For anyone testing: On the systems I build I had to manually
$ rm lib/hipe/ebin/{erl,erl_bif}_types.beam
$ make hipe
to ensure that these two are also native-compiled.
Having these +native made a big difference in my dialyzer runs.

More information about the erlang-patches mailing list