spark

spark

95M Downloads

Unable to start/cancel a profiler task

freaky767 opened this issue · 2 comments

commented
> spark profiler
[18:33:09 INFO]: [⚡] An active profiler is already running.
> spark profiler --cancel
[18:33:12 WARN]: Exception in thread "Craft Scheduler Thread - 91"
[18:33:12 WARN]: org.apache.commons.lang.UnhandledException: Plugin spark v1.8.12 generated an exception while executing task 292594
        at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:57)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.IllegalStateException: Profiler is not active
        at me.lucko.spark.lib.asyncprofiler.AsyncProfiler.$$YJP$$stop0(Native Method)
        at me.lucko.spark.lib.asyncprofiler.AsyncProfiler.stop0(AsyncProfiler.java)
        at me.lucko.spark.lib.asyncprofiler.AsyncProfiler.stop(AsyncProfiler.java:90)
        at me.lucko.spark.common.sampler.async.AsyncSampler.stop(AsyncSampler.java:148)
        at me.lucko.spark.common.command.modules.SamplerModule.close(SamplerModule.java:77)
        at me.lucko.spark.common.command.modules.SamplerModule.profilerCancel(SamplerModule.java:286)
        at me.lucko.spark.common.command.modules.SamplerModule.profiler(SamplerModule.java:131)
        at me.lucko.spark.common.SparkPlatform.executeCommand0(SparkPlatform.java:387)
        at me.lucko.spark.common.SparkPlatform.lambda$executeCommand$2(SparkPlatform.java:300)
        at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftTask.run(CraftTask.java:54)
        at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:53)
        ... 3 more

>
commented
[19:58:23 INFO]: [] issued server command: /spark sampler --thread pool-2-thread-1 --timeout 30
[19:58:23 INFO]: [⚡] Initializing a new profiler, please wait...
> [WARN] Install JVM debug symbols to improve profile accuracy
[19:58:23 INFO]: [⚡] Profiler now active! (async)
[19:58:23 INFO]: [⚡] The results will be automatically returned after the profiler has been running for 30 seconds.
[19:58:28 INFO]: [⚡] The active profiler has completed! Uploading results...
[19:58:29 INFO]: [⚡] Profiler results:
[19:58:29 INFO]: https://spark.lucko.me/XXXXXXX

This error only occurs if you start a profiler with a timeout, canceling the profiler, and then starting another profiler task with a timeout. As you can see from the log file, it only returned results after ~ 6 seconds (which is not meant to happen), if you then try starting another profiler:

> spark profiler
[20:01:28 INFO]: [⚡] An active profiler is already running.
> spark profiler --stop
[20:01:30 WARN]: Exception in thread "Craft Scheduler Thread - 19"
[20:01:30 WARN]: org.apache.commons.lang.UnhandledException: Plugin spark v1.8.12 generated an exception while executing task 22808
        at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:57)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.IllegalStateException: Profiler is not active
        at me.lucko.spark.lib.asyncprofiler.AsyncProfiler.$$YJP$$stop0(Native Method)
        at me.lucko.spark.lib.asyncprofiler.AsyncProfiler.stop0(AsyncProfiler.java)
        at me.lucko.spark.lib.asyncprofiler.AsyncProfiler.stop(AsyncProfiler.java:90)
        at me.lucko.spark.common.sampler.async.AsyncSampler.stop(AsyncSampler.java:148)
        at me.lucko.spark.common.command.modules.SamplerModule.profilerStop(SamplerModule.java:295)
        at me.lucko.spark.common.command.modules.SamplerModule.profiler(SamplerModule.java:136)
        at me.lucko.spark.common.SparkPlatform.executeCommand0(SparkPlatform.java:387)
        at me.lucko.spark.common.SparkPlatform.lambda$executeCommand$2(SparkPlatform.java:300)
        at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftTask.run(CraftTask.java:54)
        at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:53)
        ... 3 more
commented

Thanks, should be fixed ^ :)