KnowledgeBaseImpl also seems to be unsafe because threads get stuck while trying to open a new StatefulKnowledgeSession

org.drools.impl.KnowledgeBaseImpl.newStatefulKnowledgeSession()


On Thu, Aug 26, 2010 at 3:49 PM, <rules-users-request@lists.jboss.org> wrote:
Send rules-users mailing list submissions to
       rules-users@lists.jboss.org

To subscribe or unsubscribe via the World Wide Web, visit
       https://lists.jboss.org/mailman/listinfo/rules-users
or, via email, send a message with subject or body 'help' to
       rules-users-request@lists.jboss.org

You can reach the person managing the list at
       rules-users-owner@lists.jboss.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of rules-users digest..."


Today's Topics:

  1. CommandFactory.newSetGlobal and scope (Ricardo J. M?ndez)
  2. Re: Stuck Threads (Esteban Aliverti)


----------------------------------------------------------------------

Message: 1
Date: Thu, 26 Aug 2010 15:30:47 +0300
From: Ricardo J. M?ndez <mendezster@gmail.com>
Subject: [rules-users] CommandFactory.newSetGlobal and scope
To: rules-users@lists.jboss.org
Message-ID:
       <AANLkTimLN6duK+SMeRuv6ZVUtEhk4B+sdYYBxkfXozLu@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Hi everyone,

I'm reading through Michael Bali's Drools JBoss Rules book as well as the
reference guide, and I've got a question of scope about
StatefulKnowledgeSessions.

I understand that if I call setGlobal on a stateful session, this global
value will be shared for all simultaneous calls to executeRules across all
threads.  I'm looking into CommandFactory, which has a newSetGlobal
method.   From what I gather, a global set via CommandFactory.newSetGlobal
and then executed with a call to
execute(CommandFactory.newBatchExecution(cmds)) would be scoped solely to
that execution, regardless of it is a StatefulKnowledgeSession and there are
other parallel command executions against the same session.

Can anyone confirm if that is accurate?

Thanks in advance,

--
Ricardo J. M?ndez
http://www.arquetipos.co.cr/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100826/d694c41b/attachment-0001.html

------------------------------

Message: 2
Date: Thu, 26 Aug 2010 09:48:19 -0300
From: Esteban Aliverti <esteban.aliverti@gmail.com>
Subject: Re: [rules-users] Stuck Threads
To: Rules Users List <rules-users@lists.jboss.org>
Message-ID:
       <AANLkTi=-nMM4pkKFbxTa_WWRqpPsFi9QbGN8iY_fSsxC@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

StatefulSessions are not thread safe.

El ago 26, 2010 9:23 a.m., "Burak Aydin" <burak.aydin@obss.com.tr> escribi?:

Hello,

While trying to open stateful session in a 32 core machine and 35 threads,
all of the threads hangs. Below is the stack trace. ChainedProperties class
seems to be thread-unsafe??

gridgain-#13%null%" - Thread t@64

  java.lang.Thread.State: RUNNABLE

       at
sun.misc.URLClassPath$JarLoader.getResource(URLClassPath.java:806)

       at
sun.misc.URLClassPath$JarLoader.getResource(URLClassPath.java:765)

       at
sun.misc.URLClassPath$JarLoader.findResource(URLClassPath.java:735)

       at sun.misc.URLClassPath$1.next(URLClassPath.java:196)

       at sun.misc.URLClassPath$1.hasMoreElements(URLClassPath.java:206)

       at java.net.URLClassLoader$3$1.run(URLClassLoader.java:416)

       at java.security.AccessController.doPrivileged(Native Method)

       at java.net.URLClassLoader$3.next(URLClassLoader.java:413)

       at
java.net.URLClassLoader$3.hasMoreElements(URLClassLoader.java:438)

       at sun.misc.CompoundEnumeration.next(CompoundEnumeration.java:27)

       at
sun.misc.CompoundEnumeration.hasMoreElements(CompoundEnumeration.java:36)

       at sun.misc.CompoundEnumeration.next(CompoundEnumeration.java:27)

       at
sun.misc.CompoundEnumeration.hasMoreElements(CompoundEnumeration.java:36)

       at sun.misc.CompoundEnumeration.next(CompoundEnumeration.java:27)

       at
sun.misc.CompoundEnumeration.hasMoreElements(CompoundEnumeration.java:36)

       at
org.drools.util.ChainedProperties.loadProperties(ChainedProperties.java:232)

       at org.drools.util.ChainedProperties.(ChainedProperties.java:112)

       at org.drools.util.ChainedProperties.(ChainedProperties.java:41)

       at org.drools.util.ChainedProperties.(ChainedProperties.java:35)

       at
org.drools.SessionConfiguration.init(SessionConfiguration.java:131)

       at org.drools.SessionConfiguration.(SessionConfiguration.java:112)

       at
org.drools.impl.KnowledgeBaseImpl.newStatefulKnowledgeSession(KnowledgeBaseImpl.java:134)

       at texan.qset.service.QsetService.executeQset(QsetService.java:72)

       at texan.qset.service.QsetService.executeQset(QsetService.java:34)

       at
texan.crop.service.ProductPostingService.processQSet(ProductPostingService.java:600)

       at
texan.crop.service.ProductPostingService.processQSets(ProductPostingService.java:582)

       at
texan.crop.service.ProductPostingService.createOrUpdateProduct(ProductPostingService.java:562)

       at
texan.crop.service.ProductPostingService.postingProcess(ProductPostingService.java:181)

       at
texan.crop.service.ProductPostingService.productPostingProcess_aroundBody0(ProductPostingService.java:85)

       at
texan.crop.service.ProductPostingService$AjcClosure1.run(ProductPostingService.java:1)

       at org.aspectj.runtime.reflect.JoinPointImpl.proceed(Unknown Source)

       at
falez.runtime.aop.FalezTransactionalAspect$4.proceed(FalezTransactionalAspect.java:176)

       at
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)

       at
falez.runtime.aop.FalezTransactionalAspect.advice(FalezTransactionalAspect.java:215)

       at
falez.runtime.aop.TexanTransactionalAspect.ajc$inlineAccessMethod$falez_runtime_aop_TexanTransactionalAspect$falez_runtime_aop_FalezTransactionalAspect$advice(TexanTransactionalAspect.java:1)

       at
falez.runtime.aop.TexanTransactionalAspect.around(TexanTransactionalAspect.java:26)

       at
texan.crop.service.ProductPostingService.productPostingProcess(ProductPostingService.java:80)

       at
texan.crop.batch.grid.ProductPostingBatch.doCifProcess(ProductPostingBatch.java:45)

       - locked texan.crop.batch.grid.ProductPostingBatch@@10880

       at
texan.crop.batch.grid.ProductPostingBatch.doProcess(ProductPostingBatch.java:37)

       at
falez.runtime.batch.AbstractBatchOperation.doProcess(AbstractBatchOperation.java:209)

       at
texan.crop.batch.grid.ProductPostingBatch.doProcess_aroundBody0(ProductPostingBatch.java:29)

       at
texan.crop.batch.grid.ProductPostingBatch$AjcClosure1.run(ProductPostingBatch.java:1)

       at org.aspectj.runtime.reflect.JoinPointImpl.proceed(Unknown Source)

       at
falez.runtime.aop.FalezTransactionalAspect$4.proceed(FalezTransactionalAspect.java:176)

       at
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)

       at
falez.runtime.aop.FalezTransactionalAspect.advice(FalezTransactionalAspect.java:215)

       at
falez.runtime.aop.TexanTransactionalAspect.ajc$inlineAccessMethod$falez_runtime_aop_TexanTransactionalAspect$falez_runtime_aop_FalezTransactionalAspect$advice(TexanTransactionalAspect.java:1)

       at
falez.runtime.aop.TexanTransactionalAspect.around(TexanTransactionalAspect.java:26)

       at
texan.crop.batch.grid.ProductPostingBatch.doProcess(ProductPostingBatch.java:28)

       at
falez.runtime.batch.AbstractBatchOperation.process(AbstractBatchOperation.java:76)

       at
falez.runtime.batch.BatchProcessingTask$BatchProcessingJob.doExecute(BatchProcessingTask.java:89)

       at
falez.runtime.batch.BatchProcessingTask$BatchProcessingJob.execute(BatchProcessingTask.java:76)

       at
falez.runtime.batch.BatchProcessingTask$BatchProcessingJob.execute(BatchProcessingTask.java:1)

       at
org.gridgain.grid.kernal.processors.job.GridJobWorker.body(GridJobWorker.java:406)

       at
org.gridgain.grid.util.runnable.GridRunnable$1.run(GridRunnable.java:142)

       at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)

       at
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)

       at java.util.concurrent.FutureTask.run(FutureTask.java:138)

       at
org.gridgain.grid.util.runnable.GridRunnable.run(GridRunnable.java:194)

       at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

       at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

       at java.lang.Thread.run(Thread.java:619)

--
Burak AYDIN
Senior Software Engineer
OBSS
-------------------------------------
9433 @YKB

_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100826/da594504/attachment.html

------------------------------

_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


End of rules-users Digest, Vol 45, Issue 121
********************************************



--
Burak AYDIN
Senior Software Engineer
OBSS
-------------------------------------
9433 @YKB