Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 4FE5B200C79 for ; Fri, 19 May 2017 22:15:12 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 4E714160BD1; Fri, 19 May 2017 20:15:12 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 6B3BC160BB0 for ; Fri, 19 May 2017 22:15:11 +0200 (CEST) Received: (qmail 98089 invoked by uid 500); 19 May 2017 20:15:10 -0000 Mailing-List: contact notifications-help@groovy.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@groovy.apache.org Delivered-To: mailing list notifications@groovy.apache.org Received: (qmail 98079 invoked by uid 99); 19 May 2017 20:15:10 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 19 May 2017 20:15:10 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id E07F21804F7 for ; Fri, 19 May 2017 20:15:09 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.202 X-Spam-Level: X-Spam-Status: No, score=-99.202 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id JtCvvPr5Z5wl for ; Fri, 19 May 2017 20:15:08 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id A170C5FDB4 for ; Fri, 19 May 2017 20:15:07 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id BDD99E0D4D for ; Fri, 19 May 2017 20:15:06 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 3F98B21B5C for ; Fri, 19 May 2017 20:15:05 +0000 (UTC) Date: Fri, 19 May 2017 20:15:05 +0000 (UTC) From: "Jochen Theodorou (JIRA)" To: notifications@groovy.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (GROOVY-7535) Groovy category throwing MissingMethodException and MissingPropertyException when using multiple threads MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Fri, 19 May 2017 20:15:12 -0000 [ https://issues.apache.org/jira/browse/GROOVY-7535?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16017957#comment-16017957 ] Jochen Theodorou commented on GROOVY-7535: ------------------------------------------ In that case my suggestion would be to do the synchronization as is, but use int instead of AtomicInteger > Groovy category throwing MissingMethodException and MissingPropertyException when using multiple threads > -------------------------------------------------------------------------------------------------------- > > Key: GROOVY-7535 > URL: https://issues.apache.org/jira/browse/GROOVY-7535 > Project: Groovy > Issue Type: Bug > Affects Versions: 2.3.11, 2.4.4 > Environment: I have been able to reproduce this issue on a Cent O/S version 6.4 with Java 64 Bit JDK 1.8 and groovy 2.4.4. > Reporter: James Oswald > Assignee: Pascal Schumacher > Fix For: 2.4.6 > > Attachments: 0001-GROOVY-7535-fix-race-condition-between-the-modificat.patch, CategoryTest.groovy, exceptionForCategoryTest.txt, exceptionForTimeCategoryTest.txt, locking.png, Test.groovy, TimeCategoryTest.groovy > > > When using groovy use block, we randomly get groovy.lang.MissingPropertyException when trying to access a property off a category. (Attached is an example) > {quote} > index 76 > Exception in thread "Thread-77" groovy.lang.MissingPropertyException: No such property: millisecond for class: java.lang.Integer > at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:51) > at org.codehaus.groovy.runtime.callsite.PojoMetaClassGetPropertySite.callGetProperty(PojoMetaClassGetPropertySite.java:43) > at TimeCategoryTest$__spock_initializeFields_closure1$_closure4$_closure5.doCall(TimeCategoryTest.groovy:23) > at TimeCategoryTest$__spock_initializeFields_closure1$_closure4$_closure5.doCall(TimeCategoryTest.groovy) > at sun.reflect.GeneratedMethodAccessor12.invoke(Unknown Source) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:497) > at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90) > at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324) > at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:292) > at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1016) > at groovy.lang.Closure.call(Closure.java:423) > at groovy.lang.Closure.call(Closure.java:417) > at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:109) > at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.access$400(GroovyCategorySupport.java:65) > at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:249) > at org.codehaus.groovy.runtime.DefaultGroovyMethods.use(DefaultGroovyMethods.java:403) > {quote} > or groovy.lang.MissingMethodException when trying to access a method from a category. > {quote} > index 82 > Exception in thread "Thread-207" groovy.lang.MissingMethodException: No signature of method: java.lang.String.test() is applicable for argument types: (java.lang.String) values: [ bar] > Possible solutions: next(), toSet(), getAt(java.lang.String), wait(). trim(), toList() > at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:56) > at org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:46) > at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:122) > at CategoryTest$__spock_initializeFields_closure1$_closure5.doCall(CategoryTest.groovy:24) > at CategoryTest$__spock_initializeFields_closure1$_closure5.doCall(CategoryTest.groovy) > at sun.reflect.GeneratedMethodAccessor12.invoke(Unknown Source) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:497) > at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90) > at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324) > at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:292) > at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1016) > at groovy.lang.Closure.call(Closure.java:423) > at groovy.lang.Closure.call(Closure.java:417) > at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:109) > at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.access$400(GroovyCategorySupport.java:65) > at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:249) > at org.codehaus.groovy.runtime.DefaultGroovyMethods.use(DefaultGroovyMethods.java:403) > {quote} > On the server, either one of these exceptions to appear every few days or weeks. > I found a similar issue GROOVY-2105 which contains a test that reproduces this problem on Linux. Looking back the fix that was implemented for this ticket was to add synchronized to 3 methods. These changes were late removed in a refactor of GroovyCategorySupport. > I have attached 3 test cases that reproduce the threading issue. > NOTE: problem does not happen 100% of the time as it is a threading and timing issue, so you may have to play with the number of threads to generate the exception. What I have attached generates the exception on my linux box most of the time. -- This message was sent by Atlassian JIRA (v6.3.15#6346)