Moving the Digital Anatomist Atlases
On sphenoid:
rsync -Sa -v --numeric-ids -e 'ssh -c blowfish' vertex:/usr/local/www /usr/local up2date ImageMagick-perl cd /usr/local/www/htdocs/DA-5.2/src/c vi ../../local/local.h make clean make make install
Add this to Apache httpd config /etc/httpd/conf.d/local-vhost.conf:
NameVirtualHost *:80 <VirtualHost *:80> ServerName sphenoid.biostr.washington.edu ServerAlias sphenoid sphenoid.biostr ServerAlias www9 www9.biostr www9.biostr.washington.edu DirectoryIndex index.html index.htm index.shtml <Location "/"> Options +Indexes </Location> # Digital Anatomist Atlases #ServerName sphenoid.biostr.washington.edu #ServerAlias sphenoid sphenoid.biostr ScriptAlias /cgi-bin/DA/ /usr/local/www/htdocs/DA/bin/ DocumentRoot /usr/local/www/htdocs </VirtualHost>
Add to /etc/logrotate.d/httpd:
weekly
rotate 40
compress
delaycompress
Add to /etc/webalizer.conf
LogFile /var/log/httpd/access.log.1 OutputDir /usr/local/www/htdocs/webalizer Incremental yes ReportTitle Usage Statistics for TopReferrers 40 HideSite *vertex HideReferrer vertex/ HideReferrer vertex.biostr.washington.edu HideReferrer www9/ HideReferrer www9.biostr.washington.edu HideReferrer Direct Request
Create /etc/logrotate.d/da-atlases
/usr/local/www/htdocs/DA/logs/*_log {
weekly
rotate 40
compress
missingok
notifempty
create
}
Since logwatch doesn't recognize the entries, it will report all requests; to avoid the huge resulting emails, add these entries to /etc/log.d/conf/services/http.conf:
*Remove = DA/atlasUpdater *Remove = DA/custPin *Remove = DA/drawStuff *Remove = DA/fupload *Remove = DA/imageform *Remove = DA/PageMaster *Remove = DA-ATLASES
Debugging
The DA input log file /usr/local/www/htdocs/DA/logs/if_log got to 2GB and libc was failing on the log file write since that filesystem couldn't handle files any bigger. I moved the old logs to a old_logs directory.
If anyone's interested read on for a few details (this mostly for my own records). Debugging a CGI program in C was a bugger; I got this helpful hint from O'Reilly _Apache: TDG_ (via Safari online) for a script:
#!/bin/sh REQUEST_METHOD=POST export REQUEST_METHOD myecho << EOF 2315_order=20&2316_order=10&card_type=Amex EOF
I kept running into more env variables that imageform uses, so I temporarily replaced ../../bin/imageform with this perl CGI to dump the actual web request env:
#!/usr/bin/perl
use CGI qw/:standard/;
print "Content-type: text/plain\n\n";
foreach $var (sort keys %ENV) {
print "$var=\"$ENV{$var}\"\n";
}
Finally, I combined the two and ran gdb on the result and got the actual failure (oh, and built with debug flags in ../../local/Makefile.local):
#!/bin/bash export CONTENT_LENGTH="88" export CONTENT_TYPE="application/x-www-form-urlencoded" export DOCUMENT_ROOT="/usr/local/www/htdocs" export GATEWAY_INTERFACE="CGI/1.1" export HTTP_ACCEPT="text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5" export HTTP_ACCEPT_CHARSET="ISO-8859-1,utf-8;q=0.7,*;q=0.7" export HTTP_ACCEPT_ENCODING="gzip,deflate" export HTTP_ACCEPT_LANGUAGE="en-us,en;q=0.5" export HTTP_CONNECTION="keep-alive" export HTTP_HOST="vertex.biostr.washington.edu" export HTTP_KEEP_ALIVE="300" export HTTP_REFERER="http://vertex.biostr.washington.edu/cgi-bin/DA/PageMaster?atlas:Neuroanatomy+ffpathIndex:Splash^Page+2" export HTTP_USER_AGENT="Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.6) Gecko/20050317 Firefox/1.0.2" export PATH="/bin:/usr/bin:/sbin:/usr/sbin" export QUERY_STRING="" export REMOTE_ADDR="128.95.228.11" export REMOTE_PORT="58785" export REQUEST_METHOD="POST" export REQUEST_URI="/cgi-bin/DA/imageform" export SCRIPT_FILENAME="/usr/lib/cgi-bin/DA/imageform" export SCRIPT_NAME="/cgi-bin/DA/imageform" export SERVER_ADDR="128.95.10.19" export SERVER_ADMIN="webmaster@sig.biostr.washington.edu" export SERVER_NAME="vertex.biostr.washington.edu" export SERVER_PORT="80" export SERVER_PROTOCOL="HTTP/1.1" export SERVER_SIGNATURE="<ADDRESS>Apache/1.3.26 Server at vertex.biostr.washington.edu Port 80</ADDRESS> export " export SERVER_SOFTWARE="Apache/1.3.26 (Unix) Debian GNU/Linux mod_ssl/2.8.9 OpenSSL/0.9.6c mod_perl/1.26" export UNIQUE_ID="Ql63w4BfChMAAAJhohA" gdb ../../bin/imageform #../../bin/imageform < input #../../bin/imageform << EOF #ffpath="Index/Splash Page"&atlas:="Neuroanatomy"&strID:="-1" #EOF
For the gdb run, I put the POST input line in a file. The session:
(gdb) run < input Starting program: /usr/local/www/htdocs/DA-5.2/bin/imageform < input Program received signal SIGXFSZ, File size limit exceeded. 0x400e6404 in write () from /lib/libc.so.6 (gdb) backtrace #0 0x400e6404 in write () from /lib/libc.so.6 #1 0x4013ae48 in __check_rhosts_file () from /lib/libc.so.6 #2 0x4008ce88 in _IO_do_write () from /lib/libc.so.6 #3 0x4008cde6 in _IO_do_write () from /lib/libc.so.6 #4 0x4008c781 in _IO_file_close_it () from /lib/libc.so.6 #5 0x4008412d in fclose () from /lib/libc.so.6 #6 0x080494e9 in main (argc=1, argv=0xbffffd44, envp=0xbffffd4c) at imageform.c:348
Line 348 is the logfile write. It was a short step from there to find the 2GB file.
