Re: Manually spawned process and unix domain sockets
Tom Bowden <[email protected]> Sat, 20 Aug 2011 19:07:37 -0500
| Newsgroups | gmane.comp.web.fastcgi.devel |
|---|---|
| Message-ID | <[email protected]> |
--===============1854297412656726179==
Content-type: multipart/alternative;
boundary="Boundary_(ID_gn5eRSGLr0ITeO/PKxNNIQ)"
--Boundary_(ID_gn5eRSGLr0ITeO/PKxNNIQ)
Content-type: text/plain; charset=WINDOWS-1252; delsp=yes; format=flowed
Content-transfer-encoding: quoted-printable
How exactly is it failing?
Are you fcntl()'ing anything about named pipe fd?
On Aug 17, 2011, at 9:10 AM, Howard May wrote:
> I have the following requirements which I am struggling to meet:
>
>
>
> 1) Use UNIX domain sockets (named pipes) to communicate (they =20=
> are on the same box)
>
> 2) Have a single instance of both lighttpd and myApp running
>
> 3) Have multiple simultaneous requests forwarded from =20
> Lighttpd at a time
>
>
>
> I have a robust setup which uses TCP connections and works very =20
> well. This uses the FCGX API to allow myApp to receive multiple =20
> requests simultaneously. All I am trying to do is port this from =20
> using tcp connections to using named pipes. But I have as yet =20
> failed to make this work.
>
>
>
> I have now reverted to a simple test app which I have included =20
> below along with my Lighttpd config snipet.
>
> I have set the ownership of everything in a ten mile radius to =20
> =91lighttpd=92
>
>
>
> I would be very grateful for any help or suggestions as to what =20
> might be going wrong.
>
>
>
> Best Regards
>
>
>
> Howard May
>
>
>
> P.S. Konstantin, I have BCCed you explicitly as you had previously =20
> offered assistance in this area (back in 2009!)
>
>
>
>
>
> fastcgi.server =3D ( "/namedpipetest/" =3D>
>
> (
>
> (
>
> "socket" =3D> "/var/tmp/lighttpd/wsi-=20
> fastcgi.socket",
>
> "check-local" =3D> "disable"
>
> )
>
> )
>
> )
>
>
>
>
>
>
>
> #include <stdio.h>
>
> #include "fcgiapp.h"
>
>
>
> void main(int argc, char ** argv)
>
> {
>
> int fd;
>
> int result;
>
> FCGX_Request req;
>
> printf("Fastcgi FIFO test app\n");
>
> result =3D FCGX_Init();
>
> if(result !=3D 0)
>
> {
>
> printf("FCGX_Init returned %d\n", result);
>
> return;
>
> }
>
> fd =3D FCGX_OpenSocket("/var/tmp/lighttpd/wsi-fastcgi.socket", 16);
>
> if(fd =3D=3D 0)
>
> {
>
> printf("FCGX_OpenSocket returned 0\n");
>
> return;
>
> }
>
> FCGX_InitRequest(&req, fd, 0);
>
>
>
> while((result =3D FCGX_Accept_r(&req))=3D=3D0);
>
> {
>
> FCGX_FPrintF(req.out, "Content-type: text/html\r\n\r=20
> \n<TITLE>Whoop</TITLE>\n");
>
> }
>
> printf("FCGX_Accept_r returned %d\n", result);
>
> return;
>
> }
>
>
>
>
>
> _______________________________________________
> FastCGI-developers mailing list
> FastCGI-developers-xGejAJT2w6xVgU18Zptdi0EOCMrvLtNR@public.gmane.org
> http://mailman.fastcgi.com/mailman/listinfo/fastcgi-developers
--Boundary_(ID_gn5eRSGLr0ITeO/PKxNNIQ)
Content-type: text/html; charset=WINDOWS-1252
Content-transfer-encoding: quoted-printable
<html><body style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; =
-webkit-line-break: after-white-space; ">
How exactly is it failing?<div><br></div><div><br></div><div>Are you =
fcntl()'ing anything about named pipe =
fd?</div><div><br></div><div><br></div><div><div><div>On Aug 17, 2011, =
at 9:10 AM, Howard May wrote:</div><br =
class=3D"Apple-interchange-newline"><blockquote type=3D"cite"> <div =
class=3D"Section1"><p class=3D"MsoNormal"><font size=3D"2" =
face=3D"Arial"><span style=3D"font-size:10.0pt; font-family:Arial">I =
have the following requirements which I am struggling to =
meet:<o:p></o:p></span></font></p><p class=3D"MsoNormal"><font size=3D"2" =
face=3D"Arial"><span style=3D"font-size:10.0pt; =
font-family:Arial"><o:p> </o:p></span></font></p><p =
class=3D"MsoNormal" =
style=3D"margin-left:.5in;text-indent:-.25in;mso-list:l0 level1 =
lfo1"><font size=3D"2" face=3D"Arial"><span =
style=3D"font-size:10.0pt;font-family:Arial"><span =
style=3D"mso-list:Ignore">1)<font size=3D"1" face=3D"Times New =
Roman"><span style=3D"font:7.0pt "Times New =
Roman""> =
</span></font></span></span></font><font size=3D"2" face=3D"Arial"><span =
style=3D"font-size:10.0pt;font-family:Arial">Use UNIX domain sockets =
(named pipes) to communicate (they are on the same =
box)<o:p></o:p></span></font></p><p class=3D"MsoNormal" =
style=3D"margin-left:.5in;text-indent:-.25in;mso-list:l0 level1 =
lfo1"><font size=3D"2" face=3D"Arial"><span =
style=3D"font-size:10.0pt;font-family:Arial"><span =
style=3D"mso-list:Ignore">2)<font size=3D"1" face=3D"Times New =
Roman"><span style=3D"font:7.0pt "Times New =
Roman""> =
</span></font></span></span></font><font size=3D"2" face=3D"Arial"><span =
style=3D"font-size:10.0pt;font-family:Arial">Have a single instance of =
both lighttpd and myApp running<o:p></o:p></span></font></p><p =
class=3D"MsoNormal" =
style=3D"margin-left:.5in;text-indent:-.25in;mso-list:l0 level1 =
lfo1"><font size=3D"2" face=3D"Arial"><span =
style=3D"font-size:10.0pt;font-family:Arial"><span =
style=3D"mso-list:Ignore">3)<font size=3D"1" face=3D"Times New =
Roman"><span style=3D"font:7.0pt "Times New =
Roman""> =
</span></font></span></span></font><font size=3D"2" face=3D"Arial"><span =
style=3D"font-size:10.0pt;font-family:Arial">Have multiple simultaneous =
requests forwarded from Lighttpd at a =
time<o:p></o:p></span></font></p><p class=3D"MsoNormal"><font size=3D"2" =
face=3D"Arial"><span style=3D"font-size:10.0pt; =
font-family:Arial"><o:p> </o:p></span></font></p><p =
class=3D"MsoNormal"><font size=3D"2" face=3D"Arial"><span =
style=3D"font-size:10.0pt; font-family:Arial">I have a robust setup =
which uses TCP connections and works very well. This uses the FCGX API =
to allow myApp to receive multiple requests simultaneously. All I am =
trying to do is port this from using tcp connections to using named =
pipes. But I have as yet failed to make this =
work.<o:p></o:p></span></font></p><p class=3D"MsoNormal"><font size=3D"2" =
face=3D"Arial"><span style=3D"font-size:10.0pt; =
font-family:Arial"><o:p> </o:p></span></font></p><p =
class=3D"MsoNormal"><font size=3D"2" face=3D"Arial"><span =
style=3D"font-size:10.0pt; font-family:Arial">I have now reverted to a =
simple test app which I have included below along with my Lighttpd =
config snipet.<o:p></o:p></span></font></p><p class=3D"MsoNormal"><font =
size=3D"2" face=3D"Arial"><span style=3D"font-size:10.0pt; =
font-family:Arial">I have set the ownership of everything in a ten mile =
radius to =91lighttpd=92<o:p></o:p></span></font></p><p =
class=3D"MsoNormal"><font size=3D"2" face=3D"Arial"><span =
style=3D"font-size:10.0pt; =
font-family:Arial"><o:p> </o:p></span></font></p><p =
class=3D"MsoNormal"><font size=3D"2" face=3D"Arial"><span =
style=3D"font-size:10.0pt; font-family:Arial">I would be very grateful =
for any help or suggestions as to what might be going wrong. =
<o:p></o:p></span></font></p><p class=3D"MsoNormal"><font size=3D"2" =
face=3D"Arial"><span style=3D"font-size:10.0pt; =
font-family:Arial"><o:p> </o:p></span></font></p><p =
class=3D"MsoNormal"><font size=3D"2" face=3D"Arial"><span =
style=3D"font-size:10.0pt; font-family:Arial">Best =
Regards<o:p></o:p></span></font></p><p class=3D"MsoNormal"><font =
size=3D"2" face=3D"Arial"><span style=3D"font-size:10.0pt; =
font-family:Arial"><o:p> </o:p></span></font></p><p =
class=3D"MsoNormal"><font size=3D"2" face=3D"Arial"><span =
style=3D"font-size:10.0pt; font-family:Arial">Howard =
May<o:p></o:p></span></font></p><p class=3D"MsoNormal"><font size=3D"2" =
face=3D"Arial"><span style=3D"font-size:10.0pt; =
font-family:Arial"><o:p> </o:p></span></font></p><p =
class=3D"MsoNormal"><font size=3D"2" face=3D"Arial"><span =
style=3D"font-size:10.0pt; font-family:Arial">P.S. Konstantin, I have =
BCCed you explicitly as you had previously offered assistance in this =
area (back in 2009!)<o:p></o:p></span></font></p><p =
class=3D"MsoNormal"><font size=3D"2" face=3D"Arial"><span =
style=3D"font-size:10.0pt; =
font-family:Arial"><o:p> </o:p></span></font></p><p =
class=3D"MsoNormal"><font size=3D"2" face=3D"Arial"><span =
style=3D"font-size:10.0pt; =
font-family:Arial"><o:p> </o:p></span></font></p><p =
class=3D"MsoNormal"><font size=3D"2" face=3D"Arial"><span =
style=3D"font-size:10.0pt; =
font-family:Arial">fastcgi.server =3D ( =
"/namedpipetest/" =3D><o:p></o:p></span></font></p><p =
class=3D"MsoNormal"><font size=3D"2" face=3D"Arial"><span =
style=3D"font-size:10.0pt; =
font-family:Arial"> &=
nbsp; =
(<o:p></o:p></span></font></p><p class=3D"MsoNormal"><font size=3D"2" =
face=3D"Arial"><span style=3D"font-size:10.0pt; =
font-family:Arial"> &=
nbsp; &nb=
sp; (<o:p></o:p></span></font></p><p class=3D"MsoNormal"><font =
size=3D"2" face=3D"Arial"><span style=3D"font-size:10.0pt; =
font-family:Arial"> &=
nbsp; &nb=
sp; "socket" =3D> =
"/var/tmp/lighttpd/wsi-fastcgi.socket",<o:p></o:p></span></font></p><p =
class=3D"MsoNormal"><font size=3D"2" face=3D"Arial"><span =
style=3D"font-size:10.0pt; =
font-family:Arial"> &=
nbsp; &nb=
sp; "check-local" =3D> =
"disable"<o:p></o:p></span></font></p><p class=3D"MsoNormal"><font =
size=3D"2" face=3D"Arial"><span style=3D"font-size:10.0pt; =
font-family:Arial"> &=
nbsp; &nb=
sp; )<o:p></o:p></span></font></p><p class=3D"MsoNormal"><font =
size=3D"2" face=3D"Arial"><span style=3D"font-size:10.0pt; =
font-family:Arial"> &=
nbsp; =
)<o:p></o:p></span></font></p><p class=3D"MsoNormal"><font size=3D"2" =
face=3D"Arial"><span style=3D"font-size:10.0pt; =
font-family:Arial"> &=
nbsp; =
)<o:p></o:p></span></font></p><p class=3D"MsoNormal"><font size=3D"2" =
face=3D"Arial"><span style=3D"font-size:10.0pt; =
font-family:Arial"><o:p> </o:p></span></font></p><p =
class=3D"MsoNormal"><font size=3D"2" face=3D"Arial"><span =
style=3D"font-size:10.0pt; =
font-family:Arial"><o:p> </o:p></span></font></p><p =
class=3D"MsoNormal"><font size=3D"2" face=3D"Arial"><span =
style=3D"font-size:10.0pt; =
font-family:Arial"><o:p> </o:p></span></font></p><p =
class=3D"MsoNormal" style=3D"text-autospace:none"><font size=3D"1" =
face=3D"Courier New"><span =
style=3D"font-size:9.0pt;font-family:"Courier New"">#include =
<stdio.h><o:p></o:p></span></font></p><p class=3D"MsoNormal" =
style=3D"text-autospace:none"><font size=3D"1" face=3D"Courier =
New"><span style=3D"font-size:9.0pt;font-family:"Courier =
New"">#include "fcgiapp.h"<o:p></o:p></span></font></p><p =
class=3D"MsoNormal" style=3D"text-autospace:none"><font size=3D"1" =
face=3D"Courier New"><span =
style=3D"font-size:9.0pt;font-family:"Courier =
New""><o:p> </o:p></span></font></p><p class=3D"MsoNormal" =
style=3D"text-autospace:none"><font size=3D"1" face=3D"Courier =
New"><span style=3D"font-size:9.0pt;font-family:"Courier =
New"">void main(int argc, char ** =
argv)<o:p></o:p></span></font></p><p class=3D"MsoNormal" =
style=3D"text-autospace:none"><font size=3D"1" face=3D"Courier =
New"><span style=3D"font-size:9.0pt;font-family:"Courier =
New"">{<o:p></o:p></span></font></p><p class=3D"MsoNormal" =
style=3D"text-autospace:none"><font size=3D"1" face=3D"Courier =
New"><span style=3D"font-size:9.0pt;font-family:"Courier =
New""> int fd;<o:p></o:p></span></font></p><p =
class=3D"MsoNormal" style=3D"text-autospace:none"><font size=3D"1" =
face=3D"Courier New"><span =
style=3D"font-size:9.0pt;font-family:"Courier New""> int =
result;<o:p></o:p></span></font></p><p class=3D"MsoNormal" =
style=3D"text-autospace:none"><font size=3D"1" face=3D"Courier =
New"><span style=3D"font-size:9.0pt;font-family:"Courier =
New""> FCGX_Request req;<o:p></o:p></span></font></p><p =
class=3D"MsoNormal" style=3D"text-autospace:none"><font size=3D"1" =
face=3D"Courier New"><span =
style=3D"font-size:9.0pt;font-family:"Courier New""> =
printf("Fastcgi FIFO test app\n");<o:p></o:p></span></font></p><p =
class=3D"MsoNormal" style=3D"text-autospace:none"><font size=3D"1" =
face=3D"Courier New"><span =
style=3D"font-size:9.0pt;font-family:"Courier New""> =
result =3D FCGX_Init();<o:p></o:p></span></font></p><p class=3D"MsoNormal"=
style=3D"text-autospace:none"><font size=3D"1" face=3D"Courier =
New"><span style=3D"font-size:9.0pt;font-family:"Courier =
New""> if(result !=3D 0)<o:p></o:p></span></font></p><p =
class=3D"MsoNormal" style=3D"text-autospace:none"><font size=3D"1" =
face=3D"Courier New"><span =
style=3D"font-size:9.0pt;font-family:"Courier New""> =
{<o:p></o:p></span></font></p><p class=3D"MsoNormal" =
style=3D"text-autospace:none"><font size=3D"1" face=3D"Courier =
New"><span style=3D"font-size:9.0pt;font-family:"Courier =
New""> printf("FCGX_Init returned %d\n", =
result);<o:p></o:p></span></font></p><p class=3D"MsoNormal" =
style=3D"text-autospace:none"><font size=3D"1" face=3D"Courier =
New"><span style=3D"font-size:9.0pt;font-family:"Courier =
New""> return;<o:p></o:p></span></font></p><p =
class=3D"MsoNormal" style=3D"text-autospace:none"><font size=3D"1" =
face=3D"Courier New"><span =
style=3D"font-size:9.0pt;font-family:"Courier =
New""> }<o:p></o:p></span></font></p><p =
class=3D"MsoNormal" style=3D"text-autospace:none"><font size=3D"1" =
face=3D"Courier New"><span =
style=3D"font-size:9.0pt;font-family:"Courier New""> fd =
=3D FCGX_OpenSocket("/var/tmp/lighttpd/wsi-fastcgi.socket", =
16);<o:p></o:p></span></font></p><p class=3D"MsoNormal" =
style=3D"text-autospace:none"><font size=3D"1" face=3D"Courier =
New"><span style=3D"font-size:9.0pt;font-family:"Courier =
New""> if(fd =3D=3D 0)<o:p></o:p></span></font></p><p =
class=3D"MsoNormal" style=3D"text-autospace:none"><font size=3D"1" =
face=3D"Courier New"><span =
style=3D"font-size:9.0pt;font-family:"Courier New""> =
{<o:p></o:p></span></font></p><p class=3D"MsoNormal" =
style=3D"text-autospace:none"><font size=3D"1" face=3D"Courier =
New"><span style=3D"font-size:9.0pt;font-family:"Courier =
New""> printf("FCGX_OpenSocket returned =
0\n");<o:p></o:p></span></font></p><p class=3D"MsoNormal" =
style=3D"text-autospace:none"><font size=3D"1" face=3D"Courier =
New"><span style=3D"font-size:9.0pt;font-family:"Courier =
New""> return;<o:p></o:p></span></font></p><p =
class=3D"MsoNormal" style=3D"text-autospace:none"><font size=3D"1" =
face=3D"Courier New"><span =
style=3D"font-size:9.0pt;font-family:"Courier New""> =
}<o:p></o:p></span></font></p><p class=3D"MsoNormal" =
style=3D"text-autospace:none"><font size=3D"1" face=3D"Courier =
New"><span style=3D"font-size:9.0pt;font-family:"Courier =
New""> FCGX_InitRequest(&req, fd, =
0);<o:p></o:p></span></font></p><p class=3D"MsoNormal" =
style=3D"text-autospace:none"><font size=3D"1" face=3D"Courier =
New"><span style=3D"font-size:9.0pt;font-family:"Courier =
New""><o:p> </o:p></span></font></p><p class=3D"MsoNormal" =
style=3D"text-autospace:none"><font size=3D"1" face=3D"Courier =
New"><span style=3D"font-size:9.0pt;font-family:"Courier =
New""> while((result =3D =
FCGX_Accept_r(&req))=3D=3D0);<o:p></o:p></span></font></p><p =
class=3D"MsoNormal" style=3D"text-autospace:none"><font size=3D"1" =
face=3D"Courier New"><span =
style=3D"font-size:9.0pt;font-family:"Courier New""> =
{<o:p></o:p></span></font></p><p class=3D"MsoNormal" =
style=3D"text-autospace:none"><font size=3D"1" face=3D"Courier =
New"><span style=3D"font-size:9.0pt;font-family:"Courier =
New""> FCGX_FPrintF(req.out, "Content-type: =
text/html\r\n\r\n<TITLE>Whoop</TITLE>\n");<o:p></o:p></span></=
font></p><p class=3D"MsoNormal" style=3D"text-autospace:none"><font =
size=3D"1" face=3D"Courier New"><span =
style=3D"font-size:9.0pt;font-family:"Courier New""> =
}<o:p></o:p></span></font></p><p class=3D"MsoNormal" =
style=3D"text-autospace:none"><font size=3D"1" face=3D"Courier =
New"><span style=3D"font-size:9.0pt;font-family:"Courier =
New""> printf("FCGX_Accept_r returned %d\n", =
result);<o:p></o:p></span></font></p><p class=3D"MsoNormal" =
style=3D"text-autospace:none"><font size=3D"1" face=3D"Courier =
New"><span style=3D"font-size:9.0pt;font-family:"Courier =
New""> return;<o:p></o:p></span></font></p><p =
class=3D"MsoNormal" style=3D"text-autospace:none"><font size=3D"1" =
face=3D"Courier New"><span =
style=3D"font-size:9.0pt;font-family:"Courier =
New"">}<o:p></o:p></span></font></p><p class=3D"MsoNormal"><font =
size=3D"2" face=3D"Arial"><span style=3D"font-size:10.0pt; =
font-family:Arial"><o:p> </o:p></span></font></p><p =
class=3D"MsoNormal"><font size=3D"2" face=3D"Arial"><span =
style=3D"font-size:10.0pt; =
font-family:Arial"><o:p> </o:p></span></font></p> </div><div =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; =
">_______________________________________________</div><div =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; ">FastCGI-developers mailing list</div><div =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; "><a =
href=3D"mailto:FastCGI-developers-xGejAJT2w6xVgU18Zptdi0EOCMrvLtNR@public.gmane.org">FastCGI-developers@=
mailman.fastcgi.com</a></div><div style=3D"margin-top: 0px; =
margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><a =
href=3D"http://mailman.fastcgi.com/mailman/listinfo/fastcgi-developers">ht=
tp://mailman.fastcgi.com/mailman/listinfo/fastcgi-developers</a></div> =
</blockquote></div><br></div></body></html>=
--Boundary_(ID_gn5eRSGLr0ITeO/PKxNNIQ)--
--===============1854297412656726179==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
FastCGI-developers mailing list
FastCGI-developers-xGejAJT2w6xVgU18Zptdi0EOCMrvLtNR@public.gmane.org
http://mailman.fastcgi.com/mailman/listinfo/fastcgi-developers
--===============1854297412656726179==--