I've been exploring the implementation of the hook architecture in preparation 
for some work on it I want to do. The issue that has come up is how hooks at 
the various scopes (global, session, transaction) interact with regard to 
locking. If you look at (for instance) the HttpSM logic to invoke hooks, it 
directly accesses the global hook structure. Currently this is "prevented" by 
documentation that states the global hook add can only be called from 
TSPluginInit. Session hooks did not have this problem for HTTP 1 because only 
one transaction could be running per session and the hooks would have both the 
session and transaction locks. However, for HTTP/2 it becomes possible to have 
a race condition. I would like to add, as for the global case, the rule that 
TSHttpSsnHookAdd can only be called from a session hook and not a transaction 
hook. I doubt anyone is actually do that now so it should be relatively minor 
change.

Reply via email to