Uploaded image for project: 'Contrib: TurnItIn'
  1. Contrib: TurnItIn
  2. TII-164

NPE from locking code

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: RESOLVED
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.x
    • Fix Version/s: 10.x
    • Component/s: Service
    • Labels:
      None

      Description

      The locking code in Turnitin (both roster sync and queue submission) can cause NPEs because the DAO obtainLock() call returns true / false / null, which is assigned to a boolean.

      The null case (probably a race condition from the job running on more than one node) can cause unnecessary termination of the job.

      2014-09-22 08:27:47,125 INFO QuartzScheduler_Worker-4 org.sakaiproject.contentreview.impl.turnitin.TurnitinRosterSync - About to Turnitin Syncing: 19635 , e43d25d2-c9d5-4518-8353-4b2b6502b5fb , 1
      2014-09-22 08:27:47,130 WARN QuartzScheduler_Worker-3 org.hibernate.util.JDBCExceptionReporter - SQL Error: 1062, SQLState: 23000
      2014-09-22 08:27:47,130 ERROR QuartzScheduler_Worker-3 org.hibernate.util.JDBCExceptionReporter - Duplicate entry 'org.sakaiproject.contentreview.model.ContentReviewRosterSyncItem' for key 'NAME'
      2014-09-22 08:27:47,137 FATAL QuartzScheduler_Worker-3 org.sakaiproject.contentreview.dao.impl.ContentReviewDaoImpl - Lock obtaining failure for lock (org.sakaiproject.contentreview.model.ContentReviewRosterSyncItem19635): could not insert: [org.sakaiproject.contentreview.model.ContentReviewLock]; SQL [insert into CONTENTREVIEW_LOCK (LAST_MODIFIED, NAME, HOLDER) values (?, ?, ?)]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: could not insert: [org.sakaiproject.contentreview.model.ContentReviewLock]
      org.springframework.dao.DataIntegrityViolationException: could not insert: [org.sakaiproject.contentreview.model.ContentReviewLock]; SQL [insert into CONTENTREVIEW_LOCK (LAST_MODIFIED, NAME, HOLDER) values (?, ?, ?)]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: could not insert: [org.sakaiproject.contentreview.model.ContentReviewLock]
      at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:643)
      at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)
      at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:411)
      at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
      at org.springframework.orm.hibernate3.HibernateTemplate.save(HibernateTemplate.java:683)
      at org.sakaiproject.contentreview.dao.impl.ContentReviewDaoImpl.obtainLock(ContentReviewDaoImpl.java:113)
      at sun.reflect.GeneratedMethodAccessor750.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
      at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96)
      at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)
      at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
      at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
      at com.sun.proxy.$Proxy21.obtainLock(Unknown Source)
      at org.sakaiproject.contentreview.impl.turnitin.TurnitinRosterSync.obtainLock(TurnitinRosterSync.java:407)
      at org.sakaiproject.contentreview.impl.turnitin.TurnitinRosterSync.processSyncQueue(TurnitinRosterSync.java:427)
      at org.sakaiproject.component.app.scheduler.jobs.ContentReviewTurnitinRosterSync.execute(ContentReviewTurnitinRosterSync.java:16)
      at org.sakaiproject.component.app.scheduler.jobs.SpringStatefulJobBeanWrapper.execute(SpringStatefulJobBeanWrapper.java:20)
      at org.quartz.core.JobRunShell.run(JobRunShell.java:223)
      at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)
      Caused by: org.hibernate.exception.ConstraintViolationException: could not insert: [org.sakaiproject.contentreview.model.ContentReviewLock]
      at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:96)
      at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
      at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:63)
      at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2346)
      at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2853)
      at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:71)
      at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:273)
      at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:320)
      at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:203)
      at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:129)
      at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:210)
      at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:56)
      at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:195)
      at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:50)
      at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93)
      at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:713)
      at org.hibernate.impl.SessionImpl.save(SessionImpl.java:701)
      at org.hibernate.impl.SessionImpl.save(SessionImpl.java:697)
      at org.springframework.orm.hibernate3.HibernateTemplate$12.doInHibernate(HibernateTemplate.java:686)
      at org.springframework.orm.hibernate3.HibernateTemplate$12.doInHibernate(HibernateTemplate.java:683)
      at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:406)
      ... 21 more
      Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry 'org.sakaiproject.contentreview.model.ContentReviewRosterSyncItem' for key 'NAME'
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
      at com.mysql.jdbc.Util.handleNewInstance(Util.java:408)
      at com.mysql.jdbc.Util.getInstance(Util.java:383)
      at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1049)
      at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4208)
      at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4140)
      at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2597)
      at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2758)
      at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2826)
      at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2082)
      at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2334)
      at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2262)
      at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2246)
      at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
      at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
      at org.hibernate.id.IdentityGenerator$GetGeneratedKeysDelegate.executeAndExtract(IdentityGenerator.java:93)
      at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:56)
      ... 39 more
      2014-09-22 08:27:47,143 ERROR QuartzScheduler_Worker-3 org.quartz.core.JobRunShell - Job DEFAULT.CR Roster Sync threw an unhandled Exception:
      java.lang.NullPointerException
      at org.sakaiproject.contentreview.impl.turnitin.TurnitinRosterSync.obtainLock(TurnitinRosterSync.java:407)
      at org.sakaiproject.contentreview.impl.turnitin.TurnitinRosterSync.processSyncQueue(TurnitinRosterSync.java:427)
      at org.sakaiproject.component.app.scheduler.jobs.ContentReviewTurnitinRosterSync.execute(ContentReviewTurnitinRosterSync.java:16)
      at org.sakaiproject.component.app.scheduler.jobs.SpringStatefulJobBeanWrapper.execute(SpringStatefulJobBeanWrapper.java:20)
      at org.quartz.core.JobRunShell.run(JobRunShell.java:223)
      at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)
      2014-09-22 08:27:47,143 ERROR QuartzScheduler_Worker-3 org.quartz.core.ErrorLogger - Job (DEFAULT.CR Roster Sync threw an exception.
      org.quartz.SchedulerException: Job threw an unhandled exception. [See nested exception: java.lang.NullPointerException]
      at org.quartz.core.JobRunShell.run(JobRunShell.java:234)
      at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)
      Caused by: java.lang.NullPointerException
      at org.sakaiproject.contentreview.impl.turnitin.TurnitinRosterSync.obtainLock(TurnitinRosterSync.java:407)
      at org.sakaiproject.contentreview.impl.turnitin.TurnitinRosterSync.processSyncQueue(TurnitinRosterSync.java:427)
      at org.sakaiproject.component.app.scheduler.jobs.ContentReviewTurnitinRosterSync.execute(ContentReviewTurnitinRosterSync.java:16)
      at org.sakaiproject.component.app.scheduler.jobs.SpringStatefulJobBeanWrapper.execute(SpringStatefulJobBeanWrapper.java:20)
      at org.quartz.core.JobRunShell.run(JobRunShell.java:223)
      ... 1 more
      2014-09-22 08:27:47,677 INFO QuartzScheduler_Worker-4 org.sakaiproject.contentreview.impl.turnitin.TurnitinRosterSync - Adding Instructor(2b49459a-eb8a-4d28-801c-970c00769523) to site: e43d25d2-c9d5-4518-8353-4b2b6502b5fb

        Gliffy Diagrams

          Zeplin

            Attachments

              Activity

                People

                Assignee:
                smarquard Stephen Marquard
                Reporter:
                smarquard Stephen Marquard
                Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:

                    Git Integration