On Wed, Dec 29, 2010 at 11:31 AM, Tiago Katcipis <katci...@inf.ufsc.br>wrote:
> Hi all, > > I'm having some problem using wsapi-fastcgi with lighthttpd. I got > everything working fine, but every time an error occurs (any 4xx) or someone > send a DELETE method request my script is reloaded. I don't want the script > to reload because every time this happens i reconnect to the db and the > older connections get lost and the db continues to consume resources (on > this case is mongo db, a thread gets locked forever each time my script is > reloaded). > > When there is no error 4XX or DELETE everything works as expected, the > script is not reloaded on each request and the connection is reused (i run > an init function when the script is loaded, but it is supposed to run only > once and them handle the requests without reloading). > > Here is the configuration that i run the fastcgi: > > #!/usr/bin/lua > local common = require "wsapi.common" > local fastcgi = require "wsapi.fastcgi" > > local ONE_HOUR = 60 * 60 > local ONE_DAY = 24 * ONE_HOUR > > local wsapi_loader = common.make_loader{ > isolated = true, -- isolate each script in its own Lua state > Taking a good look at the code i just changed the isolated = true to false, so it would call the make_persistent_loader instead of the isolated. It worked fine just as i expected, still don't know why with isolated = true it reloads the script when returning a 4XX or receiving a DELETE. I'm working with only one script, so the problem seems resolved to me. Sorry for the noise. Best regards, Katcipis > filename = nil, -- if you want to force the launch of a single script > launcher = "idlocutor.fcgi", -- the name of this script > reload = false, -- if you want to reload the application on > every request > period = ONE_HOUR, -- frequency of Lua state staleness checks > ttl = ONE_DAY, -- time-to-live for Lua states > vars = -- order of checking for the path of the > script > { "SCRIPT_FILENAME", > "PATH_TRANSLATED" } > } > > fastcgi.run(wsapi_loader) > > > i tried to take a look on wsapi.fastcgi and them on wsapi.commom to > understand why it could be reloading my script, i understood that when the > file is modified or reload is true it will reload the script on a new > lua_State, but i was unable to find another moment when this is > done..related to the errors (the rings logic is not too much easy to > understand, specially to me, never used rings). > > this reload problem (or maybe expected behaviour....i don't know) is caused > by wsapi? wsapi-fastcgi? or is something related to lighthttpd? (i doubt of > that because the pid of the fastcgi process remains the same...it seems that > wsapi is reloading the script internally) I'm kinda new to web development, > sorry I'm asking something stupid. > > > best regards, > Katcipis > -- http://www.getgnulinux.org/windows
_______________________________________________ Kepler-Project mailing list Kepler-Project@lists.luaforge.net http://lists.luaforge.net/cgi-bin/mailman/listinfo/kepler-project http://www.keplerproject.org/