"bus error" on Linux Sparc

Igor Sysoev is at rambler-co.ru
Wed Sep 9 14:55:40 MSD 2009


On Wed, Sep 09, 2009 at 06:25:15AM -0400, dev-zero wrote:

> Igor Sysoev Wrote:
> -------------------------------------------------------
> > On Wed, Sep 09, 2009 at 05:27:47AM -0400, dev-zero
> > wrote:
> > 
> > > Igor Sysoev Wrote:
> > >
> > --------------------------------------------------
> > -----
> > > > On Tue, Sep 08, 2009 at 10:34:58AM -0400,
> > dev-zero
> > > > wrote:
> > > > 
> > > > > Hi everyone
> > > > > 
> > > > > When I try to start nginx-0.8.14 on a
> > > > Sparc-Linux I get a "Bus Error":
> > > > > # nginx -c /etc/nginx/nginx.conf 
> > > > > Bus error
> > > > > 
> > > > > With 'strace' I was able to track it down a
> > > > little:
> > > > > [...]
> > > > > open("/etc/nginx/nginx.conf",
> > > > O_RDONLY|O_LARGEFILE) = 4
> > > > > fstat64(4, {st_mode=S_IFREG|0644,
> > st_size=1610,
> > > > ...}) = 0
> > > > > pread(4, Bus error
> > > > > 
> > > > > Now, according to that I think the error
> > might
> > > > be in ngx_read_file where a u_char* is passed
> > as a
> > > > void* as second argument for pread, which in
> > turn
> > > > is probably a long and should therefore be
> > aligned
> > > > on sparc.
> > > > > Even if that is the actual problem I have no
> > > > idea how to fix it. Any ideas?
> > > > 
> > > > Could you create coredump and run 
> > > > 
> > > > gdb /path/to/nginx /path/to/core
> > > > bt
> > > > 
> > > 
> > > Sure, here we go...
> > > 
> > > The first bug is a segfault I've been
> > experiencing a lot when doing a config check while
> > the server is already running:
> > > 
> > > Core was generated by `/usr/sbin/nginx -c
> > /etc/nginx/nginx.conf -t'.
> > > Program terminated with signal 11, Segmentation
> > fault.
> > > 
> > > #0  ngx_hash_add_key (ha=0xff82b270,
> > key=0xf7ba5a4c, value=0xc960, flags=75334) at
> > src/core/ngx_hash.c:814
> > > 814	    *name = *key;
> > > #1  0x00000008 in ?? ()
> > > (gdb) 
> > > 
> > > And the coredump+gdb-bt from the bus error
> > mentioned before:
> > > 
> > > Core was generated by `nginx -c
> > /etc/nginx/nginx.conf -t'.
> > > Program terminated with signal 10, Bus error.
> > > 
> > > #0  ngx_palloc (pool=0xa1230, size=784) at
> > src/core/ngx_palloc.c:126
> > > 126	            m = ngx_align_ptr(p->d.last,
> > NGX_ALIGNMENT);
> > > (gdb) bt
> > > #0  ngx_palloc (pool=0xa1230, size=784) at
> > src/core/ngx_palloc.c:126
> > > #1  0x0003c608 in ngx_http_core_create_srv_conf
> > (cf=0xffa87280) at src/core/ngx_array.h:43
> > > Backtrace stopped: previous frame inner to this
> > frame (corrupt stack?)
> > > (gdb) 
> > > 
> > > And the original C/LDFLAGS I've been using to
> > compile nginx:
> > > CFLAGS="-O2 -mcpu=ultrasparc -pipe -ggdb"
> > >
> > LDFLAGS="-Wl,-O2,--hash-style=gnu,--sort-common,--
> > as-needed"
> > > Dropping the LDFLAGS didn't help, also didn't
> > reducing -O2 to -O1 in CFLAGS.
> > > GCC version is: 4.3.2, glibc: 2.9_p20081201,
> > kernel: 2.6.31-rc9
> > 
> > Could you rebuild nginx with
> > CFLAGS="-DNGX_ALIGNMENT=16 ..."
> 
> Done. Did not help, same result:
> # nginx -c /etc/nginx/nginx.conf -t
> Bus error (core dumped)

If the bus error is at src/core/ngx_palloc.c:126 again, then:

bt
p *p


-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list