Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-14241

[GSS](7.2.0) Unable to set 0 for default transaction timeout

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 7.2.0.CD14
    • 7.1.0.GA
    • Transactions
    • None
    • Hide

      Set Integer.MAX_VALUE (2147483647) instead of 0. This is not equal to no timeout but this large timeout can be used as a workaround in general.

      Show
      Set Integer.MAX_VALUE (2147483647) instead of 0. This is not equal to no timeout but this large timeout can be used as a workaround in general.

      It's not possible to disable transaction timeout ( = no timeout) by setting default transaction timeout to 0.

      jboss-cli output
      [standalone@localhost:9990 /] /subsystem=transactions:write-attribute(name=default-timeout,value=0)
      {
          "outcome" => "failed",
          "failure-description" => "WFLYCTL0158: Operation handler failed: java.lang.IllegalArgumentException: COM00001: Parameter 'newTimeout' must not be less than 1",
          "rolled-back" => true
      }
      
      server.log output
      ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 2) WFLYCTL0013: Operation ("write-attribute") failed - address: ([("subsystem" => "transactions")]): java.lang.IllegalArgumentException: COM00001: Parameter 'newTimeout' must not be less than 1
      	at org.wildfly.common.Assert.checkMinimumParameter(Assert.java:133)
      	at org.wildfly.transaction.client.ContextTransactionManager.setGlobalDefaultTransactionTimeout(ContextTransactionManager.java:183)
      	at org.jboss.as.txn.subsystem.TransactionSubsystemRootResourceDefinition$DefaultTimeoutHandler.applyUpdateToRuntime(TransactionSubsystemRootResourceDefinition.java:499)
      	at org.jboss.as.controller.AbstractWriteAttributeHandler$1.execute(AbstractWriteAttributeHandler.java:104)
      	at org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:982)
      	at org.jboss.as.controller.AbstractOperationContext.processStages(AbstractOperationContext.java:726)
      	at org.jboss.as.controller.AbstractOperationContext.executeOperation(AbstractOperationContext.java:450)
      	at org.jboss.as.controller.OperationContextImpl.executeOperation(OperationContextImpl.java:1402)
      	at org.jboss.as.controller.ModelControllerImpl.internalExecute(ModelControllerImpl.java:418)
      	at org.jboss.as.controller.ModelControllerImpl.lambda$execute$1(ModelControllerImpl.java:243)
      	at org.wildfly.security.auth.server.SecurityIdentity.runAs(SecurityIdentity.java:263)
      	at org.wildfly.security.auth.server.SecurityIdentity.runAs(SecurityIdentity.java:229)
      	at org.jboss.as.controller.ModelControllerImpl.execute(ModelControllerImpl.java:243)
      	at org.jboss.as.controller.remote.ModelControllerClientOperationHandler$ExecuteRequestHandler.doExecute(ModelControllerClientOperationHandler.java:217)
      	at org.jboss.as.controller.remote.ModelControllerClientOperationHandler$ExecuteRequestHandler.access$400(ModelControllerClientOperationHandler.java:137)
      	at org.jboss.as.controller.remote.ModelControllerClientOperationHandler$ExecuteRequestHandler$1$1.run(ModelControllerClientOperationHandler.java:161)
      	at org.jboss.as.controller.remote.ModelControllerClientOperationHandler$ExecuteRequestHandler$1$1.run(ModelControllerClientOperationHandler.java:157)
      	at org.wildfly.security.auth.server.SecurityIdentity.runAs(SecurityIdentity.java:287)
      	at org.wildfly.security.auth.server.SecurityIdentity.runAs(SecurityIdentity.java:244)
      	at org.jboss.as.controller.AccessAuditContext.doAs(AccessAuditContext.java:254)
      	at org.jboss.as.controller.AccessAuditContext.doAs(AccessAuditContext.java:225)
      	at org.jboss.as.controller.remote.ModelControllerClientOperationHandler$ExecuteRequestHandler$1.execute(ModelControllerClientOperationHandler.java:157)
      	at org.jboss.as.protocol.mgmt.ManagementRequestContextImpl$1.doExecute(ManagementRequestContextImpl.java:70)
      	at org.jboss.as.protocol.mgmt.ManagementRequestContextImpl$AsyncTaskRunner.run(ManagementRequestContextImpl.java:160)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      	at java.lang.Thread.run(Thread.java:748)
      	at org.jboss.threads.JBossThread.run(JBossThread.java:320)
      

      Note that it was possible in EAP 7.0.x. In addition, EAP 7 management model says its min value is 0:

      [standalone@localhost:9990 /] /subsystem=transactions:read-resource-description 
            ...(snip)...
                  "default-timeout" => {
                      "type" => INT,
                      "description" => "The default timeout for a transaction managed by the transaction manager.",
                      "expressions-allowed" => true,
                      "required" => false,
                      "nillable" => true,
                      "default" => 300,
                      "unit" => "SECONDS",
                      "min" => 0L,
                      "max" => 2147483647L,
                      "access-type" => "read-write",
                      "storage" => "configuration",
                      "restart-required" => "no-services"
                  },
            ...(snip)...
      

      and "setValidator(new IntRangeValidator(0))" ( = minimum is 0) is specified for DEFAULT_TIMEOUT attribute in TransactionSubsystemRootResourceDefinition:

      150     public static final SimpleAttributeDefinition DEFAULT_TIMEOUT = new SimpleAttributeDefinitionBuilder(CommonAttributes.DEFAULT_TIMEOUT, ModelType.INT, true)
      151             .setValidator(new IntRangeValidator(0))          // <--- minimum is 0
      152             .setMeasurementUnit(MeasurementUnit.SECONDS)
      153             .setDefaultValue(new ModelNode().set(300))
      154             .setFlags(AttributeAccess.Flag.RESTART_NONE)
      155             .setXmlName(Attribute.DEFAULT_TIMEOUT.getLocalName())
      156             .setAllowExpression(true).build();
      

      However, wildfly-transaction-client is doing another validation by calling "Assert.checkMinimumParameter("newTimeout", 1, newTimeout)" ( = minimum is 1) in ContextTransactionManager#setGlobalDefaultTransactionTimeout(). It seems this check should use 0 instead of 1.

      https://github.com/wildfly/wildfly-transaction-client/blob/1.0.2.Final/src/main/java/org/wildfly/transaction/client/ContextTransactionManager.java#L176-L189

      176     /**
      177      * Set the global default transaction timeout, returning the original value.
      178      *
      179      * @param newTimeout the new timeout value in seconds (must be >= 1)
      180      * @return the previous timeout in seconds (>= 1)
      181      */
      182     public static int setGlobalDefaultTransactionTimeout(int newTimeout) { 
      183         Assert.checkMinimumParameter("newTimeout", 1, newTimeout);          // <--- minimum is 1
      184         final SecurityManager sm = System.getSecurityManager();
      185         if (sm != null) {
      186             sm.checkPermission(SET_TIMEOUT_PERMISSION);
      187         }
      188         return defaultTimeoutRef.getAndSet(newTimeout);
      189     }
      

              zfeng@redhat.com Zheng Feng
              rhn-support-mmiura Masafumi Miura
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: