cancel
Showing results for 
Search instead for 
Did you mean: 

Crash: createNode() nested exception is ...could not insert

jsauer
Champ in-the-making
Champ in-the-making
Hi,
I just need to import some thousand demo data for performance testing. I wrote a tiny JavaScript

testDoc = space.childByNamePath("test_doc.pdf");
if(testDoc!=null)
{
    var newNode;
    for(i=0;i<500;i++)
    {
        newNode = space.createNode("test_" + i.toString() + ".pdf","cm:content");
        newNode.content = testDoc.content;
        newNode.mimetype =testDoc.mimetype;
        newNode.properties.title=newNode.name;
        newNode.save();
    }
}
Running it on the space creates the following error message:
Please correct the errors below then click OK.

    * A system error happened during the operation: 02090638 Failed to execute script 'workspace://SpacesStore/59e69e84-009d-4e78-b7c8-caa5280bfc4e': could not insert: [org.alfresco.repo.domain.hibernate.ChildAssocImpl]; nested exception is org.hibernate.exception.LockAcquisitionException: could not insert: [org.alfresco.repo.domain.hibernate.ChildAssocImpl]

The demo file used to have some content available is 650K in size.

Alfresco 3.2.r2 on Centos5.4, Mysql 5.0.77

I wanted to create 10,000 files but even with 500 I get this error 😞

The stack trace is 1000km long. Mentioning deadlocks etc.
Besides this there are of cause lots of calls to PdfBoxContentTransformer, all take the same amount of time 3101ms

Any suggestions?
I know that the whole JS call is encapsuled in one big transaction. Is there a way to make smaller transactions?

UPDATE
I wondered what will happen if I exchange the pdf master content with a plain text file. Successfully created 100 files in a first run. Now all successive runs fail.
The file size has been reduced to 470K. The error message is different now:
Please correct the errors below then click OK.
    * This wizard has been already been completed, please re-launch it to continue.

The log file states that the Rhino engine is runing the script either several times or in several tuncs (do not know though)
17:45:27,315 User:jsauer DEBUG [repo.jscript.RhinoScriptProcessor] Time to execute script: 50886.715ms
17:45:27,430 User:jsauer DEBUG [repo.jscript.RhinoScriptProcessor] Imports resolved, adding resource '_root
17:46:18,320 User:jsauer DEBUG [repo.jscript.RhinoScriptProcessor] Time to execute script: 101263.414ms
17:46:18,320 User:jsauer DEBUG [repo.jscript.RhinoScriptProcessor] Time to execute script: 50887.766ms
17:46:18,448 User:jsauer DEBUG [repo.jscript.RhinoScriptProcessor] Imports resolved, adding resource '_root
17:46:18,744 User:jsauer DEBUG [repo.jscript.RhinoScriptProcessor] Imports resolved, adding resource '_root
17:47:09,341 User:jsauer DEBUG [repo.jscript.RhinoScriptProcessor] Time to execute script: 50594.91ms
17:47:09,341 User:jsauer DEBUG [repo.jscript.RhinoScriptProcessor] Time to execute script: 50890.727ms
17:47:09,455 User:jsauer DEBUG [repo.jscript.RhinoScriptProcessor] Imports resolved, adding resource '_root
17:47:09,639 User:jsauer DEBUG [repo.jscript.RhinoScriptProcessor] Imports resolved, adding resource '_root
17:48:00,348 User:jsauer DEBUG [repo.jscript.RhinoScriptProcessor] Time to execute script: 50889.8ms
17:48:00,348 User:jsauer DEBUG [repo.jscript.RhinoScriptProcessor] Time to execute script: 50706.74ms
17:48:00,634 User:jsauer DEBUG [repo.jscript.RhinoScriptProcessor] Imports resolved, adding resource '_root
17:48:00,651 User:jsauer DEBUG [repo.jscript.RhinoScriptProcessor] Imports resolved, adding resource '_root
17:48:51,368 User:jsauer DEBUG [repo.jscript.RhinoScriptProcessor] Time to execute script: 50714.203ms
17:48:51,368 User:jsauer DEBUG [repo.jscript.RhinoScriptProcessor] Time to execute script: 50731.688ms
17:48:51,685 User:jsauer DEBUG [repo.jscript.RhinoScriptProcessor] Imports resolved, adding resource '_root
17:48:52,141 User:jsauer DEBUG [repo.jscript.RhinoScriptProcessor] Imports resolved, adding resource '_root
17:49:42,371 User:jsauer DEBUG [repo.jscript.RhinoScriptProcessor] Time to execute script: 50682.613ms
17:49:42,933 User:jsauer DEBUG [repo.jscript.RhinoScriptProcessor] Imports resolved, adding resource '_root
17:50:33,378 User:jsauer DEBUG [repo.jscript.RhinoScriptProcessor] Time to execute script: 50442.676ms
17:50:33,378 User:jsauer DEBUG [repo.jscript.RhinoScriptProcessor] Time to execute script: 101233.914ms
17:50:33,624 User:jsauer DEBUG [repo.jscript.RhinoScriptProcessor] Imports resolved, adding resource '_root
17:50:34,104 User:jsauer DEBUG [repo.jscript.RhinoScriptProcessor] Imports resolved, adding resource '_root

Tomcat still consumes about 95%CPU but no logging takes place anymore. And after the first run the full text indexer seems to work and thumbnail generation worked. Now nothing….

UPDATE 2
Filesize does not seem to matter. Currently just pass 6 byte string directly into content. Same issue. Will try through foundation api 😞

UPDATE 3
After Tomcat restart first run worked again. Now with reduced file size 200 nodes created… another 300 fail 😞
By the way JVM has 2GB Ram. 3 CPU Cores

Thanks
Jörg
2 REPLIES 2

jsauer
Champ in-the-making
Champ in-the-making
Hi,
following up my problem from yesterday I talked to some Alfresco Enterprise implementors and from what I learned is that Alfresco JavaScript implementation is not suitable for creating lots of nodes, as I tried in the above mentioned script. And the content size is not the issue (as I have figured out by myself already)

It seems just to be recommended to do lightwight work from within JavaScript and delegate the main workload to Java code 😞

I would like to start a discussion here about scripting issues, work arounds and other scripting technologies.
  • What can be achieved by JavaScript scripting?
  • What to be avoided by using JavaScript?
  • What kind of workarounds / best practices do exist?
  • Which other scripting technologies do exist and have been integrated with Alfresco? (BeanShell, Groovy)
  • Do alternate scripting technologies address some of the problems of the JavaScript implementation?
  • Live / code examples of alternative scripting
Waiting to hear from you (Alfresco? ;-))

Regards
Jörg

mrogers
Star Contributor
Star Contributor
Please go ahead, and as and when you bottom out any issues please record your best practice guidelines on the Wiki and raise any faults or problems in JIRA.

Waiting to see what you come up with  Smiley Happy