Issue Details (XML | Word | Printable)

Key: DIRSERVER-599
Type: Bug Bug
Status: Closed Closed
Resolution: Won't Fix
Priority: Major Major
Assignee: Alex Karasulu
Reporter: Endi S. Dewata
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Directory ApacheDS

Can't compile long schema

Created: 14/Mar/06 03:08 AM   Updated: 27/Aug/06 02:54 PM
Return to search
Component/s: schema-plugin
Affects Version/s: 1.0-RC1
Fix Version/s: 1.0-RC4

Time Tracking:
Not Specified

File Attachments:
  Size
File activeDirectory.schema 2006-03-14 03:12 AM Endi S. Dewata 99 kB

Resolution Date: 27/Aug/06 02:54 PM


 Description  « Hide
Currently the schema plugin converts a schema into Java files, and if the schema gets too long the Java file can't be compiled. Some applications might use a huge schema, for instance the default Active Directory schema contains more than 1000 attribute types. Compiling such schema will produce the following error:

[INFO] Generating activeDirectory schema.
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
Compiling 14 source files to c:\svn.apache.org\apacheds-1.0\core\target\classes
[INFO] ----------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ----------------------------------------------------------------------------
[INFO] Compilation failure

c:\svn.apache.org\apacheds-1.0\core\target\generated-sources\org\apache\directory\server\core\schema
\bootstrap\ActiveDirectoryAttributeTypeProducer.java:[52,16] code too large

A workaround is that the schema can be split into several smaller schemas, this will produce smaller Java files which can be compiled just fine. From experiments it seems that the compiler will hit the limit when compiling 622 attribute types. This will produce more than 11k lines of code in the produce() method in the generated Java file. A similar limit may also affect the max number of object class definitions.


 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Endi S. Dewata added a comment - 14/Mar/06 03:12 AM
Attached is a schema containing 622 attribute type definitions.

Endi S. Dewata made changes - 14/Mar/06 03:12 AM
Field Original Value New Value
Attachment activeDirectory.schema [ 12324102 ]
Alex Karasulu added a comment - 14/Mar/06 03:13 AM
Probably a velocity buffer issue. Can you take a look at how this can be adjusted and get back to me? The fix should be easy.

Endi S. Dewata added a comment - 14/Mar/06 03:48 AM
Hi Alex, I don't think this is a Velocity issue because at this point the Java files have been successfully generated by Velocity. The error happens during compilation, it seems javac can't compile a method with more than 11k lines of code. One possible solution is by changing the template to split the produce() method after certain number of attribute types or object classes. Another way is by storing the parsed schema data somewhere else and use a loop to read it. A better way might be the schema parsing should be done in the runtime instead of compile time.

Norval Hope added a comment - 27/Mar/06 09:52 AM
I ran into this issue to for an external schema I imported into the AD build. The problem is the 64k bytecode limit per method:

http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html

As noted on the dev list I use runtime schema conversion when talking to remote live LDAP systems (acting as a proxy) but in this case I only had a .schema file and haven't adapted my code to work off a .schema file rather then LDAP schema search results.

Alex Karasulu made changes - 27/Aug/06 02:54 PM
Assignee Alex Karasulu [ akarasulu ]
Alex Karasulu added a comment - 27/Aug/06 02:54 PM
won't fix: we have a workaround (break up large schemas). This is fine temporarily until we revamp the schema subsystem in 1.1.

Alex Karasulu made changes - 27/Aug/06 02:54 PM
Fix Version/s 1.0-RC4 [ 12311053 ]
Resolution Won't Fix [ 2 ]
Status Open [ 1 ] Closed [ 6 ]