Title: JFFI class not found on Windows 64-bit
Type: crash Severity: normal
Components: Core Versions: 2.7a1
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: jeff.allen Nosy List: amak, fwierzbicki, jeff.allen, shashank, slestak, varialus
Priority: Keywords: patch

Created on 2012-05-19.09:11:16 by jeff.allen, last changed 2012-06-16.18:29:30 by fwierzbicki.

File name Uploaded Description Edit Remove
v2.7.0a1_x86_64_dump.txt jeff.allen, 2012-05-19.09:11:16 console session
issue1889.patch jeff.allen, 2012-06-04.09:44:03 Patch fixing issue 1889
msg7106 (view) Author: Jeff Allen (jeff.allen) Date: 2012-05-19.09:11:15
Jython 2.7.0a1 produces an ugly, but surprisingly non-fatal, stack dump with each run on Windows 7 64-bit. (Not quite a crash then.) I've added a pasted version of the console session as an attachment. The short version of the story runs as follows:
>hg update v2.7.0a1
>ant clean
... only the usual complaints
*sys-package-mgr*: processing new jar, 'C:\hg\jython-dev\dist\jython-dev.jar'
*sys-package-mgr*: processing new jar, 'C:\hg\jython-dev\dist\javalib\jffi-x86_64-Windows.jar'
        at com.kenai.jffi.Foreign.getInstance(
        at com.kenai.jffi.Type$BuiltinTypeInfo.<clinit>(
        at com.kenai.jffi.Type$Builtin.size(
        at org.python.core.PyFile.file_isatty(
        at org.python.core.PyFile.isatty(
        at org.python.core.PySystemState.initEncoding(
        at org.python.core.PySystemState.<init>(
        at org.python.core.PySystemState.doInitialize(
        at org.python.core.PySystemState.initialize(
        at org.python.core.PySystemState.initialize(
        at org.python.core.PySystemState.initialize(
        at org.python.util.jython.main(
Caused by: java.lang.RuntimeException: java.lang.UnsatisfiedLinkError: could not locate stub library in jar file.  Tried [jni/x86_64-Windows/jffi-1.2.dll, /jni/x86_64-Windows/jffi-1.2.dll]
Caused by: java.lang.UnsatisfiedLinkError: could not locate stub library in jar file.  Tried [jni/x86_64-Windows/jffi-1.2.dll, /jni/x86_64-Windows/jffi-1.2.dll]
        at com.kenai.jffi.internal.StubLoader.getStubLibraryStream(
Jython 2.7a1+ (, May 19 2012, 09:43:27)
[Java HotSpot(TM) 64-Bit Server VM (Sun Microsystems Inc.)] on java1.6.0_26
Type "help", "copyright", "credits" or "license" for more information.
>>> [x*x for x in range(10)]
[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
msg7107 (view) Author: Jeff Allen (jeff.allen) Date: 2012-05-19.14:51:17
I spent some time looking into this.

The problem appears to be that we have updated JFFI to a snapshot release that does not support the full set of platforms. When we use JFFI, com.kenai.jffi.internal.StubLoader looks for a JAR named after the architecture of the machine and loads a versioned DLL from it. Here is the one for i386:

>jar tf extlibs\jffi-i386-Windows.jar

But the one for 64-bit Windows, and several others, contain nothing:

>jar tf extlibs\jffi-x86_64-Windows.jar

In a previous version, it looked like this:

>jar tf ..\jython-2.5\extlibs\jffi-x86_64-Windows.jar

Quite recently, the project supplied new JARs, see: (this seems to be the authoritative source).

Rudely forcing the JAR from that commit into extlibs solves the problem for Windows 7/64. I won't try to make a patch for that as it's probably easier to go to the source and get a stable release. Although actively worked, it is not clear to me what the project considers a stable release.
msg7108 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2012-05-20.00:46:40
Weird - we'll be having another look at this around the time that the next JRuby comes out - they are the ones developing jffi - I'd be surprised if they have this problem. We probably missed a jar.
msg7179 (view) Author: Jeff Allen (jeff.allen) Date: 2012-06-04.09:44:02
The jar is not so much missing as empty, as are those for several other platforms. A changeset pulled jars from the jnr project during developement. (However, that seems to be the situation indefinitely: it would help if the jnr project were to define releases of a described quality.)

Just in the scope of this issue, here is a patch that means we can run Jython 2.7 on Windows 7. It supplies a more recent jar file from the jnr project, and (for the benefit of developers using Eclipse) updates .classpath to use it.
msg7235 (view) Author: Jeff Allen (jeff.allen) Date: 2012-06-16.15:02:59
I've done a round of developement using this locally, so I propose to commit this (now I can).
msg7236 (view) Author: Jeff Allen (jeff.allen) Date: 2012-06-16.16:01:53
Revised jar now pushed to the trunk. I'll close this, as I seem able to, but feel free to tell me only the PM is supposed to do that.

Note that a good few of the other jffi jars are empty too, so other users of several other platforms will have the same problem.
msg7237 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2012-06-16.18:29:29
Jeff: feel free to close bugs as you see fit.
Date User Action Args
2012-06-16 18:29:30fwierzbickisetmessages: + msg7237
2012-06-16 16:01:53jeff.allensetstatus: open -> closed
messages: + msg7236
2012-06-16 15:02:59jeff.allensetassignee: jeff.allen
messages: + msg7235
2012-06-16 13:43:21amaksetnosy: + amak
2012-06-04 09:44:06jeff.allensetkeywords: + patch
nosy: + shashank
messages: + msg7179
files: + issue1889.patch
2012-05-31 15:25:19slestaksetnosy: + slestak
2012-05-30 06:22:52varialussetnosy: + varialus
2012-05-20 00:46:40fwierzbickisetmessages: + msg7108
2012-05-19 14:51:17jeff.allensetnosy: + fwierzbicki
messages: + msg7107
2012-05-19 09:11:16jeff.allencreate