Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 833008

Summary: Human Tasks on Windows do not work. Most of the time.
Product: [JBoss] JBoss Enterprise BRMS Platform 5 Reporter: Zuzana Krejčová <zkrejcov>
Component: jBPM ConsoleAssignee: Marco Rietveld <mrietvel>
Status: CLOSED NOTABUG QA Contact: Zuzana Krejčová <zkrejcov>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: atangrin, gdesmet, kverlaen, lpetrovi, smcgowan
Target Milestone: ---Keywords: Regression
Target Release: ---   
Hardware: Unspecified   
OS: Windows   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-19 17:31:53 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
repository none

Description Zuzana Krejčová 2012-06-18 11:38:02 UTC
Created attachment 592611 [details]
repository

Description of problem:
On Windows machines, some operations on some human tasks result in exceptions and various failures. Everyting is fine on RHEL/Fedora, not so on Windows. Database used does not matter it seems (tested with Derby and MySQL, both show the problem).

To reproduce this, use the attached repository.


The first problem shows with the Evaluation process provided in the repo - if you start a new instance, fill in the process form and then complete the first human task, exceptions are thrown. Group task should be available after this task is completed but they are not, the were not created:

WARN  [org.hibernate.util.JDBCExceptionReporter] (Thread-42) SQL Error: 0, SQLState: null
ERROR [org.hibernate.util.JDBCExceptionReporter] (Thread-42) failed batch
ERROR [org.hibernate.event.def.AbstractFlushingEventListener] (Thread-42) Could not synchronize database state with session
org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update
	at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:126)
...
Caused by: java.sql.BatchUpdateException: failed batch
	at org.hsqldb.jdbc.jdbcStatement.executeBatch(Unknown Source)
...
...
ERROR [org.jbpm.process.workitem.wsht.AsyncWSHumanTaskHandler] (Thread-71) Mon Jun 18 04:34:35 EDT 2012: Error when creating task on task server for work item id 4. Error reported by task server: Command AddTaskRequest faild due to Could not commit transaction. Please contact task server administrator.
java.lang.RuntimeException: Command AddTaskRequest faild due to Could not commit transaction. Please contact task server administrator.
	at org.jbpm.task.service.TaskServerHandler.messageReceived(TaskServerHandler.java:639)
	at org.jbpm.task.service.hornetq.HornetQTaskServerHandler.messageReceived(HornetQTaskServerHandler.java:44)
	at org.jbpm.task.service.hornetq.BaseHornetQTaskServer.run(BaseHornetQTaskServer.java:85)
	at java.lang.Thread.run(Thread.java:662)


Second problem: when trying to skip a skippable human task in the skipTask process, the task dissappears from the list of tasks but the instance does not continue it's run it seems - the diagram is stuck in the same state as before. Server log shows this:

ERROR [org.jbpm.task.service.TaskServerHandler] (Thread-42) Operation failed
java.lang.RuntimeException: Operation failed
	at org.jbpm.task.service.persistence.TaskPersistenceManager.queryWithParametersInTransaction(TaskPersistenceManager.java:278)
...
Caused by: javax.persistence.NoResultException: No entity found for query
	at org.hibernate.ejb.QueryImpl.getSingleResult(QueryImpl.java:132)
...
ERROR [STDERR] (Thread-71) java.lang.RuntimeException: Client Exception with class class org.jbpm.task.service.hornetq.HornetQTaskClientConnector$1 using port 5446
ERROR [org.jbpm.task.service.TaskServerHandler] (Thread-42) Operation failed
java.lang.RuntimeException: Operation failed
	at org.jbpm.task.service.persistence.TaskPersistenceManager.queryWithParametersInTransaction(TaskPersistenceManager.java:278)
...
Caused by: javax.persistence.NoResultException: No entity found for query
	at org.hibernate.ejb.QueryImpl.getSingleResult(QueryImpl.java:132)
...
ERROR [STDERR] (Thread-71) 	at org.jbpm.task.service.hornetq.HornetQTaskClientConnector$1.run(HornetQTaskClientConnector.java:119)
ERROR [STDERR] (Thread-71) 	at java.lang.Thread.run(Thread.java:662)
ERROR [STDERR] (Thread-71) Caused by: java.lang.ClassCastException: org.jbpm.process.workitem.wsht.CommandBasedWSHumanTaskHandler$AbortTaskResponseHandler cannot be cast to org.jbpm.task.service.TaskClientHandler$TaskSummaryResponseHandler
ERROR [STDERR] (Thread-71) 	at org.jbpm.task.service.TaskClientHandler.messageReceived(TaskClientHandler.java:171)
ERROR [STDERR] (Thread-71) 	at org.jbpm.task.service.hornetq.HornetQTaskClientHandler.messageReceived(HornetQTaskClientHandler.java:56)
ERROR [STDERR] (Thread-71) 	at org.jbpm.task.service.hornetq.HornetQTaskClientConnector$1.run(HornetQTaskClientConnector.java:108)
ERROR [STDERR] (Thread-71) 	... 1 more

The CCE I've already seen with bug 832436.


And a third problem: After terminating a process instance that at the moment is waiting on a human task with skippable==false, the task stays available. This one might, however, be happening due to the second bug, that happens just before I test this.



With MySQL, the SQL error for the first problem is much more helpful:
SQL Error: 1452, SQLState: 23000
Cannot add or update a child row: a foreign key constraint fails (`dballo01`.`PeopleAssignments_PotOwners`, CONSTRAINT `FK1EE418D2C122ED2` FOREIGN KEY (`entity_id`) REFERENCES `OrganizationalEntity` (`id`))
Still, not sure how this can happen on Windows only.



Version-Release number of selected component (if applicable):
BRMS 5.3 ER9

Comment 2 Zuzana Krejčová 2012-06-18 11:51:52 UTC
There's one human task process in the repo that can be safely started, the task completed, nothing goes wrong (whitespace process).
Also, the first human task of the Evaluation process, the self evaluation, does not "resist" when the instance is terminated (the task has been released at that time).
Terminating the skipTask after the test fails on the second mentioned problem also does not throw anything.

Comment 3 Zuzana Krejčová 2012-06-18 13:02:37 UTC
Good new is, after isolating the two tests causing second and third problem, those two problem don't show up. So it's just the creation of those group tasks that is problematic. Still, this shows that once it fails on that, it simply keeps on failing, which still is not good.

Comment 4 Zuzana Krejčová 2012-06-18 14:08:36 UTC
I tried to use a tip from lpetrovi - start the server with -Dfile.encoding=UTF-8 - but the results are the same. Never-the-less this seems like a good direction to be looking in.

Comment 5 Geoffrey De Smet 2012-06-19 10:19:36 UTC
MySQL's default encoding is platform dependent. It's independent of the JVM encoding (so -Dfile.encoding=UTF-8).

It's set in the my*.ini file if I recall correctly. On linux that file is in /etc/mysql/ but on windows no idea.

Mysql's encoding (which is used in all varchar fields) is
on linux defaulted to UTF-8
on windows it's defaulted to the OS encoding, which is windows-1252 (a € variant of Latin-1) on a Belgian computer.

Comment 6 Geoffrey De Smet 2012-06-19 10:35:34 UTC
mysql encoding is not to be blamed: Lukas confirmed the mysql database itself is hosted on unix/linux.

Comment 7 Geoffrey De Smet 2012-06-19 10:45:09 UTC
Googling the mysql error code brings this
"In 5.0, both tables must be INNODB. 5.1 (somewhat weirdly) coerces the business table to INNODB, saving us once again from our sins :-)."

http://forums.mysql.com/read.php?10,217927,217930#msg-217930

Comment 8 Zuzana Krejčová 2012-06-19 11:32:18 UTC
I get the same results with PostgrSQL 8.4, the exception just has a bit more info:

WARN  [org.hibernate.util.JDBCExceptionReporter] (Thread-27) SQL Error: 0, SQLState: 23503 
ERROR [org.hibernate.util.JDBCExceptionReporter] (Thread-27) Batch entry 0 insert into PeopleAssignments_PotOwners (task_id, entity_id) values ('32', 'PM') was aborted.  Call getNextException to see the cause.
WARN  [org.hibernate.util.JDBCExceptionReporter] (Thread-27) SQL Error: 0, SQLState: 23503
ERROR [org.hibernate.util.JDBCExceptionReporter] (Thread-27) ERROR: insert or update on table "peopleassignments_potowners" violates foreign key constraint "fk1ee418d2c122ed2"   Detail: Key (entity_id)=(PM) is not present in table "organizationalentity".
ERROR [org.hibernate.event.def.AbstractFlushingEventListener] (Thread-27) Could not synchronize database state with session org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update

Comment 9 Zuzana Krejčová 2012-06-19 15:00:02 UTC
Further tests revealed that:
1) it does not matter whether UserGroupCallback is used or not
2) mssql2008r2 fails too (not a surprise) this time with 
WARN  [org.hibernate.util.JDBCExceptionReporter] (Thread-27) SQL Error: 547, SQLState: 23000
ERROR [org.hibernate.util.JDBCExceptionReporter] (Thread-27) The INSERT statement conflicted with the FOREIGN KEY constraint "FK1EE418D2C122ED2". The conflict occurred in database "dballo00", table "dbo.OrganizationalEntity", column 'id'.
ERROR [org.hibernate.event.def.AbstractFlushingEventListener] (Thread-27) Could not synchronize database state with session
org.hibernate.exception.ConstraintViolationException: could not insert collection: [org.jbpm.task.Task.peopleAssignments.potentialOwners#4]
	at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:94)
...
	at org.jbpm.task.service.persistence.TaskLocalTransactionManager.commit(TaskLocalTransactionManager.java:55)
	at org.jbpm.task.service.persistence.TaskPersistenceManager.endTransaction(TaskPersistenceManager.java:94)
...
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The INSERT statement conflicted with the FOREIGN KEY constraint "FK1EE418D2C122ED2". The conflict occurred in database "dballo00", table "dbo.OrganizationalEntity", column 'id'.
	at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:197)
...
	at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:365)
	at org.hibernate.jdbc.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:46)
	at org.hibernate.persister.collection.AbstractCollectionPersister.recreate(AbstractCollectionPersister.java:1168)
	... 18 more

ERROR [org.jbpm.process.workitem.wsht.AsyncWSHumanTaskHandler] (Thread-44) Tue Jun 19 09:11:33 EDT 2012: Error when creating task on task server for work item id 4. Error reported by task server: Command AddTaskRequest faild due to Could not commit transaction. Please contact task server administrator.
java.lang.RuntimeException: Command AddTaskRequest faild due to Could not commit transaction. Please contact task server administrator.

Comment 10 Kris Verlaenen 2012-06-19 15:55:20 UTC
This last exception, is it possible this is done during initialization?  It seems it's trying to register the group now, but note you shouldn't be doing this more than once.  So this exception now seems to indicate the group is already there, so can't be added again.

Comment 11 Marco Rietveld 2012-06-19 17:31:53 UTC
I've been able to reproduce the exact same stack trace on a linux machine. 

It very much looks like the bug was caused by the fact that the underlying datasource for the human-task component had not been filled with the needed user and group information. (This is how I reproduced the bug on a linux machine.)

Furthermore, I've run a number of different tests (both unit and via a running BRMS server) and I also debugged a large part of the code for this (remote java debugging) -- all on the windows machine in question, which generated this bug. None of these things have turned up any surprising errors. 

I've looked at lots of different possible causes (upper/lowercase windows issues, clock resolution, CR/LF's, etc.) and none matched the stack trace. 

After discussing this with a number of people, I am strongly inclined to call this not a bug -- just a false positive that happened, as they sometimes do.