[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Technical question wrt lua_pcall() and errors
- From: Marc Balmer <marc@...>
- Date: Tue, 18 Jan 2011 11:48:31 +0100
Am 18.01.11 11:15, schrieb Drake Wilson:
> Quoth Marc Balmer <firstname.lastname@example.org>, on 2011-01-18 10:47:39 +0100:
>> 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.
> A pcall doesn't by itself modify any I/O streams or the process
> environment. Could you show more context regarding where the
> lua_pcall happens? In particular, where are you getting the Lua
> state, and what do you do with the Lua stack before and after the
> pcall? Does this still happen if you replace the Lua code with
> trivial Lua code that does nothing except throw an error?
The code that causes the error is a trivial example (indexing a nil
value), the Lua state is created in fcgi_handler, then pcall(), then
send a CGI response back to the server. What would also disrupt the
communiction beetween my app and the webserver was any output the
pcall() is causing. But I doubt Lua does output anything on it's own,
or am I wrong?