Socket connection hangs from JRuby (Rinda::RingServer.primary) on OSX 10.6/10.5
(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)
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.
Forums > Java