anshooarora / extentreports-java

Community version of Extent API for Java has moved to https://github.com/extent-framework/
http://extentreports.com
Other
528 stars 318 forks source link

java.util.ConcurrentModificationException: null #769

Open anand853 opened 7 years ago

anand853 commented 7 years ago

Hi, I hit java.util.ConcurrentModificationException: null when im using extentreport with Maven and testNG

testng:config

version: org.testng testng 6.10 -- com.relevantcodes extentreports 2.41.1 -- org.uncommons reportng 1.1.4 test org.testng testng Tests run: 331, Failures: 5, Errors: 0, Skipped: 0, Time elapsed: 1,082.119 sec <<< FAILURE! test62(test.com.t.test.com.t.AppRoombaHelpTest) Time elapsed: 0.01 sec <<< FAILURE! java.util.ConcurrentModificationException: null at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:901) at java.util.ArrayList$Itr.next(ArrayList.java:851) at com.relevantcodes.extentreports.model.Test.trackLastRunStatus(Test.java:389) at com.relevantcodes.extentreports.ExtentTest.log(ExtentTest.java:101) at com.relevantcodes.extentreports.ExtentTest.log(ExtentTest.java:180) at test.com.t.sitecores.aa(sitecores.java:1475) at test.com.t.test.com.t.AppRoombaHelpTest.test62(AppRoombaHelpTest.java:610) test73(test.com.t.test.com.t.ba) Time elapsed: 0 sec <<< FAILURE! java.util.ConcurrentModificationException: null at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:901) at java.util.ArrayList$Itr.next(ArrayList.java:851) at com.relevantcodes.extentreports.model.Test.trackLastRunStatus(Test.java:389) at com.relevantcodes.extentreports.ExtentTest.log(ExtentTest.java:101) at com.relevantcodes.extentreports.ExtentTest.log(ExtentTest.java:180) at test.com.t.test.com.t.ba.test73(ba.java:604) test77(test.com.t.test.com.t.ba) Time elapsed: 0.169 sec <<< FAILURE! org.json.JSONException: A JSONObject text must begin with '{' at 1 [character 2 line 1] at org.json.JSONTokener.syntaxError(JSONTokener.java:451) at org.json.JSONObject.(JSONObject.java:195) at org.json.JSONObject.(JSONObject.java:319) at test.com.t.sitecores.curlBraavaTermsBase(sitecores.java:1222) at test.com.t.sitecores.curlBraavaTerms(sitecores.java:1187) at test.com.t.test.com.t.ba.test77(ba.java:632) test76(test.com.t.test.com.t.ba) Time elapsed: 0.17 sec <<< FAILURE! java.lang.NullPointerException: null at com.relevantcodes.extentreports.model.Test.trackLastRunStatus(Test.java:390) at com.relevantcodes.extentreports.ExtentTest.log(ExtentTest.java:101) at com.relevantcodes.extentreports.ExtentTest.log(ExtentTest.java:180) at test.com.t.sitecores.curlBraavaTerms(sitecores.java:1188) at test.com.t.test.com.t.ba.test76(ba.java:626) test66(test.com.t.test.com.t.ba) Time elapsed: 0.17 sec <<< FAILURE! java.lang.NullPointerException: null at com.relevantcodes.extentreports.model.Test.trackLastRunStatus(Test.java:390) at com.relevantcodes.extentreports.ExtentTest.log(ExtentTest.java:101) at com.relevantcodes.extentreports.ExtentTest.log(ExtentTest.java:180) at test.com.t.sitecores.curlBraavaTerms(sitecores.java:1188) at test.com.t.test.com.t.ba.test66(ba.java:549) Results : Failed tests: AaaTest.test62:610 » ConcurrentModification ba.test73:604 » ConcurrentModification ba.test77:632 » JSON A JSONObject text must begin with '{' at ... ba.test76:626 » NullPointer ba.test66:549 » NullPointer Tests run: 331, Failures: 5, Errors: 0, Skipped: 0 [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 18:04 min [INFO] Finished at: 2017-02-09T09:45:25-05:00 [INFO] Final Memory: 20M/316M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.14.1:test (default-test) on project c: There are test failures. [ERROR] [ERROR] Please refer to /validation/target/surefire-reports for the individual test results. [ERROR] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
anshooarora commented 7 years ago

Can you create a gist so I can try to repro and fix this?

anand853 commented 7 years ago

https://gist.github.com/anand853/2643750d3b88345ff4c6195cfac31e57

anshooarora commented 7 years ago

I don't see any code in the gist.. how would I reproduce? can you share a sample project with me? How are you starting ExtentReports and creating tests?

anand853 commented 7 years ago

i cant share the code outside. can we please set some time and debug on this?

virenv commented 7 years ago

@anand853 what should we debug? we need the code that you have written to debug in the first place. I would suggest you create a sample project where you try to simulate the kind of parallel infrastructure that is causing the problem.

Meanwhile you prepare a small test suite reproducing the problem. Let me take a look at the call stack and see if I can find something.

virenv commented 7 years ago

@anshooarora : The problem is that when trackLastRunStatus method is iterating over the list of status (Contained list of AbstractSturcture class). Some other thread is modifying the list. Which results in this exception. A quick fix could be if we make trackLastRunStatus method synchronized. But the real problem is how can we simulate this situation and is it a valid user scenario? With the lack of complete understanding I am not able to find out if this is a valid scenario or not.

anand853 commented 7 years ago

@anshooarora @virenv can i have your email id? so that i can share the code ?

anshooarora commented 7 years ago

@anand853 - would it be possible to upgrade to version 3?

Bose27 commented 6 years ago

Facing issue in Extent report 3.1.5, Is there any workaround?

[TestNG] Reporter org.testng.reporters.jq.Main@7a30d1e6 failed java.lang.NullPointerException at org.testng.reporters.jq.TimesPanel.maxTime(TimesPanel.java:124) at org.testng.reporters.jq.TimesPanel.getContent(TimesPanel.java:89) at org.testng.reporters.jq.BaseMultiSuitePanel.generate(BaseMultiSuitePanel.java:25) at org.testng.reporters.jq.Main.generateReport(Main.java:74) at org.testng.TestNG.generateReports(TestNG.java:1027) at org.testng.TestNG.run(TestNG.java:970) at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:283) at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:75) at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:120) at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:379) at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:340) at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:125) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:413)

foursyth commented 6 years ago

The stacktrace doesn't point to Extent.. this seems to be stemming from TestNG. Maybe upgrade your TestNG version and try again?

Bose27 commented 6 years ago

I am using TestNG latest Beta(Release 7.0.0.1 beta 1) version inbuilt with Intelli J. Cluess less about this null pointer exception.