java.util.ConcurrentModificationException in StructClear()

Description

Running a simple sample of Testbox code fails with java.util.ConcurrentModificationException in StructClear().

Locking (either scope or name locks) doesn't seem to do anything.

Now - one can argue that this code might be not great, but it works just fine in ACF.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 component displayName="TestBox xUnit suite" extends="testbox.system.BaseSpec" { /*********************************** LIFE CYCLE Methods ***********************************/ function beforeTests(){ } function afterTests(){ } function setup(){ request.foo = 1; } function teardown() { lock name="fdsjifdsfds" timeout="5" { structClear(request); } } /*********************************** Test Methods ***********************************/ function testIncludes(){ $assert.includes( "hello", "HE" ); $assert.includes( [ "Monday", "Tuesday" ] , "monday" ); } function testNotIncludes(){ $assert.notIncludes( "hello", "what" ); $assert.notIncludes( [ "Monday", "Tuesday" ] , "Friday" ); } function testIsNotEmpty(){ $assert.isNotEmpty( [1,2] ); $assert.isNotEmpty( {name="luis"} ); $assert.isNotEmpty( "HelloLuis" ); $assert.isNotEmpty( querySim( "id, name 1 | luis") ); } function testSkipped() skip="true"{ $assert.fail( "This Test should fail" ); } boolean function isRailo(){ return structKeyExists( server, "railo" ); } function testSkippedWithConstraint() skip="isRailo"{ $assert.fail( "This Test should fail" ); } function testAssertShortcut() { assert( application.salvador == 1 ); } function testisTrue() { $assert.isTrue( 1 ); } /*********************************** NON-RUNNABLE Methods ***********************************/ function nonStandardNamesWillNotRun() { fail( "Non-test methods should not run" ); } private function privateMethodsDontRun() { fail( "Private method don't run" ); } }

Stack Trace:

1 lucee.runtime.exp.NativeException: java.util.ConcurrentModificationException at java.util.HashMap$HashIterator.nextNode(HashMap.java:1445) at java.util.HashMap$KeyIterator.next(HashMap.java:1469) at io.undertow.servlet.util.IteratorEnumeration.nextElement(IteratorEnumeration.java:44) at lucee.runtime.type.scope.RequestImpl.clear(RequestImpl.java:153) at lucee.runtime.functions.struct.StructClear.call(StructClear.java:36) at tests.com.zenexmachina.agileiq.calculators.scorestest_cfc$cf.udfCall1(/tests/com/zenexmachina/agileIQ/calculators/scoresTest.cfc:18) at tests.com.zenexmachina.agileiq.calculators.scorestest_cfc$cf.udfCall(/tests/com/zenexmachina/agileIQ/calculators/scoresTest.cfc) at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:106) at lucee.runtime.type.UDFImpl._call(UDFImpl.java:342) at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:205) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:683) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:570) at lucee.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1937) at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:846) at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1726) at system.basespec_cfc$cf.udfCall5(/testbox/system/BaseSpec.cfc:1010) at system.basespec_cfc$cf.udfCall(/testbox/system/BaseSpec.cfc) at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:106) at lucee.runtime.type.UDFImpl._call(UDFImpl.java:342) at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:205) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:683) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:570) at lucee.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1937) at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:846) at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1726) at system.runners.unitrunner_cfc$cf.udfCall(/testbox/system/runners/UnitRunner.cfc:208) at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:106) at lucee.runtime.type.UDFImpl._call(UDFImpl.java:342) at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:205) at lucee.runtime.type.scope.UndefinedImpl.callWithNamedValues(UndefinedImpl.java:778) at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:846) at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1726) at system.runners.unitrunner_cfc$cf.udfCall(/testbox/system/runners/UnitRunner.cfc:81) at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:106) at lucee.runtime.type.UDFImpl._call(UDFImpl.java:342) at lucee.runtime.type.UDFImpl.call(UDFImpl.java:215) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:682) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:570) at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1918) at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:768) at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1707) at system.testbox_cfc$cf.udfCall2(/testbox/system/TestBox.cfc:466) at system.testbox_cfc$cf.udfCall(/testbox/system/TestBox.cfc) at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:106) at lucee.runtime.type.UDFImpl._call(UDFImpl.java:342) at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:205) at lucee.runtime.type.scope.UndefinedImpl.callWithNamedValues(UndefinedImpl.java:778) at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:846) at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1726) at system.testbox_cfc$cf.udfCall1(/testbox/system/TestBox.cfc:243) at system.testbox_cfc$cf.udfCall(/testbox/system/TestBox.cfc) at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:106) at lucee.runtime.type.UDFImpl._call(UDFImpl.java:342) at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:205) at lucee.runtime.type.scope.UndefinedImpl.callWithNamedValues(UndefinedImpl.java:778) at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:846) at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1726) at system.testbox_cfc$cf.udfCall1(/testbox/system/TestBox.cfc:154) at system.testbox_cfc$cf.udfCall(/testbox/system/TestBox.cfc) at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:106) at lucee.runtime.type.UDFImpl._call(UDFImpl.java:342) at lucee.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:205) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:683) at lucee.runtime.ComponentImpl._call(ComponentImpl.java:570) at lucee.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1937) at lucee.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:846) at lucee.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1726) at testbox.test_runner225.index_cfm$cf.call(/testbox/test-runner/index.cfm:23) at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:942) at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:834) at lucee.runtime.listener.ModernAppListener._onRequest(ModernAppListener.java:216) at lucee.runtime.listener.MixedAppListener.onRequest(MixedAppListener.java:42) at lucee.runtime.PageContextImpl.execute(PageContextImpl.java:2409) at lucee.runtime.PageContextImpl._execute(PageContextImpl.java:2399) at lucee.runtime.PageContextImpl.executeCFML(PageContextImpl.java:2374) at lucee.runtime.engine.Request.exe(Request.java:43) at lucee.runtime.engine.CFMLEngineImpl._service(CFMLEngineImpl.java:1037) at lucee.runtime.engine.CFMLEngineImpl.serviceCFML(CFMLEngineImpl.java:983) at lucee.loader.engine.CFMLEngineWrapper.serviceCFML(CFMLEngineWrapper.java:97) at lucee.loader.servlet.CFMLServlet.service(CFMLServlet.java:51) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74) at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129) at org.cfmlprojects.regexpathinfofilter.RegexPathInfoFilter.doFilter(RegexPathInfoFilter.java:47) at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61) at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131) at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176) at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145) at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92) at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:389) at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61) at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.intergral.fusionreactor.j2ee.filterchain.WrappedFilterChain.doFilter(WrappedFilterChain.java:134) at com.intergral.fusionreactor.j2ee.filter.FusionReactorRequestHandler.doNext(FusionReactorRequestHandler.java:764) at com.intergral.fusionreactor.j2ee.filter.FusionReactorRequestHandler.doHttpServletRequest(FusionReactorRequestHandler.java:344) at com.intergral.fusionreactor.j2ee.filter.FusionReactorRequestHandler.doFusionRequest(FusionReactorRequestHandler.java:207) at com.intergral.fusionreactor.j2ee.filter.FusionReactorRequestHandler.handle(FusionReactorRequestHandler.java:801) at com.intergral.fusionreactor.j2ee.filter.FusionReactorCoreFilter.doFilter(FusionReactorCoreFilter.java:36) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.intergral.fusionreactor.j2ee.filterchain.WrappedFilterChain.doFilter(WrappedFilterChain.java:71) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.intergral.fusionreactor.agent.filter.FusionReactorStaticFilter.doFilter(FusionReactorStaticFilter.java:54) at com.intergral.fusionreactor.agent.pointcuts.NewFilterChainPointCut$1.invoke(NewFilterChainPointCut.java:42) at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java) at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84) at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62) at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:64) at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:132) at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46) at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64) at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60) at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77) at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292) at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81) at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138) at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135) at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48) at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43) at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272) at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81) at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104) at io.undertow.server.Connectors.executeRootHandler(Connectors.java:336) at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:830) 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) Caused by: java.util.ConcurrentModificationException ... 142 more

Environment

Linux (Ubuntu 18.04) via Command Box 4.8.0

Same issue also happens in Luce 5.2.9

Status

Assignee

Unassigned

Reporter

Kai Koenig

Labels

None

Affects versions

5.3.2.77

Priority

New
Configure