Race condition at launch
mlvl42 opened this issue · comments
Infos
whatweb --version
WhatWeb version 0.4.9 ( http://www.morningstarsecurity.com/research/whatweb/ )
ruby --version
ruby 2.5.5p157 (2019-03-15 revision 67260)
whatweb command sample:
whatweb https://www.google.com
Problem
After launching whatweb several times with the default parameters and a single url, it randomly exited without returning any information. (This will likely be hard to reproduce)
After digging in the source code and debugging a bit, it appears that this condition https://github.com/urbanadventurer/WhatWeb/blob/master/whatweb#L1024 sometimes is true at the very first iteration
target_queue.num_waiting = 25
alive = 25
result_queue.empty? = true
And thus nothing is displayed.
I've managed to mitigate this issue by also waiting for the target_queue to be empty:
- alive == target_queue.num_waiting and result_queue.empty?
+ alive == target_queue.num_waiting and result_queue.empty? and target_queue.empty?
Hi @mguillau42,
You are a champion 🏆 for tracking down this bug! I can't thank you enough. 🙇