New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Attempting to unpersist an in-progress coroutine seg faults #6
Comments
I'm now using 5.1.3 on OS X. I'm having trouble persisting a suspended coroutine. I persist this: code = { and get back this: Persistence of suspended co-routines was my primary motivation for working with Lua. Is there a workaround? |
I think in order for this to work, this bug will need to be fixed. I'm not actively using Pluto anymore, so my maintainership of the project hasn't been the most active, but I'll see if I can fit in an hour or two today to look at it. |
@nathanaeljones In response to your "should I move to Rhino?" question, you may not have to. I took a look at your Weaver project; maybe I'm not understanding it entirely, but why are you persisting coroutines to disk between resumes? Why not just store them in memory, like Copas does? |
Well, my prototype currently uses the console, but is intended for a web-based game. State needs to persist between user sessions, which could be anywhere between a day and a year. Volatile memory wouldn't work very well. |
Ok, makes sense. Do you really need to model a user's experience as a single call to start_game()? |
I'm not exactly sure what you mean.... I'm avoiding continuations as much as possible - I use a continuation-passing style to allow frequent hot code upgrades (being collaboratively-edited and all), but inside each 'file', there is a logic flow that would be hard to express if every branch required a separate function. I'm trying to abstract the whole async and state thing away so that I can simplify game development enough to make a 'wiki game' work. |
Could we move this discussion to e-mail? It's gotten highly specific to your game, and I'd like to keep this thread more general for others with this issue. Could you give a thorough explanation of how your web game will work so I can recommend alternatives if possible? My e-mail is rob@hoelz.ro. |
Ok, I did some more testing, and it turns out this feature works fine; my example is just broken. If you try this: local pluto = require 'pluto'
local coro = coroutine.create(function()
for i = 1, 10 do
coroutine.yield(i * i)
end
end)
for i = 1, 5 do
print(coroutine.resume(coro))
end
local perms = {
[coroutine.yield] = 1,
}
local s = pluto.persist(perms, coro)
perms = { [1] = coroutine.yield }
coro = pluto.unpersist(perms, s)
for i = 1, 5 do
print(coroutine.resume(coro))
end ...it works fine. |
What platform are you running? Versions? Sent from my iPad On Sep 5, 2011, at 10:37 PM, hoelzroreply@reply.github.com wrote:
|
Lua 5.1.4, OS X 10.6 nathanaeljones reply@reply.github.com wrote: What platform are you running? Versions? Sent from my iPad On Sep 5, 2011, at 10:37 PM, hoelzroreply@reply.github.com wrote:
Reply to this email directly or view it on GitHub: |
On Lua 5.1.3 using the latest from the 'master' branch of your repo, I get true 1 I'm using the code you sent me: local pluto = require 'pluto' local coro = coroutine.create(function() for i = 1, 5 do What was the change you made to the example? On Mon, Sep 5, 2011 at 11:30 PM, hoelzro <
|
-----BEGIN PGP SIGNED MESSAGE----- The change is this: perms = { [1] = coroutine.yield } Have you tried this on Lua 5.1.4? Also, make sure you're using the same version of Lua that you compiled Pluto against; it's very sensitive to binary changes.
On Sep 5, 2011, at 5:56 PM, nathanaeljones wrote:
-----BEGIN PGP SIGNATURE----- iEYEARECAAYFAk5laO4ACgkQUoGaR6SGEaq3HgCeOI7Ub6RVOQsXbPrr8Egq47zG |
I installed 5.1.4, cleaned and rebuild pluto, got exactly the same result. Also, the tests fail... what happens when you run make test? I get: Nathanael:pluto nathanael$ make test On Tue, Sep 6, 2011 at 2:27 AM, hoelzro <
|
I get success...try changing line 166: outfile = io.open("test.plh", "wb") to this: outfile = assert(io.open("test.plh", "wb")) and tell me what results you get. |
Turns out test.plh was locked somehow. (your code helped diagnose that).. pptest now runs, still getting ./puptest On Tue, Sep 6, 2011 at 3:00 AM, hoelzro <
|
This is during make test? Is that the only output it gives? |
No, the entire output is: Nathanael:pluto nathanael$ make test Also, found out something new... The difference between the seg fault and my corruption error The following code gives me an "bad argument #1 to 'resume' (coroutine local pluto = require 'pluto' local coro = coroutine.create(function() for i = 1, 5 do On Tue, Sep 6, 2011 at 3:08 AM, hoelzro <
|
How strange...that same code works fine on my machine. How did you install Lua? By hand, or via a package manager? |
By hand... Make macosx, sudo make install... I have installed 5.2, 5.1.4,5.1.3,5.1.4 in that order... I'm assuming they overwrite each other properly. At least lua -v is correct each time. Sent from my iPad On Sep 6, 2011, at 3:29 AM, hoelzroreply@reply.github.com wrote:
|
I wouldn't make such an assumption...where have you installed Lua to? |
Always the default, /usr/local/. I copied the shell output for 'make install' for all the versions. 5.2 only I ran make uninstall for each version before running make install for 5.1.4 Lua 5.2 alpha Lua 5.1.3 Lua 5.1.4 On Tue, Sep 6, 2011 at 3:49 AM, hoelzro <
|
Try installing Lua to a non-default location, like ~/lua. |
I think it might be with my installation of pluto. Apparently I still had Or, at least, I thought I did. I misread the makefile and assumed it was Instead, I'm only seeing pluto.dylib. How should I go about installing this On Tue, Sep 6, 2011 at 4:09 AM, hoelzro <
|
See, this is something that frustrates me about Lua on OS X. I believe that Lua should be built to load dylibs, but a lot of scripts have it load .so files. sigh For the time being, run this to at least test things out: export LUA_CPATH='?.dylib' |
Wow.. thanks, it's working! I can't believe it ended being something so stupid... Serves me right for I really appreciate your help! Nathanael On Tue, Sep 6, 2011 at 4:35 AM, hoelzro <
|
Happy to help! Glad you got it working! Let me know if you have any more questions about Pluto. Of course, if you end up writing any patches, they would be most welcome. =) |
Thanks :) I'm making great progress, already got a basic web UI going. Have you used xavante or wsapi at all? I can't figure out how to get an On Tue, Sep 6, 2011 at 5:18 AM, hoelzro <
|
I haven't done any web development with Lua (unfortunately); why don't you join the #lua channel on Freenode when you have some time? A lot of Lua people are there, and I'm sure someone there could help you out. |
Title says it all. Test script:
The text was updated successfully, but these errors were encountered: