Skip to content
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

assorted questions #97

Open
dvv opened this issue Oct 3, 2012 · 6 comments
Open

assorted questions #97

dvv opened this issue Oct 3, 2012 · 6 comments

Comments

@dvv
Copy link
Contributor

dvv commented Oct 3, 2012

  1. -c N switch spawns N workers, but do we respawn them on their death?
  2. IPC via /tmp is a known security hole -- it is not wise to communicate via something world-writeable (think of lev run under root)
@kristate
Copy link
Member

kristate commented Oct 3, 2012

@dvv, thank-you for your questions!

  1. cores will not respawn on death -- they should not die. If a core dies something is wrong.
  2. In the future, I would like multiple lev applications to be able to talk to each other. re: security, it might be important to invent some sort of handshaking mechanism or perhaps replace unix domain sockets with something better for IPC.

@dvv
Copy link
Contributor Author

dvv commented Oct 3, 2012

can we (do we have interface to) pass out-of-band file descriptors to write() calls?

@kristate
Copy link
Member

kristate commented Oct 3, 2012

@dvv yes, these are handled by _master[1] and _worker[2]. See net.lua[3] or examples/server-chat.lua[4] for an example on how to use the API.

The interface is exposed via the mbox object.

[1] https://github.com/connectFree/lev/blob/master/lib/lev/_master.lua
[2] https://github.com/connectFree/lev/blob/master/lib/lev/_worker.lua
[3] https://github.com/connectFree/lev/blob/master/lib/lev/net.lua
[4] https://github.com/connectFree/lev/blob/master/examples/server-chat.lua

@kristate
Copy link
Member

kristate commented Oct 3, 2012

@dvv specifically, FDs can be sent on IPC pipes via the write method like so:

local fd = 9
ipc_pipe:write("this is data", fd)

FDs can be received on ipc-enabled pipes with this function signature:

ipc_client:read_start(function(c, nread, buf, fd, type)
   p("we have received an fd:", fd, "of type:", type)
end)

@dvv
Copy link
Contributor Author

dvv commented Oct 4, 2012

i'd like to be able to use lev as loadable module. for that, loop initialization etc. must be inside luaopen_levbase instead of pmain or alike. since lev_main.c starts with executing dostring(require('lev')) in both master and worker mode, this shouldn't be very difficult and is mostly question of moving some code.
can it be done, or it is not feasible? tia

@kristate
Copy link
Member

kristate commented Oct 6, 2012

@dvv Lev is using a modified version of LuaJIT, so not all code may be compatible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants