[JBoss JIRA] Created: (JBRULES-1991) MVELSalienceExpression not thread-safe
by Ingomar Otter (JIRA)
MVELSalienceExpression not thread-safe
--------------------------------------
Key: JBRULES-1991
URL: https://jira.jboss.org/jira/browse/JBRULES-1991
Project: JBoss Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: drools-core
Affects Versions: 4.0.7
Reporter: Ingomar Otter
Assignee: Mark Proctor
Fix For: 4.0.8, 5.0.0.CR1
Scenario:
* We are using Drools in a MT app with a shared rulebase and one WM per thread.
* We are using MVEL expressions to dynamically calculate salience from matched facts.
When runniing mutlithreaded, we could observe that expression would sometimes (1 in 500 times in our case) pick up the wrong salience value.
Looking at the source of MVELSalienceExpression.getValue() reveals that the method sets the WM and then evaluates the MVEL expression.
I assume that the MVELSalienceExpression is part of the rulebase and thus shared accross WMs. If this is true this is not thread-safe and may lead to the observed behaviour.
Adding a simple synchronized fixes the problem in our case:
{code}
public synchronized int getValue(final Tuple tuple, final WorkingMemory workingMemory) {
this.factory.setContext(tuple, null, null, workingMemory, null);
return ((Number) MVEL.executeExpression(this.expr, this.factory)).intValue();
}
{code}
However this may reduce overall concurrency in the application. A better solution might be to increase locality, ie having a "thread local" factory.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
15 years, 10 months
[JBoss JIRA] Created: (JBAS-6585) mismatch between TXID in mysql jdbc2 persistence and Tx.value causes MysqlDataTruncation
by Bart Vanhaute (JIRA)
mismatch between TXID in mysql jdbc2 persistence and Tx.value causes MysqlDataTruncation
----------------------------------------------------------------------------------------
Key: JBAS-6585
URL: https://jira.jboss.org/jira/browse/JBAS-6585
Project: JBoss Application Server
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: JMS (JBossMQ)
Affects Versions: JBossAS-4.2.2.GA
Environment: JBoss 4.2.2.GA with JBossMQ, persistence with mysql-jdbc2-persistence, running MySQL 5.0.26.
Reporter: Bart Vanhaute
Assignee: Adrian Brock
In the table definitions for the JBossMQ jdbc2 persistence, the type of column TXID is INT. Under MySQL this is 4-byte integer value. In the code, the value of Tx is of java type long, a 8-byte value. Obviously, when the Tx becomes bigger than the maximum integer value, the transaction value cannot be stored anymore in the database, and a com.mysql.jdbc.MysqlDataTruncation exception is thrown:
2009-03-06 01:27:02,307 WARN [org.jboss.tm.TransactionImpl]
XAException: tx=TransactionImpl:XidImpl[FormatId=257,
GlobalId=blade01-sles-app2.ap/84709294, BranchQual=, localId=84709294]
errorCode=XAER_RMFAIL
org.jboss.mq.SpyXAException: Resource manager error during commit; -
nested throwable: (org.jboss.mq.SpyTransactionRolledBackException:
Transaction was rolled back.; - nested throwable:
(org.jboss.mq.SpyJMSException: Could not remove message: 5702399
2 msg=19226 hard STORED PERSISTENT queue=QUEUE.CAO priority=4
lateClone=false hashCode=1244793572; - nested throwable:
(org.jboss.mq.SpyJMSException: Could not create tx: 2147797249; - nested
throwable: (com.mysql.jdbc.MysqlDataTruncation: Data trunc
ation: Out of range value adjusted for column 'TXID' at row 1))))
at org.jboss.mq.SpyXAException.getAsXAException(SpyXAException.java:72)
at org.jboss.mq.SpyXAResource.commit(SpyXAResource.java:92)
at org.jboss.tm.TransactionImpl$Resource.commit(TransactionImpl.java:2253)
at org.jboss.tm.TransactionImpl.commitResources(TransactionImpl.java:1784)
at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:340)
at org.jboss.tm.TxManager.commit(TxManager.java:240)
at org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:351)
at org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageConsumer.java:891)
at org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:170)
at org.jboss.mq.SpySession.run(SpySession.java:323)
at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:194)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:761)
at java.lang.Thread.run(Thread.java:595)
And because the Tx value always keeps incrementing, no further JMS transactions are possible anymore after this failure. Additionally, restarting the server does not help either, because the initial value of Tx is determined from the largest stored TXID, which would already be close to the maximum allowed value.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
15 years, 10 months
[JBoss JIRA] Created: (JBMAN-63) ObjectName meta value creation is inconsistent
by Scott M Stark (JIRA)
ObjectName meta value creation is inconsistent
----------------------------------------------
Key: JBMAN-63
URL: https://jira.jboss.org/jira/browse/JBMAN-63
Project: JBoss Managed
Issue Type: Bug
Components: metatype, metavalue
Affects Versions: JBossMan.2.1.0.CR3
Reporter: Scott M Stark
Assignee: Scott M Stark
Fix For: JBossMan.2.1.0.CR4
The meta type/value creation for javax.management.ObjectName is inconsistent. For ObjectName(String, Hashtable) the resulting composite metatype includes irrelevant implementation details like the MBeanServer. For ObjectNamem(String), the creation of a meta value fails with:
java.lang.IllegalArgumentException: The index is already used [CompositeValueSupport: metaType=[MutableCompositeMetaType{java.lang.Object}] items=[]]
at org.jboss.metatype.api.values.TableValueSupport.put(TableValueSupport.java:140)
at org.jboss.metatype.plugins.values.DefaultMetaValueFactory.createTableValue(DefaultMetaValueFactory.java:524)
at org.jboss.metatype.plugins.values.DefaultMetaValueFactory.internalCreate(DefaultMetaValueFactory.java:1051)
at org.jboss.metatype.plugins.values.DefaultMetaValueFactory.createCompositeValue(DefaultMetaValueFactory.java:490)
at org.jboss.metatype.plugins.values.DefaultMetaValueFactory.internalCreate(DefaultMetaValueFactory.java:1049)
at org.jboss.metatype.plugins.values.DefaultMetaValueFactory.create(DefaultMetaValueFactory.java:533)
at org.jboss.test.metatype.values.factory.test.AbstractMetaValueFactoryTest.createMetaValue(AbstractMetaValueFactoryTest.java:89)
at org.jboss.test.metatype.values.factory.test.ObjectNameUnitTestCase.testObjectNameMVCreation2(ObjectNameUnitTestCase.java:57)
We need a default builder for the ObjectName type.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
15 years, 10 months