Re: [moto-users] Apache crashes on page load
David Hakim <dhakim-Gkm/TONP9n1Wk0Htik3J/[email protected]> Tue, 4 Feb 2003 11:38:24 -0500
| Newsgroups | gmane.comp.lang.moto.devel |
|---|---|
| Message-ID | <[email protected]> |
Well, the good news is I can replicate the crash :) The bad news is we've got one bug masking another. The worse news is if I just payed attention to the forums I would have known about this already. The masking bug is the interesting one. Whatever is going wrong in the PosixFileIO extension is just something annoying. The masking bug is caused by stack traces. Well, not exactly ... thats kind of a simplification. The masking bug is actually caused by stack traces generated by throwing exceptions from within sharedmem.c . Here's the problem: Somewhere someone (PosixFileIO) is trying to free some memory that's already been freed. The memory manager doesn't like this very much because it corrupts the bookkeeping. So sharedmem tries to throw an exception (half way through the free ... ick). The exception itself tries to generate a stack trace ... which of course tries to allocate memory from sharedmem (double ick)... which of course is a little busy right now trying to throw an exception. This is when moto puts up the white flag and concedes defeat. There is more than one bad thing about all of this: 1) Sharedmem is too trusting of the programmers who use it. It should be able to detect frees of un-allocated memory before it gets into a critical section. . The implementation of new bookkeeping must be considered in detail. Heap allocation / de-allocation is already one of the most expensive operations in moto ... we don't want to slow it down further. 2) If the memory manager is going to throw exceptions when bad things happen than those exceptions must not attempt to allocate memory from shared space ... what if the exception we want to throw is an 'OutOfMemoryException' ! We need to consider these sorts of exceptions as special ... perhaps using system malloc to store the stack trace. I'm looking into the shared memory stuff now. The most obvious 'fix' for the first issue is simply to check that the previous and subsequent nodes in the alist agree that this node is still allocated before shared_free enters the critical section. This will work for 99.9999% of all double free's ... however since alist nodes are in the same 'space' as objects (anodeAdress = address - sizeof(ANode)) there are pathological cases where this will fail. -Dave On Tuesday, February 4, 2003, at 01:26 AM, Dean Mills wrote: > I just downloaded and installed moto 0.18 as per the instructions, and > created a test.moto page using the Midafternoon Commander example on > the > project's website. When I attempt to load the page, Apache crashes. > This is > the contents of the error_log created, it's dying in sharemem.c in the > deleteFreeNode() function... > > ### Pre-Loading Extension 'libmx_cstdlib.so' from > '/usr/moto/mx/cstdlib/libmx_cstdlib.so' > ### Pre-Loading Extension 'libmx_codex_util.so' from > '/usr/moto/mx/codex/util/libmx_codex_util.so' > ### Pre-Loading Extension 'libmx_codex_io.so' from > '/usr/moto/mx/codex/io/libmx_codex_io.so' > ### Pre-Loading Extension 'libmx_codex_http.so' from > '/usr/moto/mx/codex/http/libmx_codex_http.so' > ### Pre-Loading Extension 'libmx_codex_db_mysql.so' from > '/usr/moto/mx/codex/db/mysql/libmx_codex_db_mysql.so' > ### Pre-Loading Extension 'libmx_moto.so' from > '/usr/moto/mx/moto/libmx_moto.so' > [Mon Feb 3 22:05:16 2003] [info] mod_unique_id: using ip addr > 127.0.0.1 > ### Pre-Loading Extension 'libmx_cstdlib.so' from > '/usr/moto/mx/cstdlib/libmx_cstdlib.so' > ### Pre-Loading Extension 'libmx_codex_util.so' from > '/usr/moto/mx/codex/util/libmx_codex_util.so' > ### Pre-Loading Extension 'libmx_codex_io.so' from > '/usr/moto/mx/codex/io/libmx_codex_io.so' > ### Pre-Loading Extension 'libmx_codex_http.so' from > '/usr/moto/mx/codex/http/libmx_codex_http.so' > ### Pre-Loading Extension 'libmx_codex_db_mysql.so' from > '/usr/moto/mx/codex/db/mysql/libmx_codex_db_mysql.so' > ### Pre-Loading Extension 'libmx_moto.so' from > '/usr/moto/mx/moto/libmx_moto.so' > [Mon Feb 3 22:05:17 2003] [info] mod_unique_id: using ip addr > 127.0.0.1 > [Mon Feb 3 22:05:17 2003] [info] created shared memory segment #851968 > [Mon Feb 3 22:05:18 2003] [notice] Apache/1.3.27 (Unix) > mod_moto/0.18.0 > mod_tsunami/1.1 FrontPage/4.0.4.3 mod_ssl/2.8.12 OpenSSL/0.9.6h > configured -- resuming normal operations > [Mon Feb 3 22:05:18 2003] [info] Server built: Feb 2 2003 23:53:57 > [Mon Feb 3 22:05:18 2003] [notice] Accept mutex: sysvsem (Default: > sysvsem) > ### Pool doesn't match! > ### Trying to delete a free node that doesn't exist > sharedmem.c:443: *** uncaught exception: NullPointerException > > ### Pool doesn't match! > ### Trying to delete a free node that doesn't exist > sharedmem.c:443: *** uncaught exception: NullPointerException > > [Mon Feb 3 22:05:42 2003] [notice] child pid 16509 exit signal > Aborted (6) > [Mon Feb 3 22:05:42 2003] [notice] child pid 16508 exit signal > Aborted (6) > > As you can see from the [notice] line above, I am running mod_tsunami, > FPSE, > mod_ssl, as well am using mm 1.2.2 and PHP 4.23 > Base system is RH 7.3, Quad Xeon 550's w/ 1GB RAM. Configured moto as > below... > > ./configure --with-apache=/usr/apache --with-mysql=/var/mysql > --prefix=/usr/ > moto > make -j 4 * > make install > > * Failed, seems the threads ran into each other, had to do a `make > clean && > make` and then all was well. > > Sorry in advance if this is a FAQ, I'm just rarin' to get moto going! > :) > TIA! > > D.Mills > >