R7A : Segmentation fault

Raimo Niskanen <>
Wed Sep 20 13:30:27 CEST 2000


Sorry about confusing You. We think we have found the error, it's in the
Erlang beam emulator. It was not related to the /tmp directory, I hacked
Your code wrong so the error never occured. 

In fact the segmentation fault shows up when calling
file:list_dir('directory') on any diretory containing 999 files or more.
(for Debian Linux 2.2)

This is caused by a function efile_drv.c that happened to become
recursive when we tried to introduce threaded I/O (and now just run one
thread), so the stack became exhausted at 999 files. This should happen
on all versions of Unix, not just Debian Linux 2.2, the question is just
for how many files.

We are working on the problem.

/ Raimo Niskanen, Erlang/OTP



Raimo Niskanen wrote:
> 
> Mickael Remond wrote:
> > Here is my session:
> >
> >  $ uname -a
> >  Linux western 2.2.15 #1 ven jun 9 14:05:59 CEST 2000 i686 unknown
> >
> >  $ ./bin/erl
> >  Erlang (BEAM) emulator version 5.0 [source]
> >
> >  Eshell V5.0  (abort with ^G)
> >  1> c(bugreport).
> >  {ok,bugreport}
> >  2> bugreport:loop(1004).
> >
> > Ends by
> > ....
> >
> > Created file : 995  -  file:list_dir length : 995
> > Created file : 996  -  file:list_dir length : 996
> > Created file : 997  -  file:list_dir length : 997
> > Created file : 998  -  file:list_dir length : 998
> > Created file : 999  -  Erreur de segmentation
> >
> > Any idea ?
> >
> > --
> > Mickaël Rémond          -  
> >                         -  http://IDEALX.com
> >                         -  01 44 42 00 38
> 
> I have a Debian 2.2 laptop and can reproduce your fault, just like You.
> 
> I hacked your code to not write at /tmp/test, but on $CWD/test (which is
> ~/tmp/test) and then there is no problem.
> 
> One suggestion is that there is something fishy about the /tmp
> directory. If it lies in virtual memory or is treated specially in any
> way (special filesystem, number of allowed inodes, ...) this may be the
> reason, and I am not enough Linux guru to know, but I know that one
> shall not be suprised to find that the /tmp directory has size
> limitations in some way or another.
> 
> And, I must add, unfortunately the Erlang emulator does not handle out
> of memory in a too controlled manor, so "segmentation fault" is a
> probable response to out of virtual memory. This might be the case if
> /tmp competes with the virtual memory.
>
> /Raimo Niskanen, Erlang/OTP



More information about the erlang-questions mailing list