Socket connection hangs from JRuby (Rinda::RingServer.primary) on OSX 10.6/10.5

May 10, 2010 at 7:41pm

Socket connection hangs from JRuby (Rinda::RingServer.primary) on OSX 10.6/10.5

Hey all,
(I think) I have a pretty tricky question concerning opening ports from within the Max JVM. I’m writing an external where I’m attempting to use JRuby and it’s Rinda library to do some distributed processing (the advantage of this method is automatic IP lookup – no need to specify port numbers, IP addressses, etc). I’ve tried both my own embedded JRuby RuntimeAdapter and the ajm tools: both to no avail. The external runs fine until it tries to connect to DRb (distributed Ruby) ports from within the JRuby runtime. From what I’m gathering, though, it seems to be a JVM security issue rather than a JRuby issue itself (i.e. DRb and Rinda are implemented in JRuby itself and work fine when run on their own from the command line, but fail [quite fantastically] when they’re called within the Max JVM).

The application’s lifecycle is roughly paired down to the following actions: MaxObject created in Max MSP editor [mxj wildcat.audioservice test] => audioservice class executes JRuby script evaluator => JRuby calls Rinda::RingFinger.primary (when there is already a RingServer running on localhost:49373);

Because it hangs either Max or Live (when run as a Max4Live extern) as opposed to throwing any exceptions, I’ve had to track down the app’s behavior via the OSX Activity Monitor. What I get seems to confirm that it is a security violation. At the very bottom of the “Open Files and Ports” dialog of the Max (or Max4Live) process window I get the following code after the Java classpaths are listed (i.e. the Max JVM has started up)

‘*:49518
/dev/null
->0x0848d950
->0x0848f384
localhost:49517->localhost:49516
->0x0848f3e8
count=0, state=0×2
[::192.168.0.19]:49518->[::192.168.0.19]:49519
[::192.168.0.19]:49518->[::192.168.0.19]:49520
[::192.168.0.19]:49521->[::192.168.0.19]:49373
/private/etc/security/audit_class’

Soooooo – I can see that DRb is attempting to both create it’s own port on 49518-49520 (DRb tries to open 2 ranges of ports for a level of error handling) and it’s attempting to connect to the RingServer that lives on port 49373 (the REAL question from the JRuby side, i.e. RingFinger.primary IS working). THEN we see the little beastie “/private/etc/security/audit_class” which seems to be saying “I’m gonna see if you actually are allowed to connect over these ports or if you’re an unsigned call and potentially malicious code, I’m gonna stop the execution of the program entirely, freak out, and play with the beach ball…”

So, Max Community, my question to you is this: can you think of any way I can either configure the Max JVM to allow these socket connections or is there any Java code I need to wrap my JRuby classes in to give them the same permissions as other MaxObject classes. Or am I just a damed loon for trying it this way :-P.

Thanks everybody,

Brady

brady@familiarcat.com

#50310

You must be logged in to reply to this topic.