[erlang-bugs] +A option causes segmentation fault on Linux

Rickard Green <>
Sat Jun 2 18:36:04 CEST 2007


Thanks for the bug report. I've attached a patch that solves the
problem. It will be included in the soon to be released R11B-5
maintainence release.

BR,
Rickard Green, Erlang/OTP, Ericsson AB.

Mikage Sawatari wrote:
> Hello,
> 
> The code at the end of message crashes on Linux with segmentation
> fault when the option +A is specified. Without the option it
> works. It creates a lot of files simultaneously, and calls
> file:sync().
> 
> 
>> time erl +A 2 -noshell -s testasync test -s init stop
> Segmentation fault
> 
> real    0m1.149s
> user    0m0.308s
> sys     0m0.795s
> 
>> time erl -noshell -s testasync test -s init stop
> 
> real    0m24.470s
> user    0m2.137s
> sys     0m4.981s
> 
> 
> We have tested on the following environments:
> 
> SuSE Linux 9.2 (i586) (kernel 2.6.8-24-bigsmp)
> Erlang (ASYNC_THREADS,HIPE) (BEAM) emulator version 5.5.4
> 
> SUSE LINUX Enterprise Server 9 (x86_64) (kernel 2.6.5-7.201-smp)
> Erlang (ASYNC_THREADS,HIPE) (BEAM) emulator version 5.5.4
> 
> 
> ---- CUT HERE ----
> -module(testasync).
> -compile(export_all).
> 
> % Specify a directory at which we can store many files.
> -define(DIR, "/home/rd/erlang/tmp").
> 
> -define(NUM, 100).
> -define(CONCURRENT, 100).
> 
> 
> test() ->
>         run(?CONCURRENT).
> 
> run(0) ->
>         ok;
> run(N) ->
>         spawn(?MODULE, run, [N, ?NUM]),
>         run(N-1).
> 
> run(_N, 0) ->
>         ok;
> run(N, I) ->
>         makefile(N, I),
>         run(N, I-1).
> 
> makefile(N, I) ->
>         Data = term_to_binary({N, I}, [compressed]),
>         Filename = hex(term_to_binary(now())),
> %       io:format("~p~n", [Filename]),
>         FilePath = ?DIR ++ "/" ++ Filename,
>         {ok, Fd} = file:open(FilePath, [write, raw, binary]),
>         Size = size(Data),
>         SizeBin = <<Size:32>>,
>         file:write(Fd, SizeBin),
>         file:write(Fd, Data),
>         file:sync(Fd),
>         file:close(Fd).
> 
> hex(B) when binary(B) ->
>         hex(binary_to_list(B));
> hex(L) when list(L) ->
>   lists:flatten([hex(I) || I <- L]);
> hex(I) when I > 16#f ->
>   [hex0((I band 16#f0) bsr 4), hex0((I band 16#0f))];
> hex(I) -> [$0, hex0(I)].
> 
> hex0(10) -> $a;
> hex0(11) -> $b;
> hex0(12) -> $c;
> hex0(13) -> $d;
> hex0(14) -> $e;
> hex0(15) -> $f;
> hex0(I) ->  $0 +I.
> 
> ---- CUT HERE ----
> 
> 
> 
> 
> ----
> SAWATARI Mikage
> _______________________________________________
> erlang-bugs mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-bugs
> 

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: driver_peekq.patch
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20070602/399dedcb/attachment.ksh>


More information about the erlang-bugs mailing list