Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 365643

Summary: [Performance] When Generating Classes from a large schema validating gets stuck at 49% and then eclipse locks up
Product: [WebTools] Dali JPA Tools Reporter: Jolene Moffitt <jolene.moffitt>
Component: JAXBAssignee: Paul Fullbright <paul.fullbright>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: brian.vosburgh, neil.hauge
Version: 3.1   
Target Milestone: 3.2   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Large Schema
none
Eclipse Thread Dump
none
Large Schema 2
none
Large Schema 3&4 none

Description Jolene Moffitt CLA 2011-12-05 13:10:51 EST
Created attachment 207937 [details]
Large Schema

Create JAXB Project 
Add a large schema file (I attached the schema I used to this bug)
R-click on the Large schema file and Generate > JAXB Classes
It shows Validating JAXB Project: (49%) and it appears to be stuck at 49%.  
The classes appear to be created and I can edit a class and Save, however it still shows Validating at 49%.  I then selected Project > Clean and it changes from Validating to Cleaning selected projects (98%) and now it appears to be stuck there.  If I click on the details for Cleaning selected projects it shows that it is still trying to Validate and has not begun cleaning the project.  It appears to be stuck on validating the first class in the list and if I open that class and try and change something Eclipse locks up. 

I will attach the Thread dump for eclipse/dali
Comment 1 Jolene Moffitt CLA 2011-12-05 13:15:15 EST
Created attachment 207938 [details]
Eclipse Thread Dump
Comment 2 Paul Fullbright CLA 2011-12-05 16:02:10 EST
That schema by itself is not enough to reproduce this, as that schema references another schema, "XTbML2.12.00.xsd".

Can you attach that schema as well?
Comment 3 Jolene Moffitt CLA 2011-12-05 16:07:17 EST
Created attachment 207947 [details]
Large Schema 2
Comment 4 Paul Fullbright CLA 2011-12-05 16:12:46 EST
That one refers to another one as well, "XlifeBase2.12.00.xsd".  :)
Comment 5 Jolene Moffitt CLA 2011-12-05 16:17:42 EST
Created attachment 207948 [details]
Large Schema 3&4

I think I got them all now.
Comment 6 Paul Fullbright CLA 2011-12-05 18:12:42 EST
It's not stuck.  It's just taking a really, really long time.  There are over 700 files generated.

The problem is that they're added one by one, and after each one is added, the entire project is synchronized and updated.  And that happens over 700 times.

If there were some way to synchronize and update everything only *after* all the files were added, that would save considerable churn.
Comment 7 Jolene Moffitt CLA 2011-12-06 09:11:51 EST
If you initially just generate classes and be patient and wait it will finish validating.  However if as soon as the classes appear and you change something in one of the classes and click on Save it will never finish validating and it gets hung.
Comment 8 Neil Hauge CLA 2011-12-06 12:38:28 EST
It sounds like at the very least we have a good larger project scenario to work with here.  We will need to figure out how to optimize things to make this a livable experience for large projects.

(In reply to comment #7)

With the attached dump, the code does not appear to be deadlocked, so it is likely that it is just another case of things taking a very long time to complete.
Comment 9 Brian Vosburgh CLA 2011-12-06 12:49:48 EST
I don't see anything in the thread dump indicating classes are still being generated. The Main thread is waiting for a UI event; and the Validation thread is waiting for the Dali event handler thread to finish handling a new JaxbFile. How are JAXB classes generated? Via a job? Is it executing a IWorkspaceRunnable/WorkspaceJob (to suppress resource change events until everything has been added)?

This is definitely a good candidate for the "batch processing" code I am adding to the JPA side of the house....
Comment 10 Paul Fullbright CLA 2012-03-19 13:38:30 EDT
I'm going to mark this as fixed.  This now takes markedly less time.

Please reopen if there's some other issue that needs to be addressed.