[ 
https://issues.apache.org/jira/browse/GROOVY-8115?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jochen Kemnade updated GROOVY-8115:
-----------------------------------
    Description: 
Sorry for the somewhat fuzzy report, i haven't been able to find out what 
exactly causes the error.
Consider the following script:
{code:java}
def c = new GroovyClassLoader().parseClass('''
    import groovy.transform.TimedInterrupt
    import groovy.util.NodeBuilder

    @TimedInterrupt(checkOnMethodStart = false, value = 1L)
    class MyClass {
      def myMethod() {
        def b = new NodeBuilder()
        b.foo {
          while(true){

          }
        }
      }
      def getProperty(String name){ null }

    }
''')
    
c.newInstance().myMethod()
{code}
If I run it, the execution is correctly aborted after a second. The error 
message states: 
{{Execution timed out after 1 units. Start time: null}}.
If I don't override {{getProperty}}, the error message is {{Execution timed out 
after 1 units. Start time: Thu Mar 09 14:35:55 CET 2017}}.
Something is wrong with the access to the start time field in 
{{TimedInterruptibleASTTransformation.createInterruptStatement}} 
(https://github.com/apache/groovy/blob/GROOVY_2_4_9/src/main/org/codehaus/groovy/transform/TimedInterruptibleASTTransformation.groovy#L191).
Taking a wild guess, I assume that it has something to do with the different 
property resolution inside builder closures.
I would have expected the transformation to use {{fieldX(startTimeField)}} 
rather than {{propX(varX("this"), basename + '$startTime')}}, but when I tried 
that, it just broke horribly.

  was:
Sorry for the somewhat fuzzy report, i haven't been able to find out what 
exactly causes the error.
Consider the following script:
{code:java}
def c = new GroovyClassLoader().parseClass('''
    import groovy.transform.TimedInterrupt
    import groovy.util.NodeBuilder

    @TimedInterrupt(checkOnMethodStart = false, value = 1L)
    class MyClass {
      def myMethod() {
        def b = new NodeBuilder()
        b.foo {
          while(true){

          }
        }
      }
      def getProperty(String name){ null }

    }
''')
    
c.newInstance().myMethod()
{code}
If I run it, the execution is correctly aborted after a second. The error 
message states: 
{{Execution timed out after 1 units. Start time: null}}.
If I don't override {{getProperty}}, the error message is {{Execution timed out 
after 1 units. Start time: Thu Mar 09 14:35:55 CET 2017}}.
Something is wrong with the access to the start time field in 
{{TimedInterruptibleASTTransformation.createInterruptStatement}}.


> Reported start time for timed-out executions is sometimes wrong
> ---------------------------------------------------------------
>
>                 Key: GROOVY-8115
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8115
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 2.4.9
>            Reporter: Jochen Kemnade
>
> Sorry for the somewhat fuzzy report, i haven't been able to find out what 
> exactly causes the error.
> Consider the following script:
> {code:java}
> def c = new GroovyClassLoader().parseClass('''
>     import groovy.transform.TimedInterrupt
>     import groovy.util.NodeBuilder
>     @TimedInterrupt(checkOnMethodStart = false, value = 1L)
>     class MyClass {
>       def myMethod() {
>         def b = new NodeBuilder()
>         b.foo {
>           while(true){
>           }
>         }
>       }
>       def getProperty(String name){ null }
>     }
> ''')
>     
> c.newInstance().myMethod()
> {code}
> If I run it, the execution is correctly aborted after a second. The error 
> message states: 
> {{Execution timed out after 1 units. Start time: null}}.
> If I don't override {{getProperty}}, the error message is {{Execution timed 
> out after 1 units. Start time: Thu Mar 09 14:35:55 CET 2017}}.
> Something is wrong with the access to the start time field in 
> {{TimedInterruptibleASTTransformation.createInterruptStatement}} 
> (https://github.com/apache/groovy/blob/GROOVY_2_4_9/src/main/org/codehaus/groovy/transform/TimedInterruptibleASTTransformation.groovy#L191).
> Taking a wild guess, I assume that it has something to do with the different 
> property resolution inside builder closures.
> I would have expected the transformation to use {{fieldX(startTimeField)}} 
> rather than {{propX(varX("this"), basename + '$startTime')}}, but when I 
> tried that, it just broke horribly.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to