takeScreenshot() will hang occasionally

why would takeScreenshot() hang occasionally?
is it still waiting for the pay load to complete?
how to avoid it?