Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Monkeypatch io.read/io.write/open/io.open to track blocking calls in debug mode #1162
This is related to #1070 and provides an safe debug-time alternative.
Without making any of the above methods non-blocking/loop-friendly, it might be useful to provide facilities to mp all blocking IO methods in debug/troubleshooting mode to track blocking IO operations.
Even if the mp'ed code functions correctly in test, it may be only due to circumstances surrounding the environment, i.e. if a method accepts a domain socket and there are no buffer overflows the loop would be responsive simply due to localhost communication even if blocking IO is on a critical path. Same code where unix socket is replaced with a TCP one talking remotely over a slow link will grind the loop to a halt, which in turn is very hard to troubleshoot.
By introducing an ability to optionally mp all blocking IO code without modifying its behavior (other than auditing) would provide insight into missed mp branches.