Issue1262

classification
Title: jython manage runserver - java.lang.ArrayIndexOutOfBoundsException
Type: Severity: normal
Components: Jythonc compiler Versions: 2.5.0
Milestone:
process
Status: closed Resolution: invalid
Dependencies: Superseder:
Assigned To: Nosy List: crankycoder, fwierzbicki, jars, leosoto, pjenvey, zyasoft
Priority: low Keywords:

Created on 2009-02-17.01:57:18 by jars, last changed 2009-08-05.13:54:57 by fwierzbicki.

Files
File name Uploaded Description Edit Remove
testapp.zip jars, 2009-02-17.01:57:18
Messages
msg4146 (view) Author: Jorge Alberto Rodriguez Suarez (jars) Date: 2009-02-17.01:57:18
when create a new project with 'jython django-admin.py startproject
testapp', then 'jython testapp/manage.py runserver', you got:

java.lang.ArrayIndexOutOfBoundsException: 3916
	at org.objectweb.asm.ClassReader.readClass(Unknown Source)
	at org.objectweb.asm.ClassReader.accept(Unknown Source)
	at org.objectweb.asm.ClassReader.accept(Unknown Source)

note: If u delete all .class then it work.

attached is the project that has the errors.

platform: 

mac os 10.5.5

java version "1.5.0_16"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b06-284)
Java HotSpot(TM) Client VM (build 1.5.0_16-133, mixed mode, sharing)
msg4147 (view) Author: Leonardo Soto (leosoto) Date: 2009-02-18.02:54:52
Indeed, the settings$py.class included on the zip is wrong (javap says
it is invalid).

But I haven't been able to reproduce the root problem (i.e, the
generation of the wrong .class file):

lsoto@spirit:~/tmp$ jython
~/src/django.svn.1.0.X/django/bin/django-admin.py startproject testapp
lsoto@spirit:~/tmp$ jython testapp/manage.py runserver
Validating models...
0 errors found

Django version 1.0.3 pre-alpha, using settings 'testapp.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

And I don't think that the specific versions of Django and Jython
matters, because this problem was experienced many months ago by other
people:

http://www.nabble.com/Problems-with-jython-trunk-and-django-1.0-alpha-2-td18938103.html

http://jblebrun.blogspot.com/2008/10/django-on-glassfish-via-jython.html

And another case, from a few days ago:

http://twitter.com/spetznatz/status/1214138096
msg4148 (view) Author: Leonardo Soto (leosoto) Date: 2009-02-19.00:21:51
Jorge: Even if I suspect that is a bug which has been around a lot of
time, can you post the exact versions (or svn revisions) of Django and
Jython which you are using?
msg4149 (view) Author: Jorge Alberto Rodriguez Suarez (jars) Date: 2009-02-19.11:16:54
Hi Leo, here it is:

jars-macbook:continuum jars$ ./jython/dist/bin/jython --version
Jython 2.5b1+ 

jars-macbook:jython jars$ svn info .
Path: .
URL: https://jython.svn.sourceforge.net/svnroot/jython/trunk/jython
Repository Root: https://jython.svn.sourceforge.net/svnroot/jython
Repository UUID: 79b11f02-f210-0410-99aa-fb189b3d1ac4
Revision: 6035
Node Kind: directory
Schedule: normal
Last Changed Author: pjenvey
Last Changed Rev: 6035
Last Changed Date: 2009-02-15 20:27:44 -0300 (Sun, 15 Feb 2009)


-----

jars-macbook:django-dev jars$ ./django/bin/django-admin.py --version
1.0.2 final

jars-macbook:django-dev jars$ svn info
Path: .
URL: http://code.djangoproject.com/svn/django/trunk
Repository Root: http://code.djangoproject.com/svn
Repository UUID: bcc190cf-cafb-0310-a4f2-bffc1f526a37
Revision: 9839
Node Kind: directory
Schedule: normal
Last Changed Author: russellm
Last Changed Rev: 9839
Last Changed Date: 2009-02-16 09:38:11 -0300 (Mon, 16 Feb 2009)
msg4228 (view) Author: Jim Baker (zyasoft) Date: 2009-03-12.07:26:53
Please retry with 2.5b3. Given the .class issues, it's likely to be a
problem with an inconsistent build of Jython.
msg4959 (view) Author: Victor Ng (crankycoder) Date: 2009-07-29.19:44:31
i still get this behavior with jython 2.5.0, django 1.0.2 (svn rev 9503)
on Windows XP.

After deleting and recreating the class files, I can still get the
corrupted class files to be generated after the 'war' command is issued.
 Trying to run 'manage.py war' twice emits an error that the 'war'
command can't be found.

C:\dev\hello>jython manage.py war
Unknown command: 'war'
Type 'manage.py help' for usage. 

Wiping out the class files (again) makes the problem go away. 

Incidentally on Windows, I also tend to get odd errors about files not
being found - I think this is a related bug.  

"The system cannot find the file ▬?§◄♀?§."
msg4964 (view) Author: Victor Ng (crankycoder) Date: 2009-07-30.18:06:48
I can reliably reproduce this problem with the following set of tools:

Jython 2.5.0 release, Java 1.6.0_07-b06, django-jython svn rev 107,
Django 1.0.2-svn rev 9503 (from
http://code.djangoproject.com/svn/django/tags/releases/1.0.2/ - not the
1.0.x branch). This is on WinXP sp2.

---

C:\dev\java-world>jython c:\jython2.5\bin\django-admin.py startproject foo

C:\dev\java-world>cd foo

C:\dev\java-world\foo>javap settings$py
java.lang.ClassFormatError: invalid constant type: 13
        at sun.tools.javap.ClassData.readCP(ClassData.java:180)
        at sun.tools.javap.ClassData.read(ClassData.java:81)
        at sun.tools.javap.ClassData.<init>(ClassData.java:52)
        at sun.tools.javap.JavapPrinter.<init>(JavapPrinter.java:30)
        at sun.tools.javap.Main.displayResults(Main.java:201)
        at sun.tools.javap.Main.perform(Main.java:61)
        at sun.tools.javap.Main.entry(Main.java:49)
        at sun.tools.javap.Main.main(Main.java:34)
ERROR:fatal error
Exception in thread "main" java.lang.NullPointerException
        at sun.tools.javap.JavapPrinter.javaclassname(JavapPrinter.java:856)
        at
sun.tools.javap.JavapPrinter.printclassHeader(JavapPrinter.java:62)
        at sun.tools.javap.JavapPrinter.print(JavapPrinter.java:38)
        at sun.tools.javap.Main.displayResults(Main.java:202)
        at sun.tools.javap.Main.perform(Main.java:61)
        at sun.tools.javap.Main.entry(Main.java:49)
        at sun.tools.javap.Main.main(Main.java:34)

C:\dev\java-world\foo>

---

Running the WAR command seems to intermittently generate corrupt
versions of settings$py.class, but I can't reproduce it consistently. 
Generating a new project *always* creates corrupt class files for me.
msg4965 (view) Author: Philip Jenvey (pjenvey) Date: 2009-07-30.21:15:55
I've seen that mysterious "The system cannot find the file <garbage>" on 
windows but I'm not sure it's related (though I've never tried Django on 
here)

I'm a bit suspicious of Windows line endings being the problem since 
you're seeing "invalid constant type: 13". (char)13 is carriage return. 
Is the 'type: 13' always reproducable?

It's a long shot, but you could test that theory by dos2unixing the 
.class file and then trying to import it

No idea what might be corrupting the bytecode. Doubtful it's our 
compiler but you never know
msg4977 (view) Author: Victor Ng (crankycoder) Date: 2009-07-31.20:32:14
I tracked down this bug - it's a bug in Django where django itself is
rewriting our class files by accident. I'll file a ticket and a patch
over there.  please close this bug.
msg4978 (view) Author: Philip Jenvey (pjenvey) Date: 2009-07-31.20:52:27
thanks Victor
msg4991 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2009-08-05.13:54:57
Bug to follow on django trac is: http://code.djangoproject.com/ticket/11621
History
Date User Action Args
2009-08-05 13:54:57fwierzbickisetmessages: + msg4991
2009-07-31 20:52:27pjenveysetstatus: open -> closed
resolution: invalid
messages: + msg4978
2009-07-31 20:32:14crankycodersetmessages: + msg4977
2009-07-30 21:24:41fwierzbickisetnosy: + fwierzbicki
2009-07-30 21:15:55pjenveysetnosy: + pjenvey
messages: + msg4965
2009-07-30 18:06:49crankycodersetmessages: + msg4964
versions: + 2.5.0, - 2.5b1
2009-07-29 19:44:32crankycodersetnosy: + crankycoder
messages: + msg4959
2009-03-12 07:26:53zyasoftsetpriority: low
nosy: + zyasoft
messages: + msg4228
2009-02-19 11:16:55jarssetmessages: + msg4149
2009-02-19 00:21:52leosotosetmessages: + msg4148
2009-02-18 02:54:53leosotosetmessages: + msg4147
2009-02-17 01:57:18jarscreate