Handling signals while "sleeping"

#### todo
- [x] backport to `v2.5-stable`