httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kuc...@mail.com
Subject [users@httpd] httpd forks & handling duplicate file descriptor
Date Mon, 30 May 2005 06:01:47 GMT
Hi 

Need help in solving the httpd fork and file descriptor issue -

scenario:
Iam doing a sendmsg(fd,..) followed by recv(fd,...) indirectly in my php file.
i.e, iam calling socket API's which are warppers for sendmsg() and recv() 
by including them in my php file.
There are multile such php files which call sendmsg()and recv() for different functionality.
I don't have much control over 'fd' and they are supposed to be generated in ususal incremental
manner.
The sendmsg() and recv() are hence intended to be run 'atomic' to avoid one recv() actually

receiving the reply for sendmsg() of a wrong pair. 

My issue: 
since http does a load sharing and creates forks for httpd (ps -ef |grep httpd) at any given
point of time 
i noticed that the same file desciptors are being used across the different php files (used
strace for this).
This is causing some recv()s to actually receive the reply for sendmsg() of a wrong pair.

better solutions please..?:
1) I could check if the recv() data matches the sendmsg() request by comparing some data.
   Not a good solution since this is not the root cause's solution. 

2) I tried using php semaphores (sem_get/sem_aquire/sem_release) around all the send/recv
pairs.
   However this still didn't solve my problem.
   [ is httpd fork ignoring a semaphore region and still forking and 
    and handling a different php when a recv() is already waiting ???]

Pls do let me know a better way of handling this issue.

Nb: newbie and first post. i did not find any luck in the httd archives as well. 
Regards
Noor

-- 
___________________________________________________________
Sign-up for Ads Free at Mail.com
http://promo.mail.com/adsfreejump.htm


---------------------------------------------------------------------
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