Fix server leaking events

Solves #6843.

Docker-DCO-1.1-Signed-off-by: Samuel Reis <srijs@airpost.net> (github: srijs)
Add test for event limitation

Docker-DCO-1.1-Signed-off-by: Samuel Reis <srijs@airpost.net> (github: srijs)
avoid regression in events test

Docker-DCO-1.1-Signed-off-by: Samuel Reis <srijs@airpost.net> (github: srijs)
Merge pull request #6918 from vieux/rebase_events_leak

Rebase events leak