Unix socket plugin patch for systemd

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Unix socket plugin patch for systemd

Max Leske

We've created a patch for the unix socket plugin that allows for socket activation via systemd.

This is how it works:
1. tell systemd to link a socket to the vm (e.g. 8080)
2. send a request to the socket
3. systemd will launch the vm and hold the request until the image is connected to the port
4. (here's where the patch comes in) connect to the socket in the image (e.g. by starting WAKom - WAKom startOn: 8080)

The patch is necessary because the primitive would fail when connecting to the socket (the plugin thinks that the socket is already in use).

So here's my question: who is responsible for the plugin or would like to integrate the patch?

Cheers,
Max
Reply | Threaded
Open this post in threaded view
|

Re: Unix socket plugin patch for systemd

David T. Lewis
 
On Thu, May 02, 2013 at 05:22:07PM +0200, Max Leske wrote:

>
> We've created a patch for the unix socket plugin that allows for socket activation via systemd.
>
> This is how it works:
> 1. tell systemd to link a socket to the vm (e.g. 8080)
> 2. send a request to the socket
> 3. systemd will launch the vm and hold the request until the image is connected to the port
> 4. (here's where the patch comes in) connect to the socket in the image (e.g. by starting WAKom - WAKom startOn: 8080)
>
> The patch is necessary because the primitive would fail when connecting to the socket (the plugin thinks that the socket is already in use).
>
> So here's my question: who is responsible for the plugin or would like to integrate the patch?

Hi Max,

You've come to the right place. I'm guessing that your patches involve both the Smalltalk
(slang) and the platform C code. If so, it may be easiest if you just post the patches
to the list for starters, and then we can sort out what needs to be done by whom. Please
also let us know which code base you are working with (trunk interpreter VM, Cog, other?).

For more information on contributing to the Unix VM, see Ian's documentation here:

  http://squeakvm.org/unix/download.html#caveats
  http://squeakvm.org/cgi-bin/viewvc.cgi/squeak/trunk/platforms/unix/doc/README.Contributing?view=markup

There are currently several branches of VM development that will be impacted by
a change to SocketPlugin, so we'll make sure they all get updated appropriately.

Thanks!

Dave

Reply | Threaded
Open this post in threaded view
|

Re: Unix socket plugin patch for systemd

Max Leske
In reply to this post by Max Leske
 
On Thu, May 02, 2013 at 05:22:07PM +0200, Max Leske wrote:
> 
> We've created a patch for the unix socket plugin that allows for socket activation via systemd.
> 
> This is how it works:
> 1. tell systemd to link a socket to the vm (e.g. 8080)
> 2. send a request to the socket
> 3. systemd will launch the vm and hold the request until the image is connected to the port
> 4. (here's where the patch comes in) connect to the socket in the image (e.g. by starting WAKom - WAKom startOn: 8080)
> 
> The patch is necessary because the primitive would fail when connecting to the socket (the plugin thinks that the socket is already in use).
> 
> So here's my question: who is responsible for the plugin or would like to integrate the patch?

Hi Max,

You've come to the right place. I'm guessing that your patches involve both the Smalltalk
(slang) and the platform C code. 

Yes, correct. The (hacky) version right now adds a new type of socket for systemd (now new primitive, maybe you'll want to do that). Then on the image side there's a bit of logic to determine the kind of socket and a consistency check of the systemd environment variable. So all in all it's really quite simple.

If so, it may be easiest if you just post the patches to the list for starters, and then we can sort out what needs to be done by whom. 

I'll try to post the patches next week.

Please also let us know which code base you are working with (trunk interpreter VM, Cog, other?).

We use the 4.0.3-2202 interpreter VM and patched the plugin there for now. We also took a look at the newest version from http://gitorious.org/cogvm/blessed/trees/master/platforms/unix/plugins/SocketPlugin and found that there weren't many differences. So we thought to apply the patch to that file. I think it shouldn't be much work to backport the patch to the interpreter VM after that (?).

Actually, now that I think about it, it would probably make more sense to patch the interpreter VM trunk. That makes it easier for us to test before we post it. Anyway, I'll get back to you.

For more information on contributing to the Unix VM, see Ian's documentation here:

  http://squeakvm.org/unix/download.html#caveats
  http://squeakvm.org/cgi-bin/viewvc.cgi/squeak/trunk/platforms/unix/doc/README.Contributing?view=markup

There are currently several branches of VM development that will be impacted by
a change to SocketPlugin, so we'll make sure they all get updated appropriately.

That would be awesome!

Thanks!

Dave

Reply | Threaded
Open this post in threaded view
|

Re: Unix socket plugin patch for systemd

David T. Lewis
 
On Thu, May 02, 2013 at 10:13:45PM +0200, Max Leske wrote:

>  
> > On Thu, May 02, 2013 at 05:22:07PM +0200, Max Leske wrote:
> > >
> > > We've created a patch for the unix socket plugin that allows for socket activation via systemd.
> > >
> > > This is how it works:
> > > 1. tell systemd to link a socket to the vm (e.g. 8080)
> > > 2. send a request to the socket
> > > 3. systemd will launch the vm and hold the request until the image is connected to the port
> > > 4. (here's where the patch comes in) connect to the socket in the image (e.g. by starting WAKom - WAKom startOn: 8080)
> > >
> > > The patch is necessary because the primitive would fail when connecting to the socket (the plugin thinks that the socket is already in use).
> > >
> > > So here's my question: who is responsible for the plugin or would like to integrate the patch?
> >
> > Hi Max,
> >
> > You've come to the right place. I'm guessing that your patches involve both the Smalltalk
> > (slang) and the platform C code.
>
> Yes, correct. The (hacky) version right now adds a new type of socket for systemd (now new primitive, maybe you'll want to do that). Then on the image side there's a bit of logic to determine the kind of socket and a consistency check of the systemd environment variable. So all in all it's really quite simple.
>
> > If so, it may be easiest if you just post the patches to the list for starters, and then we can sort out what needs to be done by whom.
>
> I'll try to post the patches next week.
>
> > Please also let us know which code base you are working with (trunk interpreter VM, Cog, other?).
>
> We use the 4.0.3-2202 interpreter VM and patched the plugin there for now. We also took a look at the newest version from http://gitorious.org/cogvm/blessed/trees/master/platforms/unix/plugins/SocketPlugin and found that there weren't many differences. So we thought to apply the patch to that file. I think it shouldn't be much work to backport the patch to the interpreter VM after that (?).
>
> Actually, now that I think about it, it would probably make more sense to patch the interpreter VM trunk. That makes it easier for us to test before we post it. Anyway, I'll get back to you.

Yes, and I would suggest that you just post your updated version of sqUnixSocket.c
based on your 4.0.3-2202 source code base. This is the standard Unix VM, and I don't
think that sqUnixSocket.c has changed since 4.0.3.2202. Ian Piumarta (the author)
prefers that we provide him with complete files rather than diffs, and we can easily
sort out whatever differences there are (if any) with the Cog code base and various
Pharo supported versions.

For the Smalltalk changes, a change set or fileout is fine, or you can just provide
a pointer to a Monticello repository if you prefer.

If you want to use the latest code versions, you can work from the up to date code
in Subversion (svn co http://squeakvm.org/svn/squeak) and Monticello VMMaker
(http://source.squeak.org/VMMaker). But it probably does not make any difference
in this case, so I'd suggest to just post whatever you have from the 4.0.3-2202 code
if that is easier for you to do.

Dave



>
> >
> > For more information on contributing to the Unix VM, see Ian's documentation here:
> >
> >   http://squeakvm.org/unix/download.html#caveats
> >   http://squeakvm.org/cgi-bin/viewvc.cgi/squeak/trunk/platforms/unix/doc/README.Contributing?view=markup
> >
> > There are currently several branches of VM development that will be impacted by
> > a change to SocketPlugin, so we'll make sure they all get updated appropriately.
>
> That would be awesome!
>
> >
> > Thanks!
> >
> > Dave
>