arton / rjb

Ruby Java Bridge
https://www.artonx.org/collabo/backyard/?RubyJavaBridge
GNU Lesser General Public License v2.1
117 stars 34 forks source link

Rjb Segmentation fault at 0x00000000000000 #54

Closed chinshr closed 7 years ago

chinshr commented 7 years ago

When I run celluloid and Rjb (in shoryuken), I get this segmentation fault, when executing this line. It works fine when I run form console.

  parameter = Rjb::import('fr.lium.spkDiarization.parameter.Parameter').new

Note: Problem could be related to this and this and stackoverflow question. Works fine on MacOS X.

Configuration:

Ubuntu 14.04 ruby-2.2.3 (installed through rvm) Java version "1.8.0_111" (Java Oracle 8 on Ubuntu 14.04) JAVA_HOME=/usr/lib/jvm/java-8-oracle/ Rjb 1.5.5

arton commented 7 years ago

As you already knew, forking process with loaded JVM in ruby is not stable on some environment. I suppose that because of JVM usage of signals. IMHO you should spawn celloloid and Rjb scirpt from original shoryuken process. If it needed output of the spawned process, you may pipe between original process and the spawned process with IO.popen or IO.popen2 or 3. Because of JVM was loaded in the separate process, it should work fine as it run from console.

chinshr commented 7 years ago

Got it, I will have to use a pipe between two processes. Thanks for your answer.

chinshr commented 7 years ago

@arton Sorry, one more thing, do you think ruby-drb would work to make a RPC call to a process? It seems the server also uses threads, so I am wondering if I would run into the same issue?

arton commented 7 years ago

It's no problem because dRuby is pure ruby solution. No outer dependency is used like Rjb. The server side of dRuby listens TCP connection in the ruby thread. Once it accepted a client request, it created service thread using ruby's Thread method (means in Ruby context).

chinshr commented 7 years ago

Thanks @arton, that's awesome to know! Btw, have updated diarize-ruby to support this using DRb.