lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Am 18.01.11 10:58, schrieb Stefan Hett:
> The default lua error handler raises exceptions. So if lua_error() (i.e.
> it does not return). Hence ur FCGI_Finish() is not being called.
> An option to go with might be to encapsulate the fcgi_handler()-call in
> a try/catch-block.

That is wrong.  I call the Lua function using lua_pcall(), and that does
return.

> 
> Regards,
> Stefan
>> 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.
>>
>>
>>
>>
>> -----
>> No virus found in this message.
>> Checked by AVG - www.avg.com
>> Version: 10.0.1191 / Virus Database: 1435/3387 - Release Date: 01/17/11
>>
>>
> 
>