You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "J.Lance Wilkinson" <jl...@psu.edu> on 2012/12/03 15:37:51 UTC
[users@httpd] Compiled/linked executable CGI script crashes when run as CGI, runs
to completion when run outside HTTPD
Title pretty much says it all.
HTTPD is 2.2.15 on RHEL6.
Executable aborts, log files show glibc detected memory issues (messages vary).
Run same executable outside of the CGI environment, on the same host and under
an unprivileged user (can't run as "apache" because that's not a real ID, my
sysadmin says), duplicating all input, under a debugger and not under a
debugger, and it runs to completion with no errors.
What could HTTPD as the parent environment be imposing that would cause the
aborts when they don't occur outside of Apache? I speculated some ulimit kind
of thing resulting in less memory actually being available for the thousands of
malloc() calls the executable performs.
--
J.Lance Wilkinson ("Lance") InterNet: Lance.Wilkinson@psu.edu
Systems Design Specialist - Lead Phone: (814) 865-4870
Digital Library Technologies FAX: (814) 863-3560
E3 Paterno Library
Penn State University
University Park, PA 16802
http://ucs.psu.edu/home/jlw12@psu.edu?fmt=freebusy
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Compiled/linked executable CGI script crashes when
run as CGI, runs to completion when run outside HTTPD
Posted by "J.Lance Wilkinson" <jl...@psu.edu>.
Antonio Moreno wrote:
> El 03/12/12 15:37, J.Lance Wilkinson escribió:
>> Title pretty much says it all.
Doesn't look like your posting is related to mine at all...
(No parece que su anuncio está relacionado con la mía en todo ...)
>>
>> HTTPD is 2.2.15 on RHEL6.
>>
>> Executable aborts, log files show glibc detected memory issues
>> (messages vary).
>> Run same executable outside of the CGI environment, on the same host
>> and under an unprivileged user (can't run as "apache" because that's
>> not a real ID, my sysadmin says), duplicating all input, under a
>> debugger and not under a debugger, and it runs to completion with no
>> errors.
>>
>> What could HTTPD as the parent environment be imposing that would
>> cause the aborts when they don't occur outside of Apache? I
>> speculated some ulimit kind of thing resulting in less memory actually
>> being available for the thousands of malloc() calls the executable
>> performs.
>>
> Site works on another machine with the same configuration, this:
>
> <VirtualHost *:80>
> ServerAdmin info@codebusters.es
>
> #default
> DocumentRoot /var/www/
>
> <Directory /var/www/>
> Options Indexes FollowSymLinks MultiViews
> AllowOverride All
> Order allow,deny
> allow from all
> </Directory>
>
> ErrorLog /var/log/apache2/error.log
>
> # Possible values include: debug, info, notice, warn, error, crit,
> # alert, emerg.
> LogLevel warn
>
> CustomLog /var/log/apache2/access.log combined
>
> Alias /doc/ "/usr/share/doc/"
> <Directory "/usr/share/doc/">
> Options Indexes MultiViews FollowSymLinks
> AllowOverride None
> Order deny,allow
> Deny from all
> Allow from 127.0.0.0/255.0.0.0 ::1/128
> </Directory>
>
> </VirtualHost>
>
> I copied the directory of the machine that works and I dump the data
> base. Thanks.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
--
J.Lance Wilkinson ("Lance") InterNet: Lance.Wilkinson@psu.edu
Systems Design Specialist - Lead Phone: (814) 865-4870
Digital Library Technologies FAX: (814) 863-3560
E3 Paterno Library
Penn State University
University Park, PA 16802
http://ucs.psu.edu/home/jlw12@psu.edu?fmt=freebusy
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Compiled/linked executable CGI script crashes when
run as CGI, runs to completion when run outside HTTPD
Posted by "J.Lance Wilkinson" <jl...@psu.edu>.
Jeff Trawick wrote:
> On Mon, Dec 3, 2012 at 11:17 AM, J.Lance Wilkinson <jlw12@psu.edu
> <ma...@psu.edu>> wrote:
>
> Jeff Trawick wrote:
>
> On Mon, Dec 3, 2012 at 10:28 AM, J.Lance Wilkinson
> <jlw12@psu.edu <ma...@psu.edu> <mailto:jlw12@psu.edu
> <ma...@psu.edu>>> wrote:
>
> Jeff Trawick wrote:
>
> Run under valgrind from the shell, and if that doesn't work
> create a wrapper script to be the CGI and use the
> wrapper script
> to invoke the real CGI under valgrind in that environment.
>
>
> Yep. ulimit reports "unlimited".
>
>
> there are a number of limits on different resources
>
> try 'ulimit -a' to see all the limits that the shell knows about
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 14868
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 10240
cpu time (seconds, -t) unlimited
max user processes (-u) 1024
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
--
J.Lance Wilkinson ("Lance") InterNet: Lance.Wilkinson@psu.edu
Systems Design Specialist - Lead Phone: (814) 865-4870
Digital Library Technologies FAX: (814) 863-3560
E3 Paterno Library
Penn State University
University Park, PA 16802
http://ucs.psu.edu/home/jlw12@psu.edu?fmt=freebusy
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Compiled/linked executable CGI script crashes when
run as CGI, runs to completion when run outside HTTPD
Posted by Jeff Trawick <tr...@gmail.com>.
On Mon, Dec 3, 2012 at 11:17 AM, J.Lance Wilkinson <jl...@psu.edu> wrote:
> Jeff Trawick wrote:
>
> On Mon, Dec 3, 2012 at 10:28 AM, J.Lance Wilkinson <jlw12@psu.edu<mailto:
>> jlw12@psu.edu>> wrote:
>>
>> Jeff Trawick wrote:
>>
>> Run under valgrind from the shell, and if that doesn't work
>> create a wrapper script to be the CGI and use the wrapper script
>> to invoke the real CGI under valgrind in that environment.
>>
>
> Yep. ulimit reports "unlimited".
>
there are a number of limits on different resources
try 'ulimit -a' to see all the limits that the shell knows about
>
> Script is intended for METHOD=POST, so I have a "debug" version
> which
> simply outputs a script to set all the environment variables, and a
> file containing all the POSTed parameters. The regular version,
> when REQUEST_METHOD doesn't exist and "@filename" appears on the
> command line, reads and initializes the POST parameters from the
> filename specified on the command line. And runs to completion.
> If I have its output written to a file, I can read that file in a
> browser and see EXACTLY what I expect the script to output. If I
> run it as a CGI script, it aborts before 90% of the output appears
> (but -- that 90% of the output is generated at the VERY END of the
> script's run, after it does all its analysis and builds up a fairly
> large N-ary tree in memory, then prints it out as an unordered list
> (<ul><li></li><li><ul><li></**li><li></li></ul></li><li></**
> li></ul>).
>
> Run that command at a shell prompt after setting all the
> environment
> variables, and it runs to completion.
>
> Run it under GDB (DDD) and same results.
>
> Even run it under strace and it completes OK.
>
> I'd run it under these debuggers all the time, if it didn't
> exponentially slow it down.
>
>
> --
> J.Lance Wilkinson ("Lance") InterNet: Lance.Wilkinson@psu.edu
> Systems Design Specialist - Lead Phone: (814) 865-4870
> Digital Library Technologies FAX: (814) 863-3560
> E3 Paterno Library
> Penn State University
> University Park, PA 16802
> http://ucs.psu.edu/home/jlw12@**psu.edu?fmt=freebusy<http://ucs.psu.edu/home/jlw12@psu.edu?fmt=freebusy>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@httpd.**apache.org<us...@httpd.apache.org>
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
--
Born in Roswell... married an alien...
http://emptyhammock.com/
Re: [users@httpd] Compiled/linked executable CGI script crashes when
run as CGI, runs to completion when run outside HTTPD
Posted by "J.Lance Wilkinson" <jl...@psu.edu>.
Jeff Trawick wrote:
> On Mon, Dec 3, 2012 at 10:28 AM, J.Lance Wilkinson <jlw12@psu.edu
> <ma...@psu.edu>> wrote:
>
> Jeff Trawick wrote:
>
> Run under valgrind from the shell, and if that doesn't work
> create a wrapper script to be the CGI and use the wrapper script
> to invoke the real CGI under valgrind in that environment.
Yep. ulimit reports "unlimited".
Script is intended for METHOD=POST, so I have a "debug" version which
simply outputs a script to set all the environment variables, and a
file containing all the POSTed parameters. The regular version,
when REQUEST_METHOD doesn't exist and "@filename" appears on the
command line, reads and initializes the POST parameters from the
filename specified on the command line. And runs to completion.
If I have its output written to a file, I can read that file in a
browser and see EXACTLY what I expect the script to output. If I
run it as a CGI script, it aborts before 90% of the output appears
(but -- that 90% of the output is generated at the VERY END of the
script's run, after it does all its analysis and builds up a fairly
large N-ary tree in memory, then prints it out as an unordered list
(<ul><li></li><li><ul><li></li><li></li></ul></li><li></li></ul>).
Run that command at a shell prompt after setting all the environment
variables, and it runs to completion.
Run it under GDB (DDD) and same results.
Even run it under strace and it completes OK.
I'd run it under these debuggers all the time, if it didn't
exponentially slow it down.
--
J.Lance Wilkinson ("Lance") InterNet: Lance.Wilkinson@psu.edu
Systems Design Specialist - Lead Phone: (814) 865-4870
Digital Library Technologies FAX: (814) 863-3560
E3 Paterno Library
Penn State University
University Park, PA 16802
http://ucs.psu.edu/home/jlw12@psu.edu?fmt=freebusy
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Compiled/linked executable CGI script crashes when
run as CGI, runs to completion when run outside HTTPD
Posted by Jeff Trawick <tr...@gmail.com>.
On Mon, Dec 3, 2012 at 10:28 AM, J.Lance Wilkinson <jl...@psu.edu> wrote:
> Jeff Trawick wrote:
>
>> Run under valgrind from the shell, and if that doesn't work create a
>> wrapper script to be the CGI and use the wrapper script to invoke the real
>> CGI under valgrind in that environment.
>>
>
> Tried that already: (executable is /.../request; paths shortened
> and
> valgrind line wrapped for brevity)
>
> #!/bin/sh
> valgrind --leak-check=full --track-origins=yes \
> --log-file=/.../logs/valgrind.**request.log /.../request
>
> CGI script runs to completion.
I'm not sure if you did this already, but did you use a fake CGI to capture
ulimits and envvars to aid with reproducing standalone?
>
>
> El 03/12/12 15:37, J.Lance Wilkinson escribió:
>>
>> Title pretty much says it all.
>>
>> HTTPD is 2.2.15 on RHEL6.
>>
>> Executable aborts, log files show glibc detected memory issues
>> (messages vary).
>> Run same executable outside of the CGI environment, on the same
>> host and under an unprivileged user (can't run as "apache"
>> because that's not a real ID, my sysadmin says), duplicating all
>> input, under a debugger and not under a debugger, and it runs to
>> completion with no errors.
>>
>> What could HTTPD as the parent environment be imposing that
>> would cause the aborts when they don't occur outside of Apache?
>> I speculated some ulimit kind of thing resulting in less memory
>> actually being available for the thousands of malloc() calls the
>> executable performs.
>>
>
>
> --
> J.Lance Wilkinson ("Lance") InterNet: Lance.Wilkinson@psu.edu
> Systems Design Specialist - Lead Phone: (814) 865-4870
> Digital Library Technologies FAX: (814) 863-3560
> E3 Paterno Library
> Penn State University
> University Park, PA 16802
> http://ucs.psu.edu/home/jlw12@**psu.edu?fmt=freebusy<http://ucs.psu.edu/home/jlw12@psu.edu?fmt=freebusy>
>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@httpd.**apache.org<us...@httpd.apache.org>
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
--
Born in Roswell... married an alien...
http://emptyhammock.com/
Re: [users@httpd] Compiled/linked executable CGI script crashes when
run as CGI, runs to completion when run outside HTTPD
Posted by "J.Lance Wilkinson" <jl...@psu.edu>.
Jeff Trawick wrote:
> Run under valgrind from the shell, and if that doesn't work create a
> wrapper script to be the CGI and use the wrapper script to invoke the
> real CGI under valgrind in that environment.
Tried that already: (executable is /.../request; paths shortened and
valgrind line wrapped for brevity)
#!/bin/sh
valgrind --leak-check=full --track-origins=yes \
--log-file=/.../logs/valgrind.request.log /.../request
CGI script runs to completion.
> El 03/12/12 15:37, J.Lance Wilkinson escribió:
>
> Title pretty much says it all.
>
> HTTPD is 2.2.15 on RHEL6.
>
> Executable aborts, log files show glibc detected memory issues
> (messages vary).
> Run same executable outside of the CGI environment, on the same
> host and under an unprivileged user (can't run as "apache"
> because that's not a real ID, my sysadmin says), duplicating all
> input, under a debugger and not under a debugger, and it runs to
> completion with no errors.
>
> What could HTTPD as the parent environment be imposing that
> would cause the aborts when they don't occur outside of Apache?
> I speculated some ulimit kind of thing resulting in less memory
> actually being available for the thousands of malloc() calls the
> executable performs.
--
J.Lance Wilkinson ("Lance") InterNet: Lance.Wilkinson@psu.edu
Systems Design Specialist - Lead Phone: (814) 865-4870
Digital Library Technologies FAX: (814) 863-3560
E3 Paterno Library
Penn State University
University Park, PA 16802
http://ucs.psu.edu/home/jlw12@psu.edu?fmt=freebusy
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Compiled/linked executable CGI script crashes when
run as CGI, runs to completion when run outside HTTPD
Posted by Jeff Trawick <tr...@gmail.com>.
Run under valgrind from the shell, and if that doesn't work create a
wrapper script to be the CGI and use the wrapper script to invoke the real
CGI under valgrind in that environment.
On Mon, Dec 3, 2012 at 10:17 AM, Antonio Moreno <
antonio.moreno@codebusters.es> wrote:
> El 03/12/12 15:37, J.Lance Wilkinson escribió:
>
>> Title pretty much says it all.
>>
>> HTTPD is 2.2.15 on RHEL6.
>>
>> Executable aborts, log files show glibc detected memory issues (messages
>> vary).
>> Run same executable outside of the CGI environment, on the same host and
>> under an unprivileged user (can't run as "apache" because that's not a real
>> ID, my sysadmin says), duplicating all input, under a debugger and not
>> under a debugger, and it runs to completion with no errors.
>>
>> What could HTTPD as the parent environment be imposing that would cause
>> the aborts when they don't occur outside of Apache? I speculated some
>> ulimit kind of thing resulting in less memory actually being available for
>> the thousands of malloc() calls the executable performs.
>>
>> Site works on another machine with the same configuration, this:
>
> <VirtualHost *:80>
> ServerAdmin info@codebusters.es
>
> #default
> DocumentRoot /var/www/
>
> <Directory /var/www/>
> Options Indexes FollowSymLinks MultiViews
> AllowOverride All
> Order allow,deny
> allow from all
> </Directory>
>
> ErrorLog /var/log/apache2/error.log
>
> # Possible values include: debug, info, notice, warn, error, crit,
> # alert, emerg.
> LogLevel warn
>
> CustomLog /var/log/apache2/access.log combined
>
> Alias /doc/ "/usr/share/doc/"
> <Directory "/usr/share/doc/">
> Options Indexes MultiViews FollowSymLinks
> AllowOverride None
> Order deny,allow
> Deny from all
> Allow from 127.0.0.0/255.0.0.0 ::1/128
> </Directory>
>
> </VirtualHost>
>
> I copied the directory of the machine that works and I dump the data base.
> Thanks.
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@httpd.**apache.org<us...@httpd.apache.org>
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
--
Born in Roswell... married an alien...
http://emptyhammock.com/
Re: [users@httpd] Compiled/linked executable CGI script crashes when
run as CGI, runs to completion when run outside HTTPD
Posted by Antonio Moreno <an...@codebusters.es>.
El 03/12/12 15:37, J.Lance Wilkinson escribió:
> Title pretty much says it all.
>
> HTTPD is 2.2.15 on RHEL6.
>
> Executable aborts, log files show glibc detected memory issues
> (messages vary).
> Run same executable outside of the CGI environment, on the same host
> and under an unprivileged user (can't run as "apache" because that's
> not a real ID, my sysadmin says), duplicating all input, under a
> debugger and not under a debugger, and it runs to completion with no
> errors.
>
> What could HTTPD as the parent environment be imposing that would
> cause the aborts when they don't occur outside of Apache? I
> speculated some ulimit kind of thing resulting in less memory actually
> being available for the thousands of malloc() calls the executable
> performs.
>
Site works on another machine with the same configuration, this:
<VirtualHost *:80>
ServerAdmin info@codebusters.es
#default
DocumentRoot /var/www/
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
I copied the directory of the machine that works and I dump the data
base. Thanks.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org