I'm having trouble running a Grails app with 600+ domain classes. Suggestions?

203 views
Skip to first unread message

Aaron Zirbes

unread,
Mar 23, 2012, 9:14:10 PM3/23/12
to groo...@googlegroups.com
I have a grails app that has over 600 domain class (the domain class count stems from a  XSD design spec that came from the client).

I've gotten it to compile, but run-app crashes after a while.

# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (javaCalls.cpp:59), pid=10240, tid=140426752034560
#  guarantee(thread->is_Java_thread()) failed: crucial check - the VM thread cannot and must not escape to Java code
#
# JRE version: 6.0_23-b23
# Java VM: OpenJDK 64-Bit Server VM (20.0-b11 mixed mode linux-amd64 compressed oops)
# Derivative: IcedTea6 1.11pre
# Distribution: Ubuntu 11.10, package 6b23~pre11-0ubuntu1.11.10.2
# An error report file with more information is saved as:
# /home/AD/ajz/development/grails/ncs/ncs-mdes/hs_err_pid10240.log
#
# If you would like to submit a bug report, please include
# instructions how to reproduce the bug and visit:

... or with the Sun JDK...

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (javaCalls.cpp:59), pid=16883, tid=140420935395072
#  guarantee(thread->is_Java_thread()) failed: crucial check - the VM thread cannot and must not escape to Java code
#
# JRE version: 6.0_26-b03
# Java VM: Java HotSpot(TM) 64-Bit Server VM (20.1-b02 mixed mode linux-amd64 compressed oops)
# An error report file with more information is saved as:
# /home/AD/ajz/development/grails/ncs/ncs-mdes/hs_err_pid16883.log
#
# If you would like to submit a bug report, please visit:
#

I've upped the memory settings to no avail...
export GRAILS_OPTS="-Xmx4G -Xms4G -XX:PermSize=2g -XX:MaxPermSize=2g -server"

A simple app with nothing but domain classes is available here:

BuildConfig depends on this:

Thoughts? Suggestions? Tricks? Tips?

--
Aaron

Ben Podoll

unread,
Mar 25, 2012, 11:47:07 AM3/25/12
to Groovy Users of Minnesota
$ grails -version

Grails version: 2.0.1

$ java -version

java version "1.6.0_29"
Java(TM) SE Runtime Environment (build 1.6.0_29-b11)
Oracle JRockit(R) (build R28.1.5-20-146757-1.6.0_29-20111004-1750-
linux-x86_64, compiled mode)

$ export GRAILS_OPTS="-Xmx2G -Xms2G"

$ cd ncs-grails-ncs-mdes-61aaf3a/

$ grails run-app

| Running Grails application
| Error 2012-03-24 23:26:22,258 [pool-5-thread-1] ERROR
hbm2ddl.SchemaExport  - Unsuccessful: alter table pre_preg add
constraint FKB2D2D640F6FF846B foreign key (thyroid_1) references
confirm_type_cl8
| Error 2012-03-24 23:26:22,395 [pool-5-thread-1] ERROR
hbm2ddl.SchemaExport  - Constraint "FKB2D2D640F6FF846B" already
exists; SQL statement:
alter table pre_preg add constraint FKB2D2D640F6FF846B foreign key
(thyroid_1) references confirm_type_cl8 [90045-147]
| Error 2012-03-24 23:26:24,309 [pool-5-thread-1] ERROR
hbm2ddl.SchemaExport  - Unsuccessful: alter table twelve_mth_saq_2 add
constraint FK18E5A922332B073 foreign key (behave_28) references
true_level_cl1
| Error 2012-03-24 23:26:24,310 [pool-5-thread-1] ERROR
hbm2ddl.SchemaExport  - Constraint "FK18E5A922332B073" already exists;
SQL statement:
alter table twelve_mth_saq_2 add constraint FK18E5A922332B073 foreign
key (behave_28) references true_level_cl1 [90045-147]
| Error 2012-03-24 23:26:24,613 [pool-5-thread-1] ERROR
hbm2ddl.SchemaExport  - Unsuccessful: alter table validation_ins add
constraint FKEF592B285432C3D foreign key (intro_2) references
confirm_type_cl24
| Error 2012-03-24 23:26:24,613 [pool-5-thread-1] ERROR
hbm2ddl.SchemaExport  - Constraint "FKEF592B285432C3D" already exists;
SQL statement:
alter table validation_ins add constraint FKEF592B285432C3D foreign
key (intro_2) references confirm_type_cl24 [90045-147]
| Error 2012-03-24 23:26:56,349 [pool-5-thread-1] ERROR
context.GrailsContextLoader  - Error executing bootstraps: null
Message: null
   Line | Method
->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|   138 | run      in java.util.concurrent.FutureTask
|   886 | runTask  in java.util.concurrent.ThreadPoolExecutor$Worker
|   908 | run      in     ''
^   662 | run . .  in java.lang.Thread

Caused by ClassFormatError: BootStrap$_closure1 : invalid Code length
at 342201
->> 631 | defineClassCond in java.lang.ClassLoader
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|   615 | defineClass in     ''
|   141 | defineClass in java.security.SecureClassLoader
|   283 | defineClass in java.net.URLClassLoader
|    58 | access$000 in     ''
|   197 | run      in java.net.URLClassLoader$1
|   190 | findClass in java.net.URLClassLoader
|   306 | loadClass in java.lang.ClassLoader
|   247 | loadClass in     ''
|   303 | innerRun in java.util.concurrent.FutureTask$Sync
|   138 | run . .  in java.util.concurrent.FutureTask
|   886 | runTask  in java.util.concurrent.ThreadPoolExecutor$Worker
|   908 | run . .  in     ''
^   662 | run      in java.lang.Thread

Ben Podoll

unread,
Mar 26, 2012, 4:40:03 PM3/26/12
to Groovy Users of Minnesota
I should have included some context about my previous post; I happened
to see the original post (which seemed crazy to have 600+ domain
classes) and thought I'd grab the code [via the link the original
author provided from GitHub] and see what happened when I ran the code
with JRockit -- knowing it didn't use PermGen space. Sorry if I
confused anyone with my post.

Aaron Zirbes

unread,
Mar 26, 2012, 7:42:01 PM3/26/12
to groo...@googlegroups.com
Thanks for trying to fire it up. Unfortunately I'm not sure why you're getting the bootstrap errors, as I'm not able to reproduce them.

Maybe the massive data-loading in the BootStrap.groovy is causing the issue.  I'll try turning that part into a SQL script to be run outside the app.

I talked to a Rails colleague who had tackled the same problem for a different framework and and another route I can go is to not pull in all the XSD enumeration definitions as GORM domains, therefor dropping ~400 domain class types and all of the foreign key constraints that go with them, and instead turning them into "inList" constraints.  This will mean that the app should have a much smaller footprint of ~270 domain classes rather than 680.  I don't think I'll _need_ the enumeration code definitions in this app, so it just might work.

I'll keep trying...

--
Aaron

Aaron Zirbes

unread,
Mar 28, 2012, 1:50:21 PM3/28/12
to groo...@googlegroups.com
Here's was my final solution:

I added an option to my XSD reverse engineering plugin so it won't create Enum types as domain classes if you don't want it to.  It will instead create Integers with an "inList" constraint.

This brought my domain class count down to a reasonable ~260, with significantly less foreign key constraints.  Grails now runs and hibernate creates all tables!

I created: http://grails.org/plugin/xsd-reverse-engineer if anyone else needs to deal with this type of issue.

In short, don't create a grails app with more than 600 domain classes.

--
Aaron
Reply all
Reply to author
Forward
0 new messages