kobo / groovyserv

Groovy's startup acceralator.
http://kobo.github.io/groovyserv/
Other
98 stars 10 forks source link

more than one user can't run groovyserv in the same Unix env. #20

Open berngp opened 13 years ago

berngp commented 13 years ago

Given user userA and user userB and both users are logged to the same _Nix system (Ubuntu, *Fedora_, Centos, RedHat)

When they try to run groovyclient -v at different times, then the call will fail for the second one with the following message.

 $ groovyclient -v
  ERROR: cannot open cookie file

or just fail silently.

Logs: Server started with port: 1961 Unexpected error: GroovyServer ----> java.lang.NullPointerException: Cannot invoke method getAt() on null object ... (ClientProtocols.groovy:100)

berngp commented 13 years ago

We have two potential solutions we are working on...

  1. Dynamic port resolution per User. 1.1 Each user has its own port.
  2. OS FIFOs( aka named pipes) per User per Server one per Client.

    1. Isolation is kept at the user context

    ~/.groovy/groovyserver/server.fifo

    ~/.groovy/groovyserver/clients.fifo.d

    ~/.groovy/groovyserver/scripts

    1. A user will only have one Server listening to its fifo (600)
    2. A client will setup a receiving fifo (600) and a script (600), send a message to the server giving the ref. of the client's fifo and the ref of the script.
    3. Server will receive the message through the fifo, read the script and execute such script sending the output to the client's fifo.

Notes

uehaj commented 13 years ago

Hi,Berngp Thank you for idea. About 2, you mean use named pipe of Unix instead of TCP domain socket port? Is there are way to implement this in Windows, without cygwin? Or we have to use Win32 API directly?

berngp commented 13 years ago

Hi Uehaj Yes FIFOs (aka. named pipes). I am working on a *Nix version of this. I don't have a Windows machine but my understanding is that it supports it natively and through cygwin (Win32 SDK can open them in the same way as files).

nobeans commented 13 years ago

I'm considering an automatic mechanism of decision of available port number for each user. it wasn't in time for v0.6 but I wish I could implement it at v0.7.

berngp commented 13 years ago

No worries, haven't worked with the FIFOs (btw JDK 1.7 supports binary sockets.. problem is.. not sure when 1.7 will arrive)

edwardsd commented 12 years ago

Is there currently a workaround to this issue that would allow groovyserv to be used by multiple users in a shared UNIX environment?

nobeans commented 12 years ago

You can specify the port number when invoking groovyserver and groovyclient. please use the different port number for each user. http://kobo.github.com/groovyserv/userguide_en.html#port-number