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

Maybe still a problem with double-long integers in Windows (mingw)? #10

Closed L2G closed 12 years ago

L2G commented 12 years ago

I'm working on some code that uses RJB to create a Java object. The constructor requires a reference to an object with a callback method. The object I'm passing to the constructor is a Ruby object bound to a Java class with Rjb::bind, so the callback is Ruby code within the Ruby object.

Everything is fine up to the point where the Java code tries to call the callback, and then it breaks down. It blames a C library routine called RtlUlonglongByteSwap, so immediately I thought of the problems that used to exist with building RJB on Windows.

This is on Windows 7, using Ruby 1.9.2p290 and the latest DevKit (DevKit-tdm-32-4.5.2-20111229-1559). Due to the nature of my project, I'm not allowed to use a newer Ruby interpreter.

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (0xc0000029), pid=4016, tid=4316
#
# JRE version: 7.0-b147
# Java VM: Java HotSpot(TM) Client VM (21.0-b17 mixed mode, sharing windows-x86 )
# Problematic frame:
# C  [ntdll.dll+0x90812]
#
. . .

Stack: [0x06310000,0x06510000],  sp=0x0650f3d0,  free space=2044k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [ntdll.dll+0x90812]  RtlUlonglongByteSwap+0x133c2

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  jp.co.infoseek.hp.arton.rjb.RBridge.call(Ljava/lang/String;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+0
j  jp.co.infoseek.hp.arton.rjb.RBridge.invoke(Ljava/lang/Object;Ljava/lang/reflect/Method;[Ljava/lang/Object;)Ljava/lang/Object;+7
j  $Proxy0.onSignal(Lcom/example/xframework/services/signals/AgentSignal;)V+16
j  com.example.xframework.services.abstracts.Agent.onConnectionChange(Lcom/example/xframework/link/utils/LinkStates;)V+161
. . .
arton commented 12 years ago

Hi

Thank you for your report. I've tried to figure out what happened, but I can't. So I wonder if you'd like to show the method signature of the interface that causes runtime error.

Best regards.

L2G commented 12 years ago

I will have to reduce the code to a minimal example so as not to violate my non-disclosure agreement with my employer. I will see what I can do. If I don't respond in the next day or two, it'll be because I've run out of time to work on this and my boss asked me to move on to something else.

L2G commented 12 years ago

We determined that we were really running up against Rjb's documented incompatibility with multiple Java threads. We were using Java code that was multithreaded and we didn't realize it.

Is the Java thread problem something that is impossible to fix? If I have some code I can give you that reproduces this problem repeatably, would that be helpful to you?