Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-15113

EJB timer: need to consider existing timers in database when switching to truncated timestamp

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 25.0.0.Beta1, 25.0.0.Final
    • 23.0.0.Final
    • EJB
    • None
    • Undefined

    Description

      In the fix for WFLY-14371 (EJB timer not executed on Postgres due to timestamp comparison), a timer's timestamp column value is truncated to remove any fractional seconds before persisting to database. This works well with applications that start a new timer database. However, for applications with existing timer table and existing active timers having fractional timestamp values, these existing timer task will not be executed, and will be retried again and again but still not executed.

      It is because the truncated timestamp is always less than the corresponding timestamp value with fractional seconds in database, and the WHERE clause in the update statement always evaluates to false.

      Need to fix this to make sure all existing timers still work as expected after applying the fix to WFLY-14371 (EJB timer not executed on Postgres due to timestamp comparison).

      The workaround: users can check JBOSS_EJB_TIMER table to see if any timer's NEXT_DATE value contains fractional second. If so run sql update for each such timer to remove the fractional part. For example, changing "2021-04-07 03:08:31.251" to "2021-04-07 03:08:31.0"

      CLI command to cancel a timer if a timer is no longer valid:

      /deployment=ee6-singleton-timer.jar/subsystem=ejb3/singleton-bean=EE6ExampleSingletonTimer/service=timer-service/timer=6c10dd16-17a5-407b-83c7-a09ab3867f04:cancel()
      

      This issue affects ejb timer using postgresql and mysql databases.

      Attachments

        Issue Links

          Activity

            People

              cfang@redhat.com Cheng Fang
              cfang@redhat.com Cheng Fang
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: