cgoldberg / multi-mechanize

Performance Test Framework in Python
GNU Lesser General Public License v3.0
459 stars 127 forks source link

list index out of range when writing results #3

Closed rlgomes closed 8 years ago

rlgomes commented 12 years ago

There are a few situations that lead to the results.py hitting a list index out of range. It can be easily produced by just setting the run_time in the examples/config.cfg time to 1 second and this will trigger the issue. I tried figuring out exactly why it was happening but was unable to diagnose the issue quickly so I came up with an easy to reproduce scenario to hopefully have this figured out as it actually affects a different scenario that I've developed for work.

Goldcap commented 12 years ago

Having the same issue, and it's definately connected to the run_time variable. My guess is that the script is having a thread timeout prior to returning the resp_stats_list, or the stats_list object returned is None.

But it's a bugger of an issue, as I can't seem to get it consistently, and all my efforts to trap the issue in the "results.py" have been useless.

akrishan commented 12 years ago

I 'm getting the same issue on Win 7 platform and also multiple results directories are being created with empty "results.csv" files. Is there a fix for code?

zettabyte commented 10 years ago

If the "elapsed time" for all of the threads (second field in a CSV result record) are longer than the run_time config value, then the conditional, if elapsed_time < self.run_time: on line 292 of results.py (the __parse_file() method of the Results class) prevents any records being added to the resp_stats_list list that the method returns. If the returned list has no entries, line 253 of results.py in the __init__() method of the Results class will raise an exception since it tries to access index 0 of the returned list.

I'm not sure how the elapsed_time value that gets written into the 2nd fields of the results.csv records is calculated, but with my very simple test configuration (with run_time set to 30 seconds), I consistently get this error since the elapsed_time on every record is slightly larger than 30 (31.838, 36.141, etc.). This is definitely a problem.

Perhaps the __init__() method of Results should check the length of the resp_stats_list returned by __parse_file() and, if empty, output a useful error message so users don't get a confusing "index out of range" exception. They could be informed that they likely need to increase run_time setting to be more than any values in the second column of results.csv or something similar.