Uploaded image for project: 'IronJacamar'
  1. IronJacamar
  2. JBJCA-1309

Query timeout (set-tx-query-timeout) not applied within last second before transaction timeout

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • None
    • 1.2.6.Final
    • JDBC
    • None
      1. have a JTA transaction with 1 second timeout
      2. sleep 1 ms
      3. run very long query
      4. the query should have query timeout of 1 s (and so it should be aborted), but it gets no timeout at all

      When using <set-tx-query-timeout>true</set-tx-query-timeout, the query timeout is applied, unless less than 1 second remains until transaction timeout.

      This is due to a typo in code converting transaction timeout (millis) into jdbc timeout (seconds).
      Widlfy 9.0.2 uses IronJacama 1.2.5, so here's the code (https://github.com/ironjacamar/ironjacamar/blob/ironjacamar-1.2.5.Final/adapters/src/main/java/org/jboss/jca/adapters/jdbc/WrapperDataSource.java#L207):

                  long result = timeout / 1000;
                  if ((result % 1000) != 0) // <------   the `timeout % 1000` was supposed to be
                     ++result;
      

              flaviarnn Flavia Rainone
              findepi_jira Piotr Findeisen (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: