[plt-scheme] having some trouble compiling reliable version of extension module for mzscheme3m; suggestions?

From: Danny Yoo (dyoo at hkn.eecs.berkeley.edu)
Date: Fri Sep 9 18:46:05 EDT 2005

Hi everyone,

I've been working on getting the Linux 2.4/2.6 'sendfile' system call
accessible with the FFI.  (I want to help make the web-server resilient.)

I have an initial tarball of this work here:

    http://hkn.eecs.berkeley.edu/~dyoo/tmp/sendfile.tar.gz

It's not quite right yet, and it's a bit unstable.  In particular, I'm
running into issues with mzscheme3m: I see segfaults if I really hammer
the system call hard.  I'm hoping someone can give me a clue.  *grin*


The segfault appears related to my adding of a call to
'scheme_block_until_enable_break' in my linux-sendfile C extension; if I
comment that out and force my extension to just block on the socket, then
I don't see the segfault.  I also don't see the segfault under regular
mzscheme.


Here's what I'm seeing:

######
[dyoo at shoebox 0831_sendfile]$ mzscheme3m -r test-sendfile.ss &
[1] 18440
[dyoo at shoebox 0831_sendfile]$ looking up 3m library

"linux-sendfile.ss" loaded.
Now waiting for connections on port 9999
######


Once my test server's up, I run the popular 'autobench' utility:

######
[dyoo at shoebox 0831_sendfile]$ autobench --quiet --single_host --host1
localhost --port1 9999  --low_rate 200 --high_rate 200 --rate_step 20
--num_call 10           --num_conn 5000 --timeout 5  >/dev/null
Seg fault (internal error) at 0xdfffbc28
######

and that's when mzscheme3m dies.


>From a gdb inspection of the core file, I see that mzscheme3m dies around
here:

######
[dyoo at shoebox 0831_sendfile]$ gdb mzscheme3m
(gdb) core core
Core was generated by `mzscheme3m -r test-sendfile.ss'.
Program terminated with signal 6, Aborted.
warning: current_sos: Can't read pathname for load map: Input/output error

Reading symbols from /lib/libdl.so.2...done.
Loaded symbols for /lib/libdl.so.2
Reading symbols from /lib/libm.so.6...done.
Loaded symbols for /lib/libm.so.6
Reading symbols from /lib/libc.so.6...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
Reading symbols from /lib/libtermcap.so...done.
Loaded symbols for /lib/libtermcap.so
Reading symbols from /lib/libreadline.so...done.
Loaded symbols for /lib/libreadline.so
Reading symbols from /lib/libncurses.so.5...done.
Loaded symbols for /lib/libncurses.so.5
Reading symbols from /usr/lib/libgpm.so.1...done.
Loaded symbols for /usr/lib/libgpm.so.1
Reading symbols from
/home/dyoo/work/scratch/2005/0831_sendfile/linux-sendfile3m.so...
done.
Loaded symbols for
/home/dyoo/work/scratch/2005/0831_sendfile/linux-sendfile3m.so
Reading symbols from /lib/libnss_files.so.2...done.
Loaded symbols for /lib/libnss_files.so.2
#0  0x40079941 in kill () from /lib/libc.so.6
(gdb) bt
#0  0x40079941 in kill () from /lib/libc.so.6
#1  0x400796e5 in raise () from /lib/libc.so.6
#2  0x4007aa66 in abort () from /lib/libc.so.6
#3  0x0813a6fa in designate_modified (p=0x4015cff4) at newgc.c:1833
#4  <signal handler called>
#5  0xbfffb564 in ?? ()
(gdb) frame 3
#3  0x0813a6fa in designate_modified (p=0x4015cff4) at newgc.c:1833
1833      } else GCERR((GCOUTF, "Seg fault (internal error) at %p\n", p));
######


Any help on this would be greatly appreciated.  Thank you!



Posted on the users mailing list.