You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Edgar J Ramirez <ed...@lmco.com> on 2006/08/05 21:39:53 UTC

[mp2] [QUESTION] System calls and stdin, stdout, stderr in a threaded environment

Hello,

The mod_perl 2.0 User's Guide in its Section 7.10.1 "Thread Environment Issues,"
states "Operations that involve system calls, may or may not be thread-safe."

We have a handful of cgi scripts that need to put out a system call to run a
custom-built crc calculation routine. We're obviously worried that two or more
threads may make system calls to the same crc routine and possibly
cross-contaminate each other's stdin, stdout, and stderr. (The likelihood of
multiple Apache requests to exercise the crc routine simultaneously could,
in some cases, be high).

Our question is, should we don't even consider running these cgi scripts under
a threaded mod_perl ? Or, does mod_perl2 have some built-in safeguards to
protect against the cross-contamination of stdin, stdout, and stderr by multiple
threads ?

Other questions are:

. Are some of Perl's built-in system call functions, e.g. system, open (| ), ``,
   qx, etc. thread-safe ?

. What about the IPC::Run module ? Has anyone been able to establish if the
   methods in this module are thread-safe ?

Thank you for any "illuminating" insights.

Regards,

-Edgar

Our platform:

Hardware: SUN FIRE V120
OS      : Solaris 5.9
Apache  : Apache/2.0.55 (Unix) mod_ssl/2.0.55 OpenSSL/0.9.8 mod_perl/2.0.2 Perl/v5.8.7

Perl    : 5.8.7

Partial dump of perl -V:

Summary of my perl5 (revision 5 version 8 subversion 7) configuration:
   Platform:
     osname=solaris, osvers=2.9, archname=sun4-solaris-thread-multi
     uname='sunos new-webhog 5.9 generic_118558-11 sun4u sparc sunw,ultraax-i2 '
     config_args='-Dprefix=/disk1/perl -Dcc=gcc -Dusethreads'
     hint=recommended, useposix=true, d_sigaction=define
     usethreads=define use5005threads=undef useithreads=define usemultiplicity=define
     useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
     use64bitint=undef use64bitall=undef uselongdouble=undef
     usemymalloc=n, bincompat5005=undef