newsapps/beeswithmachineguns

Divide by 0 possible if all bees fail ready

Closed this issue · 3 comments

bees.py line 304. If no bees make it to the action, it is possible the application will attempt to divide by zero and exit without a clear indication to the user what failed.

Possibly related stacktrace

Traceback (most recent call last):
  File "/usr/local/bin/bees", line 6, in <module>
    main.main()
  File "/Library/Python/2.7/site-packages/beeswithmachineguns/main.py", line 163, in main
    parse_options()
  File "/Library/Python/2.7/site-packages/beeswithmachineguns/main.py", line 154, in parse_options
    bees.attack(options.url, options.number, options.concurrent, **additional_options)
  File "/Library/Python/2.7/site-packages/beeswithmachineguns/bees.py", line 510, in attack
    summarized_results = _summarize_results(results, params, csv_filename)
  File "/Library/Python/2.7/site-packages/beeswithmachineguns/bees.py", line 304, in _summarize_results
    summarized_results['mean_response'] = sum(complete_results) / summarized_results['num_complete_bees']
ZeroDivisionError: integer division or modulo by zero

-- UPDATE --
Just a little bit more info. I tried uninstalling and reinstalling to various versions and was seeing the same thing. Then this morning I happened to have my amazon dash up and noticed that the bees were still initializing. Once I waited for them to fully come up, all worked fine. I just wanted to post in case anyone else ran into this in the future. Was stupid on my part, but perhaps the error message should states something different if possible to better point to the real issue.

-- Prior Post --
I just installed to t2.micro AWS Ubuntu AMI ubuntu-trusty-14.04-amd64-server-20140607.1 . I have the latest version and the Bees start up but when sending attack I get the following error ending with a divide by zero:

Traceback (most recent call last): File "/usr/local/bin/bees", line 6, in <module> main.main() File "/usr/local/lib/python2.7/dist-packages/beeswithmachineguns/main.py", line 170, in main parse_options() File "/usr/local/lib/python2.7/dist-packages/beeswithmachineguns/main.py", line 161, in parse_options bees.attack(options.url, options.number, options.concurrent, **additional_options) File "/usr/local/lib/python2.7/dist-packages/beeswithmachineguns/bees.py", line 529, in attack summarized_results = _summarize_results(results, params, csv_filename) File "/usr/local/lib/python2.7/dist-packages/beeswithmachineguns/bees.py", line 315, in _summarize_results summarized_results['mean_response'] = sum(complete_results) / summarized_results['num_complete_bees'] ZeroDivisionError: integer division or modulo by zero

I also am getting this error and have not determined the cause yet. Below is a stacktrace:

bees attack -u http://54.nn.nn.nn/ -n 100000 -c 3000:

Traceback (most recent call last):
  File "/usr/local/bin/bees", line 6, in <module>
    main.main()
  File "/usr/local/lib/python2.7/site-packages/beeswithmachineguns/main.py", line 163, in main
    parse_options()
  File "/usr/local/lib/python2.7/site-packages/beeswithmachineguns/main.py", line 154, in parse_options
    bees.attack(options.url, options.number, options.concurrent, **additional_options)
  File "/usr/local/lib/python2.7/site-packages/beeswithmachineguns/bees.py", line 509, in attack
    summarized_results = _summarize_results(results, params, csv_filename)
  File "/usr/local/lib/python2.7/site-packages/beeswithmachineguns/bees.py", line 303, in _summarize_results
    summarized_results['mean_response'] = sum(complete_results) / summarized_results['num_complete_bees']
ZeroDivisionError: integer division or modulo by zero