lua-users home
lua-l archive

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


Hi,

	In my attempt to get Xavante running, I came across an unusual problem.

After configuring all paths and dependencies, when I << require 't_xavante_start.lua' >>, Lua throws an error:

(...)coxpcall.lua:19: bad argument #1 to `unpack' (table expected, got nil)

Naturally, I opened the file to look what could had caused the error. I found that there are no 'arg' variable (local or function parameter) and IMHO it shouldn't be in globals.

	The function is:

--[[------------------------------------------------------------------

function coxpcall(f, err)
  local co = coroutine.create(f)
  while true do


--                                        ???????????
    local results = {coroutine.resume(co, unpack(arg) )}



    local status = results[1]
    table.remove (results, 1) -- remove status of coroutine.resume
    if not status then
      return false, err(unpack(results))
    end
    if coroutine.status(co) == "suspended" then



--    ???   Attempt to set a global variable?
      arg = {coroutine.yield(unpack(results))}



    else
      return true, unpack(results)
    end
  end
end

--]]------------------------------------------------------------------


If I comment that piece of code ( << unpack(arg) >> ), everything goes fine, except that the Xavante crashes if I stress it. I don't really know if Xavante does crash because of that call or because something else.

I'm using the latest downloadable (non-cvs) files for LuaSocket, Xavante, Copas, coxpcall, lfs and compat-5.1. Lua version is 5.0.2. I'm also using Windows XP pro sp2.

To try to reproduce the crash, just start Xavante, open your browser, and smack down the Refresh button. In not-so-many requests, Lua prompt will end with no error messages - just end.

Please note that the same occurs when I'm using luahttpd. I just had to change some things to get luahttpd 'running': first, the namespace problems like << require "url" >> to << require "socket.url" >>. Second, apparently luahttpd was using an older (or different) of copas. It was attempting to call 'skt_wrap', which didn't exist (ok, I just renamed the reference from skt_wrap to wrap and worked the same way).

One difference between my tests with Xavante and luahttpd is that I'm running luahttpd in my own application, not Lua prompt. When it crash, it shows this error message:

------------------------------------------------------------------------
The instruction at "0x7c93426d" referenced memory at "0x00000006". The memory could not be "read".


Click on OK to terminate the program
Click on CANCEL to debug the program
------------------------------------------------------------------------

	Sorry for the long and mixed post.


--rb