Topic - async processing
Topic - async processing Topic - async processing
from forum Solutions Developer
 forum index   my profile   search 
 new topic  post reply 
moderators: pjr tab
async processing
Joined: 22-April-2007
Posts: 79
Location: Belgium
Posted: 2-October-2008 07:02
Greetings,
-- I seem to monopolise the forums at the moment ... ah well :-)

This is a snippet of my code ...
   counter=0
   resp={}
   for i in resultdom.getNodesFor('/results/row/shortdesc'):
      counter+=1
      newdesc=resultdom.getText('/results/row[' + str(counter) + ']/shortdesc',0)
      sat.setText('/nvp/description',newdesc)
      sr=context.createSubRequest("active:python")
      sr.addArgument("operator", "ffcpl:/resources/impact_tree.py")
      sr.addArgument("param",DOMXDAAspect(sat))
      resp[counter]=context.issueAsyncSubRequest(sr)

   counter=0   
   for i in resultdom.getNodesFor('/results/row/shortdesc'):
      counter+=1
      resp[counter].join()

# Write final output
if level==0:
   # Here the code for after all processing


As you can see I submit requests in a loop. Actually this is recusive, this is a snippet from impact_tree.py itself. I'm not really interested in the results ... however, I do want to know when all the requests in the loop have ended since I do have some final processing to do (only at the lowest level, but I know when that is).

I'd say that logically speaking my code is correct, however it throws following exception :

Message: call() called in inappropriate state 
Callstack: org.ibex.nestedvm.Runtime.call() line:655
org.ibex.nestedvm.Runtime.call() line:647
org.sqlite.NestedDB.call() line:451
org.sqlite.NestedDB.call() line:433

org.ibex.nestedvm.Runtime$ExecutionException: Jumped to invalid address at (unknown)


Seems that I'm pushing something to the limit ... any pointers as to what that can be ?

Regards,
Tom
DB Problem
Joined: 15-February-2005
Posts: 127
Location: Fort Collins, CO
Posted: 2-October-2008 12:35
Tom,

The exception report seems to be coming from your database, if so my comments may help...

In your code snippet you are iterating on the results of a query. Since the DOM has already been created there should be no active connection to the database for that query. So the exception can't be caused by that code.

I'll presume that the code "impact_tree.py" is connecting to your database also. Since you are calling the code asynchronously you may be getting the database into a state it doesn't like. I don't know SQLLite. However I do know that some databases require column access in a certain order if BLOB or CLOB columns are involved. (The columns must be accessed in the order they are mentioned in the SQL statement - this has to do with buffering, etc in JDBC and the driver).

If you can provide the code (or a summary of it) from "impact_tree.py" maybe I can be of further assistance.

Randy

non threadsafe issue in jdbc driver
Joined: 7-February-2005
Posts: 249
Location: Uncharted territory
Posted: 2-October-2008 12:54
Hi Tom,

I'd say it looks like your jdbc driver isn't threadsafe and you are hitting it with concurrent requests.

A solution might be to look for options on it's configuration or look at limiting the pool size for connections to 1.

If none of that works maybe you could create a data layer in your application to do database ops and place a throttle over it.

Cheers,
Tony
jdbc indeed
Joined: 22-April-2007
Posts: 79
Location: Belgium
Posted: 2-October-2008 14:22
Greetings Randy, Tony,

Its indeed a jdbc problem. It does work in HSQLDB. So I'm considering it a limitation of sqlite (you can't have everything in so small an engine).
Thanks for the suggestions that put me in the right track ... moving on to the other fish I got to fry with this application ;-)

Regards,
Tom

P.S. Randy, if you still want to have a look at the code your welcome to it (but I presume there's plenty of problems waiting at the moment). Its the same code I have the sink/source problem with.
 new topic  post reply  To find out about new replies to this post as they occur
please subscribe to one of these feeds:
AtomRSS moderate 
© 2003-2006, 1060 Research Limited. 1060 registered trademark, NetKernel trademark of 1060 Research Limited.