You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@groovy.apache.org by Krzysztof Kowalczyk <ko...@gmail.com> on 2016/11/09 12:20:43 UTC

Bug with closure() and compile static ?

Hi,
So I run into a gotcha today:
​import groovy.transform.CompileStatic@CompileStaticclass Foo {    Closure c
= { println "right closure" }    Closure wrap = {         println "wrapping
closure"        c() // stack overflow invoke wrap() instead of c()    }   
def run(){        wrap()    }}new Foo().run()​
So this example throws stack overflow exception if CompileStatic is used. 
It would run correctly with c.call() or without CompileStatic.

Bug? Did found some things with stack overflow in Jira but nothing that
looked the same.

Regards,
Krzysztof



--
View this message in context: http://groovy.329449.n5.nabble.com/Bug-with-closure-and-compile-static-tp5736592.html
Sent from the Groovy Users mailing list archive at Nabble.com.

Re: Bug with closure() and compile static ?

Posted by bo zhang <zh...@gmail.com>.
It has been fixed. https://github.com/apache/groovy/pull/460

But it seems that some errors occurred because of 503 in installing jdk.
https://travis-ci.org/apache/groovy/jobs/174813683

Anyone can help?

Connecting to www.oracle.com (www.oracle.com)|104.96.237.225|:443... connected.

HTTP request sent, awaiting response... 503 Service Unavailable

2016-11-10 15:58:01 ERROR 503: Service Unavailable.

download failed

Oracle JDK 8 is NOT installed.

dpkg: error processing oracle-java8-installer (--configure):

 subprocess installed post-installation script returned error exit status 1

Errors were encountered while processing:

 oracle-java8-installer

E: Sub-process /usr/bin/dpkg returned an error code (1)

apt-get.diagnostics

apt-get install failed

$ cat ~/apt-get-update.log

Get:1 http://downloads-distro.mongodb.org dist Release.gpg [490 B]

Get:2 http://downloads-distro.mongodb.org dist Release [2,040 B]

Get:3 http://downloads-distro.mongodb.org dist/10gen amd64 Packages [30.9 kB]

Hit http://us.archive.ubuntu.com precise Release.gpg

Get:4 http://us.archive.ubuntu.com precise-updates Release.gpg [198 B]

Get:5 http://us.archive.ubuntu.com precise-backports Release.gpg [198 B]

Get:6 http://downloads-distro.mongodb.org dist/10gen i386 Packages [30.5 kB]

Hit http://us.archive.ubuntu.com precise Release

Get:7 http://us.archive.ubuntu.com precise-updates Release [55.4 kB]

Get:8 http://us.archive.ubuntu.com precise-backports Release [55.5 kB]

Hit http://us.archive.ubuntu.com precise/main Sources

Hit http://us.archive.ubuntu.com precise/restricted Sources

Hit http://us.archive.ubuntu.com precise/universe Sources

Hit http://us.archive.ubuntu.com precise/multiverse Sources

Hit http://us.archive.ubuntu.com precise/main amd64 Packages

Hit http://us.archive.ubuntu.com precise/restricted amd64 Packages

Hit http://us.archive.ubuntu.com precise/universe amd64 Packages

Hit http://us.archive.ubuntu.com precise/multiverse amd64 Packages

Hit http://us.archive.ubuntu.com precise/main i386 Packages

Hit http://us.archive.ubuntu.com precise/restricted i386 Packages

Hit http://us.archive.ubuntu.com precise/universe i386 Packages

Hit http://us.archive.ubuntu.com precise/multiverse i386 Packages

Get:9 http://us.archive.ubuntu.com precise-updates/main Sources [613 kB]

Get:10 http://us.archive.ubuntu.com precise-updates/restricted Sources [9,183 B]

Get:11 http://us.archive.ubuntu.com precise-updates/universe Sources [163 kB]

Get:12 http://us.archive.ubuntu.com precise-updates/multiverse Sources [11.0 kB]

Get:13 http://us.archive.ubuntu.com precise-updates/main amd64
Packages [1,334 kB]

Hit http://ppa.launchpad.net precise Release.gpg

Hit http://ppa.launchpad.net precise Release.gpg

Get:14 http://ppa.launchpad.net precise Release.gpg [316 B]

Get:15 http://ppa.launchpad.net precise Release.gpg [316 B]

Get:16 http://ppa.launchpad.net precise Release.gpg [316 B]

Get:17 http://ppa.launchpad.net precise Release.gpg [316 B]

Get:18 http://security.ubuntu.com precise-security Release.gpg [198 B]

Get:19 http://us.archive.ubuntu.com precise-updates/restricted amd64
Packages [19.6 kB]

Get:20 http://us.archive.ubuntu.com precise-updates/universe amd64
Packages [365 kB]

Get:21 http://us.archive.ubuntu.com precise-updates/multiverse amd64
Packages [19.4 kB]

Get:22 http://us.archive.ubuntu.com precise-updates/main i386 Packages
[1,425 kB]

Get:23 http://apt.postgresql.org precise-pgdg Release.gpg [819 B]

Hit http://ppa.launchpad.net precise Release

Hit http://ppa.launchpad.net precise Release

Get:24 http://ppa.launchpad.net precise Release [12.9 kB]

Get:25 http://us.archive.ubuntu.com precise-updates/restricted i386
Packages [19.5 kB]

Get:26 http://us.archive.ubuntu.com precise-updates/universe i386
Packages [375 kB]

Get:27 http://us.archive.ubuntu.com precise-updates/multiverse i386
Packages [19.6 kB]

Get:28 http://us.archive.ubuntu.com precise-backports/main Sources [6,057 B]

Get:29 http://us.archive.ubuntu.com precise-backports/restricted Sources [40 B]

Get:30 http://us.archive.ubuntu.com precise-backports/universe Sources [52.3 kB]

Get:31 http://us.archive.ubuntu.com precise-backports/multiverse
Sources [5,886 B]

Get:32 http://us.archive.ubuntu.com precise-backports/main amd64
Packages [6,727 B]

Get:33 http://us.archive.ubuntu.com precise-backports/restricted amd64
Packages [40 B]

Get:34 http://us.archive.ubuntu.com precise-backports/universe amd64
Packages [57.6 kB]

Get:35 http://us.archive.ubuntu.com precise-backports/multiverse amd64
Packages [5,459 B]

Get:36 http://us.archive.ubuntu.com precise-backports/main i386
Packages [6,719 B]

Get:37 http://us.archive.ubuntu.com precise-backports/restricted i386
Packages [40 B]

Get:38 http://us.archive.ubuntu.com precise-backports/universe i386
Packages [57.4 kB]

Get:39 http://us.archive.ubuntu.com precise-backports/multiverse i386
Packages [5,437 B]

Get:40 http://security.ubuntu.com precise-security Release [55.5 kB]

Get:41 http://ppa.launchpad.net precise Release [12.9 kB]

Get:42 http://ppa.launchpad.net precise Release [12.9 kB]

Get:43 http://apt.postgresql.org precise-pgdg Release [40.1 kB]

Get:44 http://ppa.launchpad.net precise Release [13.0 kB]

Hit http://ppa.launchpad.net precise/main amd64 Packages

Hit http://ppa.launchpad.net precise/main i386 Packages

Hit http://ppa.launchpad.net precise/main amd64 Packages

Hit http://ppa.launchpad.net precise/main i386 Packages

Get:45 http://ppa.launchpad.net precise/main amd64 Packages [612 B]

Get:46 http://ppa.launchpad.net precise/main i386 Packages [612 B]

Get:47 http://ppa.launchpad.net precise/main amd64 Packages [832 B]

Get:48 http://ppa.launchpad.net precise/main i386 Packages [828 B]

Get:49 http://ppa.launchpad.net precise/main amd64 Packages [33.7 kB]

Get:50 http://security.ubuntu.com precise-security/main Sources [183 kB]

Get:51 http://apt.postgresql.org precise-pgdg/main amd64 Packages [115 kB]

Get:52 http://ppa.launchpad.net precise/main i386 Packages [33.7 kB]

Get:53 http://ppa.launchpad.net precise/main amd64 Packages [3,110 B]

Get:54 http://ppa.launchpad.net precise/main i386 Packages [3,110 B]

Get:55 http://security.ubuntu.com precise-security/restricted Sources [4,548 B]

Get:56 http://security.ubuntu.com precise-security/universe Sources [63.2 kB]

Get:57 http://security.ubuntu.com precise-security/multiverse Sources [2,902 B]

Get:58 http://security.ubuntu.com precise-security/main amd64 Packages [834 kB]

Get:59 http://apt.postgresql.org precise-pgdg/main i386 Packages [115 kB]

Get:60 http://security.ubuntu.com precise-security/restricted amd64
Packages [13.8 kB]

Get:61 http://security.ubuntu.com precise-security/universe amd64
Packages [179 kB]

Get:62 http://security.ubuntu.com precise-security/multiverse amd64
Packages [3,215 B]

Get:63 http://security.ubuntu.com precise-security/main i386 Packages [923 kB]

Get:64 http://security.ubuntu.com precise-security/restricted i386
Packages [13.8 kB]

Get:65 http://security.ubuntu.com precise-security/universe i386
Packages [188 kB]

Get:66 http://security.ubuntu.com precise-security/multiverse i386
Packages [3,374 B]

Fetched 7,621 kB in 4s (1,798 kB/s)

Reading package lists...

Hit http://downloads-distro.mongodb.org dist Release.gpg

Hit http://downloads-distro.mongodb.org dist Release

Hit http://downloads-distro.mongodb.org dist/10gen amd64 Packages

Hit http://us.archive.ubuntu.com precise Release.gpg

Hit http://us.archive.ubuntu.com precise-updates Release.gpg

Hit http://us.archive.ubuntu.com precise-backports Release.gpg

Hit http://downloads-distro.mongodb.org dist/10gen i386 Packages

Hit http://security.ubuntu.com precise-security Release.gpg

Hit http://us.archive.ubuntu.com precise Release

Hit http://us.archive.ubuntu.com precise-updates Release

Hit http://security.ubuntu.com precise-security Release

Hit http://us.archive.ubuntu.com precise-backports Release

Hit http://us.archive.ubuntu.com precise/main Sources

Hit http://us.archive.ubuntu.com precise/restricted Sources

Hit http://us.archive.ubuntu.com precise/universe Sources

Hit http://us.archive.ubuntu.com precise/multiverse Sources

Hit http://us.archive.ubuntu.com precise/main amd64 Packages

Hit http://us.archive.ubuntu.com precise/restricted amd64 Packages

Hit http://us.archive.ubuntu.com precise/universe amd64 Packages

Hit http://us.archive.ubuntu.com precise/multiverse amd64 Packages

Hit http://us.archive.ubuntu.com precise/main i386 Packages

Hit http://us.archive.ubuntu.com precise/restricted i386 Packages

Hit http://us.archive.ubuntu.com precise/universe i386 Packages

Hit http://us.archive.ubuntu.com precise/multiverse i386 Packages

Hit http://us.archive.ubuntu.com precise-updates/main Sources

Hit http://us.archive.ubuntu.com precise-updates/restricted Sources

Hit http://us.archive.ubuntu.com precise-updates/universe Sources

Hit http://us.archive.ubuntu.com precise-updates/multiverse Sources

Hit http://security.ubuntu.com precise-security/main Sources

Hit http://us.archive.ubuntu.com precise-updates/main amd64 Packages

Hit http://us.archive.ubuntu.com precise-updates/restricted amd64 Packages

Hit http://us.archive.ubuntu.com precise-updates/universe amd64 Packages

Hit http://us.archive.ubuntu.com precise-updates/multiverse amd64 Packages

Hit http://security.ubuntu.com precise-security/restricted Sources

Hit http://security.ubuntu.com precise-security/universe Sources

Hit http://security.ubuntu.com precise-security/multiverse Sources

Hit http://security.ubuntu.com precise-security/main amd64 Packages

Hit http://security.ubuntu.com precise-security/restricted amd64 Packages

Hit http://security.ubuntu.com precise-security/universe amd64 Packages

Hit http://security.ubuntu.com precise-security/multiverse amd64 Packages

Hit http://security.ubuntu.com precise-security/main i386 Packages

Hit http://security.ubuntu.com precise-security/restricted i386 Packages

Hit http://security.ubuntu.com precise-security/universe i386 Packages

Hit http://us.archive.ubuntu.com precise-updates/main i386 Packages

Hit http://us.archive.ubuntu.com precise-updates/restricted i386 Packages

Hit http://us.archive.ubuntu.com precise-updates/universe i386 Packages

Hit http://us.archive.ubuntu.com precise-updates/multiverse i386 Packages

Hit http://us.archive.ubuntu.com precise-backports/main Sources

Hit http://us.archive.ubuntu.com precise-backports/restricted Sources

Hit http://security.ubuntu.com precise-security/multiverse i386 Packages

Hit http://us.archive.ubuntu.com precise-backports/universe Sources

Hit http://us.archive.ubuntu.com precise-backports/multiverse Sources

Hit http://us.archive.ubuntu.com precise-backports/main amd64 Packages

Hit http://us.archive.ubuntu.com precise-backports/restricted amd64 Packages

Hit http://apt.postgresql.org precise-pgdg Release.gpg

Hit http://us.archive.ubuntu.com precise-backports/universe amd64 Packages

Hit http://us.archive.ubuntu.com precise-backports/multiverse amd64 Packages

Hit http://us.archive.ubuntu.com precise-backports/main i386 Packages

Hit http://us.archive.ubuntu.com precise-backports/restricted i386 Packages

Hit http://us.archive.ubuntu.com precise-backports/universe i386 Packages

Hit http://us.archive.ubuntu.com precise-backports/multiverse i386 Packages

Hit http://ppa.launchpad.net precise Release.gpg

Hit http://ppa.launchpad.net precise Release.gpg

Hit http://ppa.launchpad.net precise Release.gpg

Hit http://ppa.launchpad.net precise Release.gpg

Hit http://ppa.launchpad.net precise Release.gpg

Hit http://ppa.launchpad.net precise Release.gpg

Hit http://ppa.launchpad.net precise Release

Hit http://ppa.launchpad.net precise Release

Hit http://ppa.launchpad.net precise Release

Hit http://ppa.launchpad.net precise Release

Hit http://apt.postgresql.org precise-pgdg Release

Hit http://ppa.launchpad.net precise Release

Hit http://apt.postgresql.org precise-pgdg/main amd64 Packages

Hit http://ppa.launchpad.net precise Release

Hit http://ppa.launchpad.net precise/main amd64 Packages

Hit http://ppa.launchpad.net precise/main i386 Packages

Hit http://ppa.launchpad.net precise/main amd64 Packages

Hit http://ppa.launchpad.net precise/main i386 Packages

Hit http://ppa.launchpad.net precise/main amd64 Packages

Hit http://apt.postgresql.org precise-pgdg/main i386 Packages

Hit http://ppa.launchpad.net precise/main i386 Packages

Hit http://ppa.launchpad.net precise/main amd64 Packages

Hit http://ppa.launchpad.net precise/main i386 Packages

Hit http://ppa.launchpad.net precise/main amd64 Packages

Hit http://ppa.launchpad.net precise/main i386 Packages

Hit http://ppa.launchpad.net precise/main amd64 Packages

Hit http://ppa.launchpad.net precise/main i386 Packages

Reading package lists...

The command "sudo -E apt-get -yq --no-install-suggests
--no-install-recommends --force-yes install oracle-java8-installer"
failed and exited with 100 during .

Your build has been stopped.




2016-11-10 4:10 GMT+08:00 Krzysztof Kowalczyk <kowalczyk.krzysztof@gmail.com
>:

> done: https://issues.apache.org/jira/browse/GROOVY-7995
>
> On 9 November 2016 at 18:46, Jochen Theodorou <bl...@gmx.org> wrote:
>
>> absolutely a bug, please fill a ticket for it
>>
>> On 09.11.2016 13:20, Krzysztof Kowalczyk wrote:
>>
>>> Hi,
>>> So I run into a gotcha today:
>>>
>>> ​import groovy.transform.CompileStatic
>>>
>>> @CompileStatic
>>> class Foo {
>>>      Closure c = { println "right closure" }
>>>      Closure wrap = {
>>>          println "wrapping closure"
>>>          c() // stack overflow invoke wrap() instead of c()
>>>      }
>>>
>>>      def run(){
>>>          wrap()
>>>      }
>>> }
>>>
>>> new Foo().run()​
>>>
>>> So this example throws stack overflow exception if CompileStatic is used.
>>> It would run correctly with c.call() or without CompileStatic.
>>>
>>> Bug? Did found some things with stack overflow in Jira but nothing that
>>> looked the same.
>>>
>>> Regards,
>>> Krzysztof
>>> ------------------------------------------------------------------------
>>> View this message in context: Bug with closure() and compile static ?
>>> <http://groovy.329449.n5.nabble.com/Bug-with-closure-and-com
>>> pile-static-tp5736592.html>
>>> Sent from the Groovy Users mailing list archive
>>> <http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html> at
>>> Nabble.com.
>>>
>>
>>
>

Re: Bug with closure() and compile static ?

Posted by Krzysztof Kowalczyk <ko...@gmail.com>.
done: https://issues.apache.org/jira/browse/GROOVY-7995

On 9 November 2016 at 18:46, Jochen Theodorou <bl...@gmx.org> wrote:

> absolutely a bug, please fill a ticket for it
>
> On 09.11.2016 13:20, Krzysztof Kowalczyk wrote:
>
>> Hi,
>> So I run into a gotcha today:
>>
>> ​import groovy.transform.CompileStatic
>>
>> @CompileStatic
>> class Foo {
>>      Closure c = { println "right closure" }
>>      Closure wrap = {
>>          println "wrapping closure"
>>          c() // stack overflow invoke wrap() instead of c()
>>      }
>>
>>      def run(){
>>          wrap()
>>      }
>> }
>>
>> new Foo().run()​
>>
>> So this example throws stack overflow exception if CompileStatic is used.
>> It would run correctly with c.call() or without CompileStatic.
>>
>> Bug? Did found some things with stack overflow in Jira but nothing that
>> looked the same.
>>
>> Regards,
>> Krzysztof
>> ------------------------------------------------------------------------
>> View this message in context: Bug with closure() and compile static ?
>> <http://groovy.329449.n5.nabble.com/Bug-with-closure-and-
>> compile-static-tp5736592.html>
>> Sent from the Groovy Users mailing list archive
>> <http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html> at
>> Nabble.com.
>>
>
>

Re: Bug with closure() and compile static ?

Posted by Jochen Theodorou <bl...@gmx.org>.
absolutely a bug, please fill a ticket for it

On 09.11.2016 13:20, Krzysztof Kowalczyk wrote:
> Hi,
> So I run into a gotcha today:
>
> \u200bimport groovy.transform.CompileStatic
>
> @CompileStatic
> class Foo {
>      Closure c = { println "right closure" }
>      Closure wrap = {
>          println "wrapping closure"
>          c() // stack overflow invoke wrap() instead of c()
>      }
>
>      def run(){
>          wrap()
>      }
> }
>
> new Foo().run()\u200b
>
> So this example throws stack overflow exception if CompileStatic is used.
> It would run correctly with c.call() or without CompileStatic.
>
> Bug? Did found some things with stack overflow in Jira but nothing that
> looked the same.
>
> Regards,
> Krzysztof
> ------------------------------------------------------------------------
> View this message in context: Bug with closure() and compile static ?
> <http://groovy.329449.n5.nabble.com/Bug-with-closure-and-compile-static-tp5736592.html>
> Sent from the Groovy Users mailing list archive
> <http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html> at
> Nabble.com.