Uploaded image for project: 'FishEye'
  1. FishEye
  2. FE-5729

Race condition in RecentlyVisitedManager.addItemToHistory

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Low
    • 3.3.0
    • 2.6.6
    • None
    • None

    Description

      addItemToHistory has a race condition that can cause attempted inserts of duplicate keys.

      
      011-09-02 15:03:40,806 WARN  [btpool0-54 ] org.hibernate.util.JDBCExceptionReporter org.hibernate.util.JDBCExceptionReporter-logExceptions - SQL Error: 0, SQLState: null
      2011-09-02 15:03:40,907 ERROR [btpool0-54 ] org.hibernate.util.JDBCExceptionReporter org.hibernate.util.JDBCExceptionReporter-logExceptions - Batch entry 0 insert into cru_recently_visited (cru_last_viewed, cru_user_name, cru_item_type, cru_entity_id) values (1314
      939820407, tstcruser4, atlassian-review, CR-ATL-542) was aborted.  Call getNextException to see the cause.
      2011-09-02 15:03:40,908 WARN  [btpool0-54 ] org.hibernate.util.JDBCExceptionReporter org.hibernate.util.JDBCExceptionReporter-logExceptions - SQL Error: 0, SQLState: 23505
      2011-09-02 15:03:40,908 ERROR [btpool0-54 ] org.hibernate.util.JDBCExceptionReporter org.hibernate.util.JDBCExceptionReporter-logExceptions - ERROR: duplicate key value violates unique constraint "cru_recently_visited_pkey"
        Detail: Key (cru_user_name, cru_item_type, cru_entity_id)=(tstcruser4, atlassian-review, CR-ATL-542) already exists.
      2011-09-02 15:03:40,910 ERROR [btpool0-54 ] org.hibernate.event.def.AbstractFlushingEventListener org.hibernate.event.def.AbstractFlushingEventListener-performExecutions - Could not synchronize database state with sessionorg.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
              at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:96)
              at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
              at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275)
              at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:262)
              at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:178)
              at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
              at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51)
              at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1206)
              at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:375)
              at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:137)
              at com.cenqua.crucible.hibernate.SessionState.commit(SessionState.java:101)
              at com.cenqua.crucible.hibernate.SessionState.commitTx(SessionState.java:67)
              at com.cenqua.crucible.hibernate.HibernateUtil.commitTransaction(HibernateUtil.java:228)
              at com.atlassian.fisheye.user.DefaultRecentlyVisitedManager.addItemToHistory(DefaultRecentlyVisitedManager.java:84)
              at com.atlassian.crucible.actions.ReviewAction.execute(ReviewAction.java:110)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:597)
              at com.opensymphony.xwork.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:358)
              at com.opensymphony.xwork.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:218)
              at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:192)
              at com.cenqua.crucible.interceptors.ReviewInterceptor.intercept(ReviewInterceptor.java:51)
              at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:190)
              at com.cenqua.crucible.interceptors.CruciblePermissionInterceptor.intercept(CruciblePermissionInterceptor.java:52)
              at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:190)
      

      Attachments

        Issue Links

          Activity

            People

              tom@atlassian.com Tom Davies
              bhumphreys BrendanA
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: