[CRIU] weird usleep() behaviour on dump

Dmitry Safonov 0x7f454c46 at gmail.com
Fri Jun 14 17:13:28 MSK 2019


On 6/14/19 2:45 PM, andi wrote:
[..]
> 
> I dug a little deeper yesterday, and found out that the issue only
> happens when using relative timers, so the
> solution that works for me so far is a pre-load library that converts
> sleep(), usleep(), nanosleep and
> clock_nanosleep() with relative times into absolute timers.

Yes, it's very far from perfect.

In a perfect world we would just use sys_restart_syscall() on restore..
But what it does - it looks into (struct restart_block) in the
task_struct - which is obviously has do_no_restart_syscall().

So, it seems that we need some kind of kernel API, either:
- to set restart_block for restored task (unlikely kernel folks would
  love it)
- I would probably suggest to look into extending
  PTRACE_GET_SYSCALL_INFO to return also info from restart_block.

Just added a github issue and in TODO list
https://github.com/checkpoint-restore/criu/issues/719

> 
> Using that pre-load lib and the above example results in the dot count
> happily increasing even when my dump loop is running.


-- 
          Dima


More information about the CRIU mailing list