Merge "Avoid holding main lock for pending event processing" into main