Simulation.log is empty resulting in Exception

Hi,

I am running gatling locally and for some reason, the simulation log is empty resulting in Exception Below:

Exception in thread "main" java.lang.UnsupportedOperationException: Files List(/Users/cluu/dev/execution-engine-qa/gatling/target/gatling/test-20221004190816728/simulation.log) don't contain any valid run record

Gatling version: 3.8.4
Java version: 1.8

Any suggestion is greatly appreciated.

Any error in the console while running the test?
Does your scenario really contains some requests?

There was no error when running the test. There are plenty of requests in my test
`---- Requests ------------------------------------------------------------------

Global (OK=23 KO=0 )
getToken (OK=1 KO=0 )
Post a model (OK=1 KO=0 )
Post prediction (OK=1 KO=0 )
Status_1_PENDING (OK=1 KO=0 )
Status_1_INPROGRESS (OK=19 KO=0 )`

This is the log before the error

Parsing log file(s)... 15:29:05.880 [INFO ] i.g.c.s.LogFileReader$ - Collected List(/Users/cluu/dev/execution-engine-qa/gatling/target/gatling/feepostpredictiondifferentmodel-20221004202840251/simulation.log) from feepostpredictiondifferentmodel-20221004202840251 15:29:05.896 [INFO ] i.g.c.s.LogFileReader - First pass 15:29:05.900 [INFO ] i.g.c.s.LogFileReader - First pass done: read 0 lines

It seems that I have to run the IDE as root in order to avoid the error. I’m using IntelliJ. This is the first time I encounter such issue. Do you have any idea why it is so?

It seems that I have to run the IDE as root in order to avoid the error.

I’d say that you’ve messed up the file permissions on your filesystem and that only root can write in the target directory.

Hi @cluu12 (any relations with NiNoKuni?),

By chance, did you launch Gatling with root before? or did you install it as root?
Ensure that all directories are reachable by your user.

ie:

chown <youruser>: -R <path/to/your/gatling/project>

Obviously, you need to replace:

  • <youruser> by your “normal” user
  • <path/to/your/gatling/project> by the path to your root directory of your gatling project.

Hope this helps!
Cheers!

It still doesn’t make sense that I can build as my user and cannot run the test. I assume that if I can create a build and the test results are recorded within the build structure, it should be fine right?
I’ll try to recreate to see if it will fix the issue.

@sbrevet, I’m not related to NiNoKuni :slight_smile:

Thank you both for your comments @slandelle and @sbrevet. I greatly appreciate it!

To try to make sense:

target, and its subdirectories classes, resources, etc. may be writable to your “normal” user.
But not the subdirectory where gatling write/read the logs (ie: /Users/cluu/dev/execution-engine-qa/gatling/target/gatling)

Cheers!

Thanks for the clarification. I guess I should not have to do anything special in order to run the test. This is the first time I encounter such issue.

This is a Linux/MacOS user issue, not a Gatling one.
You’ve either run a chown or chmod that broke the existing permission or run Gatling under the root at some point, which created some directories and files your regular user can’t access.

I believe I have found the cause for the error. It seems that if I use loop in my test, in this case it’s asLongAs loop, the encounter the issue. If I remove the loop, the report gets generated normally.

With the additional information, would that help with identifying the cause of the issue? I makes no sense for the behavior to be related to permission if I a report can be generated without using loop.

If so, please provide a SSCCE as explained in How to ask a question.

Hi all,

Since this the only thread that I could find regarding this simulation.log issue, I will be posting my questions here. I have also searched through the GitHub issues but to avail.

My issue is that Gatling is inconsistent in writing to the simulation.log. By running the same test multiple times, Gatling would sometimes write to the simulation.log and sometimes doesn’t. Hence, I could not reproduce the bug consistently.

The test basically send GET requests to a SOAP API and that’s about it. Unfortunately, I could not provide the code since it is my company’s code. The logs are showing that the requests are successfully sent and response received but for most of the time, the simulation.log is empty.

May I know which part of the gatling code are used for recording response time and writing to the log file so that I could look more into it?

OpenJDK version: 11.0
Gatling version 4.3.7
Maven version: 3.9.2
MacOS version: 13.4.1

================================================================================
2023-07-13 11:25:45                                          10s elapsed
---- Requests ------------------------------------------------------------------
> Global                                                   (OK=2      KO=0     )
> getSession                                               (OK=2      KO=0     )

-----fetchTest --------------------------------------------------------------
[##########################################################################]100%
          waiting: 0      / active: 0      / done: 2     
================================================================================

Simulation gatling.PerfSimulation completed in 10 secondsParsing log file(s)...
java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at io.gatling.plugin.util.ForkMain.runMain(ForkMain.java:67)
        at io.gatling.plugin.util.ForkMain.main(ForkMain.java:35)
Caused by: java.lang.UnsupportedOperationException: Files List(Path/to/target/gatling/perfsimulation-20230713152533410/simulation.log) don't contain any valid run record
        at io.gatling.charts.stats.LogFileReader.$anonfun$firstPass$2(LogFileReader.scala:142)
        at scala.Option.getOrElse(Option.scala:201)
        at io.gatling.charts.stats.LogFileReader.firstPass(LogFileReader.scala:142)
        at io.gatling.charts.stats.LogFileReader.$anonfun$read$1(LogFileReader.scala:58)
        at io.gatling.charts.stats.LogFileReader.parseInputFiles(LogFileReader.scala:79)
        at io.gatling.charts.stats.LogFileReader.read(LogFileReader.scala:58)
        at io.gatling.app.RunResultProcessor.initLogFileData(RunResultProcessor.scala:50)
        at io.gatling.app.RunResultProcessor.processRunResult(RunResultProcessor.scala:32)
        at io.gatling.app.Gatling$.start(Gatling.scala:99)
        at io.gatling.app.Gatling$.fromArgs(Gatling.scala:51)
        at io.gatling.app.Gatling$.main(Gatling.scala:39)
        at io.gatling.app.Gatling.main(Gatling.scala)
        ... 6 more

First, please upgrade to the latest version.
Then, please check if you don’t have 100% build failures on your requests.

Honestly, the issue is very likely to be on your side.

First, please upgrade to the latest version

Correct me if I am wrong, but I believe 4.3.7 is the latest version for gatling-maven-plugin.

please check if you don’t have 100% build failures on your requests.

I have went through the log files and verified that there are no issues with the requests. I identified that this simulation.log issue only occur when making requests for this endpoint. It struck me as odd that every request and response are perfectly logged in a different log file but then nothing for simulation.log.

14:01:15.851 [gatling-1-3] TRACE i.g.h.e.r.DefaultStatsProcessor - 
>>>>>>>>>>>>>>>>>>>>>>>>>>
Request:
getSession: OK 
=========================
Session:
Session(fetchTest,2,HashMap(VALUES FROM JSON FILE))
=========================
HTTP request:
GET SOME_ENDPOINT
headers:
	user_id: SOME_ID
	user_key: SOME_KEY
	accept: */*
	host: SOME_HOST
=========================
HTTP response:
status:
	200 OK
headers:
	Content-Type: application/json; charset=UTF-8
	Date: Thu, 13 Jul 2023 18:01:15 GMT
	Server: nginx
	Content-Length: 1672
	Connection: keep-alive

body:
{
 [REMOVED]
}

Exactly, this version is unrelated to the Gatling version that I advised you to upgrade.

There’s no way to help you unless you provide a proper reproducer.

What version of Gatling you use?
As I remember I raise a Issue about similar case as you mentioned, but that was for 3.8.3 version…

I think my issue lies at a missing dependency within my pom.xml file since I am using maven. For context, I am writing my testcases using Karate and performance testing with Karate-Gatling. I initially left out the dependency below in my pom.xml because it was not outlined in the framework’s setup process.

    <dependency>
      <groupId>io.gatling.highcharts</groupId>
      <artifactId>gatling-charts-highcharts</artifactId>
      <version>3.9.5</version>
      <scope>test</scope>
    </dependency>

Once I included it, everything seems to be functional. I believe Karate-Gatling is possibly using an older version of gatling where such an issue still persist.

Thank you all for the response.

Ok, so your issue has absolutely nothing to do with genuine Gatling. Karate merely rides on our scheduler and reports but everything else is not Gatling components. In particular, performance is way lower.
For anything related to karate, please ask on StackOverflow not here.
But I would really recommend moving to genuine Gatling for load testing.

1 Like