You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Corsix <co...@www.corsix.org> on 2008/08/08 15:05:56 UTC

mod_wombat and luasocket

Hi,

While using mod_wombat and attempting to use luasocket (with require
"socket"), I get a white screen. Assuming test.lua is:
-- code --
function handle(r)
  r:write "Start\n"
  require "socket"
  r:write "Done\n"
end
-- end code --
The expected output when requesting this page via a web browser would give:
Start
Done
If "socket" is changed to "lpeg" (assuming you have LPEG installed),
or the require line is commented out, then yes, that is the output.
However, as-is, the response is a blank screen. As far as I can tell,
the cause is this part of luasocket's usocket.c:
/* code */
/*-------------------------------------------------------------------------*\
* Initializes module
\*-------------------------------------------------------------------------*/
int socket_open(void) {
    /* instals a handler to ignore sigpipe or it will crash us */
    signal(SIGPIPE, SIG_IGN);
    return 1;
}
/* end code */
After commenting out the call to signal and recompiling, the above Lua
code will happily load socket.

Why does commenting out this call cause luasocket to now load, and
what undesired consequences are there of doing this?

Peter

Re: mod_wombat and luasocket

Posted by "Plüm, Rüdiger, VF-Group" <ru...@vodafone.com>.
Have you looked in the httpd error log.
I bet the processing httpd process died with a segfault or something similar.

Regards

Rüdiger 

> -----Ursprüngliche Nachricht-----
> Von: Corsix  
> Gesendet: Freitag, 8. August 2008 15:12
> An: dev@httpd.apache.org
> Betreff: Re: mod_wombat and luasocket
> 
> Seems I was wrong; commenting out that call doesn't make luasocket
> load. This still leaves the main question unresolved though; why does
> require"socket" cause a blank response (as even a standard error would
> be caught by mod_wombat's usage of lua_pcall)?
> 
> 2008/8/8 Corsix <co...@www.corsix.org>:
> > Hi,
> >
> > While using mod_wombat and attempting to use luasocket (with require
> > "socket"), I get a white screen. Assuming test.lua is:
> > -- code --
> > function handle(r)
> >  r:write "Start\n"
> >  require "socket"
> >  r:write "Done\n"
> > end
> > -- end code --
> > The expected output when requesting this page via a web 
> browser would give:
> > Start
> > Done
> > If "socket" is changed to "lpeg" (assuming you have LPEG installed),
> > or the require line is commented out, then yes, that is the output.
> > However, as-is, the response is a blank screen. As far as I 
> can tell,
> > the cause is this part of luasocket's usocket.c:
> > /* code */
> > 
> /*------------------------------------------------------------
> -------------*\
> > * Initializes module
> > 
> \*------------------------------------------------------------
> -------------*/
> > int socket_open(void) {
> >    /* instals a handler to ignore sigpipe or it will crash us */
> >    signal(SIGPIPE, SIG_IGN);
> >    return 1;
> > }
> > /* end code */
> > After commenting out the call to signal and recompiling, 
> the above Lua
> > code will happily load socket.
> >
> > Why does commenting out this call cause luasocket to now load, and
> > what undesired consequences are there of doing this?
> >
> > Peter
> >
> 

Re: mod_wombat and luasocket

Posted by Corsix <co...@www.corsix.org>.
Seems I was wrong; commenting out that call doesn't make luasocket
load. This still leaves the main question unresolved though; why does
require"socket" cause a blank response (as even a standard error would
be caught by mod_wombat's usage of lua_pcall)?

2008/8/8 Corsix <co...@www.corsix.org>:
> Hi,
>
> While using mod_wombat and attempting to use luasocket (with require
> "socket"), I get a white screen. Assuming test.lua is:
> -- code --
> function handle(r)
>  r:write "Start\n"
>  require "socket"
>  r:write "Done\n"
> end
> -- end code --
> The expected output when requesting this page via a web browser would give:
> Start
> Done
> If "socket" is changed to "lpeg" (assuming you have LPEG installed),
> or the require line is commented out, then yes, that is the output.
> However, as-is, the response is a blank screen. As far as I can tell,
> the cause is this part of luasocket's usocket.c:
> /* code */
> /*-------------------------------------------------------------------------*\
> * Initializes module
> \*-------------------------------------------------------------------------*/
> int socket_open(void) {
>    /* instals a handler to ignore sigpipe or it will crash us */
>    signal(SIGPIPE, SIG_IGN);
>    return 1;
> }
> /* end code */
> After commenting out the call to signal and recompiling, the above Lua
> code will happily load socket.
>
> Why does commenting out this call cause luasocket to now load, and
> what undesired consequences are there of doing this?
>
> Peter
>