Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RCA fails in Android project #221

Open
Tracked by #100
alex-iotiq opened this issue Jan 17, 2023 · 1 comment
Open
Tracked by #100

RCA fails in Android project #221

alex-iotiq opened this issue Jan 17, 2023 · 1 comment

Comments

@alex-iotiq
Copy link
Contributor

After successful RTS and measurement steps in Jenkins for the Android example project, RCA fails with this error

java.lang.NullPointerException: Attempt to invoke virtual method 'boolean kieker.monitoring.writer.MonitoringWriterThread.isAlive()' on a null object reference.

Log

com.example.android_example.LogHistoryInstrumentedTest:
Error in logHistory_ParcelableWriteRead(com.example.android_example.LogHistoryInstrumentedTest):
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean kieker.monitoring.writer.MonitoringWriterThread.isAlive()' on a null object reference
	at de.dagere.kopeme.kieker.KoPeMeKiekerSupport.finishMonitoring(KoPeMeKiekerSupport.java:156)
	at de.dagere.kopeme.kieker.KoPeMeKiekerSupport.waitForEnd(KoPeMeKiekerSupport.java:94)
	at de.dagere.kopeme.TimeBoundExecution.finishKieker(TimeBoundExecution.java:89)
	at de.dagere.kopeme.TimeBoundExecution.execute(TimeBoundExecution.java:77)
	at de.dagere.kopeme.junit.rule.KoPeMeRuleStatement4.evaluate(KoPeMeRuleStatement4.java:87)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
	at androidx.test.rule.GrantPermissionRule$RequestPermissionStatement.evaluate(GrantPermissionRule.java:134)
	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
	at androidx.test.ext.junit.runners.AndroidJUnit4.run(AndroidJUnit4.java:162)
	at org.junit.runners.Suite.runChild(Suite.java:128)
	at org.junit.runners.Suite.runChild(Suite.java:27)
	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
	at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:67)
	at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:58)
	at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:438)
	at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2205)


Time: 1.27
There was 1 failure:
1) logHistory_ParcelableWriteRead(com.example.android_example.LogHistoryInstrumentedTest)
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean kieker.monitoring.writer.MonitoringWriterThread.isAlive()' on a null object reference
	at de.dagere.kopeme.kieker.KoPeMeKiekerSupport.finishMonitoring(KoPeMeKiekerSupport.java:156)
	at de.dagere.kopeme.kieker.KoPeMeKiekerSupport.waitForEnd(KoPeMeKiekerSupport.java:94)
	at de.dagere.kopeme.TimeBoundExecution.finishKieker(TimeBoundExecution.java:89)
	at de.dagere.kopeme.TimeBoundExecution.execute(TimeBoundExecution.java:77)
	at de.dagere.kopeme.junit.rule.KoPeMeRuleStatement4.evaluate(KoPeMeRuleStatement4.java:87)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
	at androidx.test.rule.GrantPermissionRule$RequestPermissionStatement.evaluate(GrantPermissionRule.java:134)
	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
	at androidx.test.ext.junit.runners.AndroidJUnit4.run(AndroidJUnit4.java:162)
	at org.junit.runners.Suite.runChild(Suite.java:128)
	at org.junit.runners.Suite.runChild(Suite.java:27)
	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
	at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:67)
	at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:58)
	at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:438)
	at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2205)

FAILURES!!!
Tests run: 1,  Failures: 1
@alex-iotiq
Copy link
Contributor Author

New findings and a possible solution:

// KoPeMe/kopeme-core/src/main/java/de/dagere/kopeme/kieker/KoPeMeKiekerSupport.java:153
final MonitoringWriterThread thread = getMonitoringWriterThread(writerController);

getMonitoringWriterThread probably returns null.

// KoPeMe/kopeme-core/src/main/java/de/dagere/kopeme/kieker/KoPeMeKiekerSupport.java:153
static MonitoringWriterThread getMonitoringWriterThread(final WriterController writerController)
      throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, NoSuchFieldException {
   final Field monitoringWriterThreadField = WriterController.class.getDeclaredField("monitoringWriterThread");
   monitoringWriterThreadField.setAccessible(true);
   final MonitoringWriterThread thread = (MonitoringWriterThread) monitoringWriterThreadField.get(writerController);
   return thread;
}

Handling the Thread.isAlive() null exception returns different error:

System.err: Caused by: java.io.FileNotFoundException: ... /android-example-2_peass/projectTemp/parallel_7cb0b425c837229fbbc8385941c1f231bbcc054c_peass/measurementsTemp/kieker-20230120-142609-553031302952980-UTC--KIEKER-KoPeMe/measurement-0.bin: open failed: ENOENT (No such file or directory)
System.err: 	at libcore.io.IoBridge.open(IoBridge.java:492)
System.err: 	at java.io.FileOutputStream.<init>(FileOutputStream.java:236)
System.err: 	at java.io.FileOutputStream.<init>(FileOutputStream.java:186)
System.err: 	at de.dagere.kopeme.kieker.aggregateddata.FileDataManagerBin.<init>(FileDataManagerBin.java:35)
System.err: 	at de.dagere.kopeme.kieker.writer.AggregatedTreeWriter.<init>(AggregatedTreeWriter.java:64)
System.err: 	... 39 more
...
System.err: Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory)
...

Kieker reads its configuration from META-INF/kieker.monitoring.properties if no JVM arguments are present.

If useAggregation option is true, then AggregatedTreeWriter will be used.

It's possible to write a custom path for kieker results like de.dagere.kopeme.kieker.writer.AggregatedTreeWriter.customStoragePath=/storage/emulated/0/Documents/measurementsTemp inside.

This solution can be applied in AOPXMLHelper.java inside writeKiekerMonitoringProperties.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant