fixes massive go routine/memory leak, data race and early exit for timeout == 0
fixes massive go routine/memory leak, data race and early exit for timeout == 0

tylerb/graceful,francoishill/graceful,no2key/graceful,WatchBeam/graceful,LamCiuLoeng/graceful,anupcshan/graceful