apache / jmeter

Apache JMeter open-source load testing tool for analyzing and measuring the performance of a variety of services
https://jmeter.apache.org/
Apache License 2.0
8.3k stars 2.09k forks source link

2x CSV Dataset with same filename concurrently pick lines #4218

Closed asfimport closed 7 years ago

asfimport commented 7 years ago

Jerome (Bug 60563): 1 - When creating several csv variables using the same file an unexpected behavior happens. Let's consider two variables named login1 and login2 using the same file (sharing mode on "all threads"). During the first iteration login1 will use the first line of the file and login2 will use the second line of the file. As if they were two different threads requesting values from this file.

2 - If I setup the same variables with two identical files named differently both variables will use the first line of the csv.

The 2nd behavior seems normal while the 1st one seems like a bug. 2x CSV Datasets are concurrently reading the same file when filename is the same since only a single Reader is shared between them.

When looking at the code, it seems like the filename is used a key for a caching system which keeps the BufferedReader. (FileServer.getReader)

Votes in Bugzilla: 1 Severity: normal OS: Linux Resolution: WORKSFORME

asfimport commented 7 years ago

@pmouawad (migrated from Bugzilla): Hello Jérôme, Can you provide a Test plan showing the problem ?

I am a bit tired and don't understand the description :-)

Thanks

asfimport commented 7 years ago

Jerome (migrated from Bugzilla): Sure, i'll do. The issue is simple:

  1. Setup 2 CSV Dataset pointing to the same file,
  2. Use both variables one time in the script.

Expected: first value of the file for each separate variable. Actual: first value and second value seen.

When looking at the code, it seems obvious since the filename is used as key for a caching system. I'm attaching the JMX.

asfimport commented 7 years ago

Jerome (migrated from Bugzilla): Check JMeter logs. It should display first=1, and second=1.

Created attachment jmx.zip: jmx to reproduce

asfimport commented 7 years ago

@pmouawad (migrated from Bugzilla): Hello Jérôme, This is the desired behaviour. In your case, if you want to do what you describe, just set SharingMode to a different value for each CSV DataSet.

If we change the existing behaviour, it can break a lot of existing test plans. In my particular case for example, I rely on such behaviour.

Feel free to reopen if you disagree and have an idea to have a better behaviour. Regards