[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Technical question wrt lua_pcall() and errors
- From: Marc Balmer <marc@...>
- Date: Tue, 18 Jan 2011 14:06:01 +0100
Am 18.01.11 13:41, schrieb Romulo:
> It might not be the case, but it happened to me that the httpd's error
> handler made a second request to the fastcgi url, thus, repeating the
> response.
> I'm sorry to don't quite remember it, but I guess it was the
> favicon.ico (I know, the browser is the one to blame, but still..)
> Perhaps you could print the request URI on top of each fcgi accept loop.
>
I think the reason must be something different. It only happens, and
really only, if the Lua function called with pcall() generates an error.
> --rb
>
> Ps: sorry for the formatting, I'm using a cellphone.
>
> On 2011-01-18, Marc Balmer <marc@msys.ch> wrote:
>> I made a strange observation in a FastCGI program written in C, that
>> calls Lua to do the actual work. The basic outline is as follows:
>>
>> while (FCGI_Accept() >= 0) {
>> fcgi_handler(config);
>> FCGI_Finish();
>> }
>>
>> The fcgi_handler() calls Lua code using lua_pcall(). Nothing fancy.
>>
>> When the Lua function returns without error, everything is fine, the
>> accept loop above is called once per request.
>>
>> As soon as the Lua returns an error, however, the accept loop above is
>> run twice.
>>
>> Does Lua somehow modify stdin, stdout, stderr or the environment when an
>> error happens? That would partly explain above behaviour.
>>
>>
>>
>