>> >> 2. If I run io.popen() and do not close the file explicitly, I have a
>> >> zombie process hanging around (my wild guess is that it happens
>> >> because GC does not kick in, as my script does not create enough
>> >> garbage).

>> > Not really a WSAPI issue, but I can force closing of Lua states when I
>> > discard stale ones, instead of letting the GC close them, and this will
>> > trigger __gc metamethods on these states. My bad.

>> Would be great, thanks! Those zombies are surely looking hungry for
>> our admin's brains :-)

> Already in github.

When does Lua state becomes stale one?

Here is what I do:

1. Launch the zombie.lua (below) through the browser.
2. $ ps auxf

<...>
www-data 18091  0.0  0.0  27528  2892 ?        Ss   16:19   0:00
/usr/bin/lua -lluarocks.loader
/usr/local/lib/luarocks/rocks/wsapi-fcgi/cvs-2/bin/wsapi.fcgi
www-data 18105  0.0  0.0      0     0 ?        Z    16:20   0:00  \_
[sh] <defunct>

The zombie process just sits there. Perhaps I'm missing something?
Should I wait longer for it to be collected?

I must be missing something.

Alexander.

require "wsapi.request"

module(..., package.seeall)

function run(wsapi_env)
  local headers = { ["Content-type"] = "text/html" }

  local function hello_text()
    -- This creates zombie process. It should be collected soon.
    local zombie = io.popen("ls"):read("*a")
    -- Note zombie is not closed.
  end

  return 200, headers, coroutine.wrap(hello_text)
end

_______________________________________________
Kepler-Project mailing list
Kepler-Project@lists.luaforge.net
http://lists.luaforge.net/cgi-bin/mailman/listinfo/kepler-project
http://www.keplerproject.org/

Reply via email to