httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anthony DiSante <tech....@encodable.com>
Subject [users@httpd] CGI's output buffered during file upload?
Date Fri, 20 Jan 2006 23:36:18 GMT
Hello,

I have a Perl CGI script that accepts file uploads via the usual POST 
method.  The point of this script is that it implements a progress meter in 
the user's browser; during POST, the script writes info to a log file about 
how much data has been uploaded so far, and the browser uses AJAX to ask the 
server for this info about once per second.

This has worked fine for many people on different servers (Windows, Linux, 
Apache, IIS).  But there's one Apache/Linux server on which it won't seem to 
work.  It doesn't work because on this one server, the logfile that stores 
the upload-progress info doesn't actually get written to disk until the 
entire upload is complete.  This despite the fact that the script creates 
the log file before even starting to accept the upload data.

So it seems like this server is doing some kind of write-caching that's 
preventing the log file from hitting the disk until the whole process is 
finished.  I tried switching to a mySQL backend instead of using a plain 
text logfile, but saw the same behavior: the new row doesn't actually appear 
in the database until the upload is over.  I have even tried writing a 
simple socket-based backend, where the main process spawns a server which 
does nothing more than hold the info in memory (in a hash)... and even THAT 
gets delayed; the process forks and tries to bind to a port on the system, 
but the bind isn't allowed to complete until the upload is over:

1137794755: starting new upload
1137794755: ask_progress_server(): trying to connect to port 2345
1137794756: ask_progress_server(): trying to connect to port 2345
1137794757: ask_progress_server(): trying to connect to port 2345
...
1137794814: spawn_progress_server(): trying to bind to port 2345
1137794814: spawn_progress_server(): bound to port 2345

 From that debugging output, you can see that the "trying to bind to port" 
doesn't happen until nearly 60 seconds after the upload starts, even though 
it is called right at the beginning, before any ask_progress_server() ever 
happens.

On every other system this script has been tested on, all the various 
backends (text file, database, socket) work perfectly fine.  But on this one 
system, it seems almost like the CGI process is sandboxed and can't send 
anything at all out to the system until the upload has finished.

Is there something in the OS (Linux) or maybe an Apache module that would 
cause this kind of behavior?

Here is some information about the Apache installation:

Server version: Apache/1.3.34 (Unix)
Server's Module Magic Number: 19990320:18
Server compiled with....
-D EAPI
-D HAVE_MMAP
-D HAVE_SHMGET
-D USE_SHMGET_SCOREBOARD
-D USE_MMAP_FILES
-D HAVE_FCNTL_SERIALIZED_ACCEPT
-D HAVE_SYSVSEM_SERIALIZED_ACCEPT
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
-D DYNAMIC_MODULE_LIMIT=64
-D HARD_SERVER_LIMIT=2048
-D HTTPD_ROOT="/usr/local/apache"
-D SUEXEC_BIN="/usr/local/apache/bin/suexec"
-D DEFAULT_PIDLOG="logs/httpd.pid"
-D DEFAULT_SCOREBOARD="logs/httpd.scoreboard"
-D DEFAULT_LOCKFILE="logs/httpd.lock"
-D DEFAULT_ERRORLOG="logs/error_log"
-D TYPES_CONFIG_FILE="conf/mime.types"
-D SERVER_CONFIG_FILE="conf/httpd.conf"
-D ACCESS_CONFIG_FILE="conf/access.conf"
-D RESOURCE_CONFIG_FILE="conf/srm.conf"


Compiled-in modules:
http_core.c
mod_env.c
mod_log_config.c
mod_mime.c
mod_negotiation.c
mod_status.c
mod_include.c
mod_autoindex.c
mod_dir.c
mod_cgi.c
mod_asis.c
mod_imap.c
mod_actions.c
mod_userdir.c
mod_alias.c
mod_access.c
mod_auth.c
mod_so.c
mod_setenvif.c
mod_ssl.c
mod_frontpage.c
suexec: enabled; valid wrapper /usr/local/apache/bin/suexec

 From the conf file:
LoadModule rewrite_module libexec/mod_rewrite.so
LoadModule expires_module libexec/mod_expires.so
LoadModule php4_module libexec/libphp4.so
LoadModule bwlimited_module libexec/mod_bwlimited.so
LoadModule bytes_log_module libexec/mod_log_bytes.so
LoadModule auth_passthrough_module libexec/mod_auth_passthrough.so
LoadModule security_module libexec/mod_security.so


Thanks,

-- 
Anthony DiSante
Encodable Industries
http://encodable.com/


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message