Bug 863518

Summary: UnitOfWork being called twice
Product: [Community] Candlepin Reporter: Dennis Crissman <dcrissman>
Component: candlepinAssignee: Jesus M. Rodriguez <jesusr>
Status: CLOSED CURRENTRELEASE QA Contact: Eric Sammons <esammons>
Severity: high Docs Contact:
Priority: unspecified    
Version: 0.9CC: dgregor, jesusr, tomckay
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-11-05 13:52:36 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:

Description Dennis Crissman 2012-10-05 17:19:10 UTC
In production & stage we are getting this exception repeated numerous times for various jobs. From what I can tell, it seems intermittent. 

In dev I have reproduced. When I first queue up a bunch of jobs some of them (with no rhyme or reason that I can tell) execute just fine, but others seem to get stuck in a loop where this exception gets thrown and the jobs goes to sleep for a while before trying again. At some later point, the job may actually complete.

This is a high visability issue, so any help you can offer would be much appreciated.

Thanks,
Dennis



Oct 05 13:20:15 [ITClusteredScheduler_Worker-4] ERROR org.quartz.core.ErrorLogger - Unable to notify JobListener(s) of Job to be executed: (Job will NOT be executed!). trigger= async group.refresh_pools_affe1919-f1e5-431c-85c7-c99b9ef6923f trigger job= async group.refresh_pools_affe1919-f1e5-431c-85c7-c99b9ef6923f
org.quartz.SchedulerException: JobListener 'Pinsetter Job Listener' threw exception: Work already begun on this thread. Looks like you have called UnitOfWork.begin() twice without a balancing call to end() in between. [See nested exception: java.lang.IllegalStateException: Work already begun on this thread. Looks like you have called UnitOfWork.begin() twice without a balancing call to end() in between.]
	at org.quartz.core.QuartzScheduler.notifyJobListenersToBeExecuted(Unknown Source)
	at org.quartz.core.JobRunShell.notifyListenersBeginning(Unknown Source)
	at org.quartz.core.JobRunShell.run(Unknown Source)
	at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(Unknown Source)
Caused by: java.lang.IllegalStateException: Work already begun on this thread. Looks like you have called UnitOfWork.begin() twice without a balancing call to end() in between.
	at com.google.inject.internal.util.$Preconditions.checkState(Preconditions.java:142)
	at com.google.inject.persist.jpa.JpaPersistService.begin(JpaPersistService.java:66)
	at org.candlepin.pinsetter.core.PinsetterJobListener.jobToBeExecuted(PinsetterJobListener.java:66)
	... 4 more