Re: Test statistics concurrent modification exception
I've opened bug 1808854 and made a speculative fix
(http://grinder.svn.sourceforge.net/viewvc/grinder?view=rev&revision=3526).
Please try the attached patch and let me know whether it works for you.
Just add the jar file to your CLASSPATH before grinder.jar.
Thanks,
- Phil
sys@... wrote:
> Hi,
>
> I'm getting ConcurrentModificationException on the statistics map for
> large (> ~20) thread counts; at almost every run when the thread count
> is 100.
>
> I'm testing on a single host, 1 grinder process, 1 run, 1 script
> (below). Grinder version 3.0-beta33. Java version 1.6.0_02, Win32
> (Windows XP SP2).
>
> What's the best way to fix this? :)
>
> Best regards,
> /Oshadi
>
> Here's the stack (the "Request succeeded" messages are emitted by the
> test script):
>
> 04.10.07 14:53:56 (thread 3 run 0 test 30): Request succeeded
> 04.10.07 14:53:56 (thread 7 run 0 test 35): Request succeeded
> Exception in thread "Timer-0" java.util.ConcurrentModificationException
> at java.util.TreeMap$PrivateEntryIterator.nextEntry(Unknown
> Source)
> at java.util.TreeMap$EntryIterator.next(Unknown Source)
> at java.util.TreeMap$EntryIterator.next(Unknown Source)
> at
> net.grinder.statistics.TestStatisticsMap$Iterator.next(TestStatisticsMap.java:390)
> at
> net.grinder.statistics.TestStatisticsMap$ForEach.iterate(TestStatisticsMap.java:442)
> at
> net.grinder.statistics.TestStatisticsMap.reset(TestStatisticsMap.java:151)
> at
> net.grinder.engine.process.GrinderProcess$ReportToConsoleTimerTask.run(GrinderProcess.java:385)
> at java.util.TimerThread.mainLoop(Unknown Source)
> at java.util.TimerThread.run(Unknown Source)
> 04.10.07 14:53:56 (thread 2 run 0 test 22): Request succeeded
> 04.10.07 14:53:56 (process 425-6000-0): finished
>
>
> And here's the script:
>
> from projectname import mk_request
> from net.grinder.script.Grinder import grinder
> from net.grinder.script import Test
> from net.grinder.plugin.http import HTTPRequest
> from net.grinder.common import GrinderException
>
> log = grinder.logger.output
> stdout = grinder.logger.TERMINAL
> logfile = grinder.logger.LOG
> fngen = grinder.filenameFactory
>
> HOST = "http://localhost:8080"
> SERVICE = "/path/to/servlet/in/TomCat"
> REQUEST_NO = 1
>
> #
> # Input: a python dictionary and perhaps a URL
> # Output: The response from the server, a JSON structure as a string
> #
> def run_request(json, service=HOST+SERVICE):
> global REQUEST_NO
>
> testid = "m=%s,c=%s,s=%s,c2=%s" %
> (json['hdr']['m'], \
> json['hdr']['c'], \
> json['hdr']['s'], \
> json['hdr']['c2'])
> thistest = Test(REQUEST_NO, testid)
> log(str(json), logfile)
> httprequest = thistest.wrap(HTTPRequest())
> httpresp = httprequest.POST(service, str(json))
> log(httpresp.getText(), logfile)
>
> REQUEST_NO += 1
> return httpresp.getText()
>
>
> def assert_resp(json_str, tocheck):
> if json_str.find(tocheck) == -1:
> return 0
> return 1
>
> #
> # run a request, and an assertion on the response too
> # returns success==1/failure==0
> #
> def assert_request(json, check, service=HOST+SERVICE):
> json_resp = run_request(json, service)
> status = assert_resp(json_resp, check)
> if not status:
> log("Request FAILED", logfile)
> log("Request FAILED", stdout)
> else:
> log("Request succeeded", stdout)
> return status
>
> #
> # __call__
> #
> def run_test():
> run_request(mk_request(m='start'))
> assert_request(mk_request(m='buy', \
> p='0000000000003', \
> p2='000000003'), "BUYBUYBUY")
> assert_request(mk_request(m='pay', p='666',
> p2='000000003', \
> t='200'), "PAYPAYPAY")
>
> def TestRunner():
> return run_test
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> grinder-use mailing list
> grinder-use@...
> https://lists.sourceforge.net/lists/listinfo/grinder-use
>
Notice: This email message, together with any attachments, may contain information of BEA Systems, Inc.,
its subsidiaries and affiliated entities, that may be confidential, proprietary, copyrighted and/or
legally privileged, and is intended solely for the use of the individual or entity named in this message.
If you are not the intended recipient, and have received this message in error, please immediately return
this by email and then delete it.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
grinder-use mailing list
grinder-use@...
https://lists.sourceforge.net/lists/listinfo/grinder-use