#6377 require on_cancel and on_close callbacks