Support progressive read timeout bthread handler
What problem does this PR solve?
Issue Number: resolve #3133
Problem Summary: when Controller response_will_be_read_progressively() it needs background bthread monitor handler to solve progressive reader idle timeout,when hit the progressive reader idle timeout duration should close current client socket connection.
What is changed and the side effects?
Changed:
- add HandleIdleProgressiveReader method will run in and when controller call response_will_be_read_progressively method will trigger HandleIdleProgressiveReader monitor idle progressive reader on bthread_timer.
- add progressive idle case on http_c++ example http_server with enable_progressive_timeout arg to trigger ProgressiveAttachment write timeout and http_client with progressive and progressive_read_timeout_ms args test the progressive reader idle timeout case.
Side effects:
Performance effects: NO
Breaking backward compatibility: NO
Check List:
- Please make sure your changes are compilable.
- When providing us with a new feature, it is best to add related tests.
- Please follow Contributor Covenant Code of Conduct.
Hi @zchuang185 Thank you for you contribution! I have left some comments, but I think the biggest problem is that this solution is too heavy and too intrusive to Controller. Is there any other solution? For example, after rpc success, set a bthread_timer with progressive_read_timeout_ms and check the Socket when timeout?
@wwbmmm I've added ProgressiveTimeoutRead which is a ProgressiveReader wrapper class, when OnReadPart is invoked, it sets up a bthread_timer to monitor the idle timeout for the progressive socket reader. ProgressiveTimeoutRead is only activated when progressive_read_timeout_ms has been explicitly configured.