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.11k stars 2.06k forks source link

Stop Thread if CSV file is not available #2479

Closed asfimport closed 13 years ago

asfimport commented 13 years ago

Luciana Moreira (Bug 51002): It would be very useful if the component CSV Data Set Config would have an option to "Stop Thread if no file available".

Currently I am able to do it via BeanShell and verification of the variables that should be available. However it does not seem to be the right place for it.

CSV Data Set Config already provides the option "Stop Thread on EOF", so I suppose the additional safeguard function should not be too difficult to implement.

Severity: major OS: Linux

asfimport commented 13 years ago

Ralf Hauser (migrated from Bugzilla): the current situation can be quite unpleasant,

If the .csv file is not existing, the "CSV Data Set Config" doesn't instantiate the declared, comma-delimited variable names, but it loops as if the file contained an infinite number of CSV-records...

Possibly one could even argue that the file not being present is equivalent of having reached the EOF immediatly upon start. If one follows this argumentation, the infinite loop should not happen if "Stop thread on EOF?" is true and not additional "Stop Thread if CSV file is not available" is needed

asfimport commented 13 years ago

Ralf Hauser (migrated from Bugzilla): if no .csv file is present and it is in combination with smtp sampler, this can lead to mail flooding attack

Created attachment EmptyCSVError.jmx: EmptyCSVEternalLoop.jmx

EmptyCSVError.jmx ````xml false false false -1 1 1 1216276358000 1216276358000 false continue data_dir ../data/ = csv_file Dev.csv = timer_value 2000 = String csvFile = "CSV file "+vars.get("data_dir")+vars.get("csv_file") ; print(csvFile); SampleResult.setResponseData(csvFile); //this line seems to have a side-effect on all ResponseData in this controller false ${data_dir}${csv_file} UTF8 messageCode , false false true All threads 0==0 false vars.put("user", "tester@discardmail"); String msg = "to_address "+vars.get("user"); SampleResult.setResponseData(msg); false www.google.com / GET true false true false Java 4 false Google Assertion.response_data false 2 false saveConfig true true true true true true true true true true true true true true true true false true 0 true true true true true true true ${__property(reportfile)} ````
asfimport commented 13 years ago

Sebb (migrated from Bugzilla): Went with the simplest solution, which is to treat IOError (e.g. not found) as EOF.

asfimport commented 13 years ago

Ralf Hauser (migrated from Bugzilla): hmm, this fixed it, but in a way the user might get lost: 1) in View Results Tree, I don't see anything 2) when I run JMeter out of eclipse, nothing in the console there either

ok, JMeter log has it, but do users really always check that?

Would there be the possibility to raise a pop-up (provided jmeter is not run headless?)

2011/04/13 08:50:10 ERROR - jmeter.config.CSVDataSet: java.io.FileNotFoundException: /home/me/../data/Dev.csv (No such file or directory) 2011/04/13 08:50:10 INFO - jmeter.threads.JMeterThread: Stop Thread seen: org.apache.jorphan.util.JMeterStopThreadException: End of file detected

asfimport commented 13 years ago

Sebb (migrated from Bugzilla): JMeter does not raise dialog boxes during running.

CSV Dataset is not run in the context of a sampler, so cannot flag the sample as failed either.

There are lots of other reasons why samples may fail that can only be reported via the log file; that's why users are always told to check the log file.