Fix BIND hanging on shutdown when browsers end HTTP/2 streams prematurely
The merge request fixes BIND hanging when browsers end HTTP/2 streams
prematurely (for example, by sending
RST_STREAM). It ensures that
isc__nmsocket_prep_destroy() will be called for an HTTP/2 stream,
allowing the associated socket and HTTP/2 data to be properly disposed of.
The problem was impossible to reproduce using dig or DoH benchmarking
flamethrower) because these do not tend to end HTTP/2
It was fairly easy to reproduce via browsers. There are multiple methods to do so.
Firstly, one could leave a browser instance configured to make name resolutions against a BIND instance via DoH for some time. There was a possibility that on shutdown, BIND will hang. That is how the problem was initially noticed.
Secondly, if one has a lot of tabs opened (like tens of them), one, again, could configure the browser to make name resolutions against a BIND instance via DoH and restart the browser. There is a high level of possibility that after that, BIND will hang on shutdown.
Thirdly, there is a Google Chrome specific option. One could configure the browser instance to use BIND for name resolutions via DoH and then, in settings, turn the secure name resolutions on and off or switch between the built-in DoH providers and the BIND instance at a fast enough rate for some time (doing so like ten times is usually enough). Probably, the BIND instance will hang on shutdown after that.
In all of the cases above, browsers issue
RST_STREAM messages. I am not sure why they do that, but it seems that they try to cancel the previous uncompleted name resolution attempt via DoH if a new the same one has just been issued. That is, they try to cancel the one still "in flight." I am not sure if it is entirely correct, though, and it does not really matter: BIND should not hang in such a case.