Pascal Brisset | 21 Apr 2006 00:44

erlc bug: no_bs_match_state (OTP-R10B-10 / compiler-4.3.12)

Erlc crashes on the attached erlang module with this error:

 | bug_bin: function foo/1+13:
 |   Internal consistency check failed - please report this bug.
 |   Instruction: {bs_restore,0}
 |   Error:       no_bs_match_state:

This message comes from lib/compiler/src/beam_validator.erl,
which performs a kind of abstract interpretation on the beam code.
In particular, it keeps track of internal variables of the virtual
machine that are used for the implementation of pattern-matching
on binaries.  The validity of these variables is stored in
(Vst#vst.current)#st.bsm throughout the control flow analysis.

Looking at the generated beam code with erlc -S:

    10  {function, foo, 1, 2}.
    11    {label,1}.
    12      {func_info,{atom,bug_bin},{atom,foo},1}.
    13    {label,2}.
    14      {test,bs_start_match,{f,1},[{x,0}]}.
    15      {bs_save,0}.
    16      {test,bs_get_binary,
    17            {f,3},
    18            [{atom,all},8,{field_flags,[aligned,unsigned,big]},{x,1}]}.
    19      {test,bs_test_tail,{f,3},[0]}.
    20      {bs_init2,{f,3},0,0,2,{field_flags,[]},{x,2}}.
    21      {test,is_ne,{f,3},[{x,1},{x,2}]}.
    22      {move,{atom,ok},{x,0}}.
    23      return.
(Continue reading)

Bjorn Gustavsson | 21 Apr 2006 08:56
Picon
Picon

Re: erlc bug: no_bs_match_state (OTP-R10B-10 / compiler-4.3.12)

Pascal Brisset <pascal.brisset <at> cellicium.com> writes:
> 
> The problem also occurs whenever a guard allocates memory;
> for example "foo(<<Rest/binary>>) when Rest/=[0]".
> 
> I'm not sure how this should be fixed.  The GC could scan the
> pointers in erts_mb and erts_save_mb.  Or the allocator could
> be prevented from relocating data while a binary match is in
> progress.

We have re-designed the bit syntax matching instructions in R11B
to resolve this issue (and a few others).

> 
> Maybe earlier versions of erlc also generate "unsafe" code which
> goes unnoticed because they don't have beam_validator.  Or maybe
> there is no risk at all and the validator is too strict.
> 

Yes, earlier version of the Erlang compiler did generate unsafe
code. The beam_validator is right.

/Bjorn

--

-- 
Björn Gustavsson, Erlang/OTP, Ericsson AB

Matteo Azzali | 24 Apr 2006 16:34
Picon
Favicon

complete incopatibility with glibc-2.4

Latest erlang ( 10.2.10 )
The configure scripts giving me lib/erl_interface/config.log get an
error for not finding

pthread/mit/pthread.h and then nptl/pthread.h .

After this the whole process of configure "explode" and system crash.

The whole report is at gentoo bugzilla at:
http://bugs.gentoo.org/show_bug.cgi?id=131094

Regards,
Matteo

Jani Hakala | 25 Apr 2006 16:28
Picon
Picon

Re: complete incopatibility with glibc-2.4

Matteo Azzali <matte.az <at> libero.it> writes:

> Latest erlang ( 10.2.10 )
> The configure scripts giving me lib/erl_interface/config.log get an
> error for not finding
>
> pthread/mit/pthread.h and then nptl/pthread.h .
>
> After this the whole process of configure "explode" and system crash.
>
> The whole report is at gentoo bugzilla at:
> http://bugs.gentoo.org/show_bug.cgi?id=131094
>
Are you able to reproduce the problem using a stable kernel? 
2.6.16 is something that is not considered stable, 2.6.12.x should be
stable.

I think a system crash is more likely caused by a problem with the
kernel than with the glibc.

Jani Hakala

Matteo Azzali | 25 Apr 2006 21:16
Picon
Favicon

Re: complete incopatibility with glibc-2.4

I couldn't try a so big rollback for a couple of causes:

1)The older 2.6.x kernel here is 2.6.14 , 2.6.12 was here before last
summer....

2)My system is changed too much in these 10-12 months, drivers headers
and udev.

However would be really strange if it's the kernel, since 860 packages
here are compiling and working fine....
If you think you/we might find useful other logs of the system before it
crashes,
I can upload/send everything you might want.

Matteo

Jani Hakala wrote:
> Matteo Azzali <matte.az <at> libero.it> writes:
>
>   
>> Latest erlang ( 10.2.10 )
>> The configure scripts giving me lib/erl_interface/config.log get an
>> error for not finding
>>
>> pthread/mit/pthread.h and then nptl/pthread.h .
>>
>> After this the whole process of configure "explode" and system crash.
>>
>> The whole report is at gentoo bugzilla at:
>> http://bugs.gentoo.org/show_bug.cgi?id=131094
(Continue reading)


Gmane