-
Notifications
You must be signed in to change notification settings - Fork 56
Open
Description
if you run this program, the time.sleep() ends immediately (CPython, Linux64, ubuntu):
import time
import vmprof
def main():
f = open('xxx.vmprof', 'w+b')
vmprof.enable(f.fileno(), real_time=True)
time.sleep(3)
vmprof.disable()
main()According to strace, time.sleep() is implemented as a call to select; the normal behavior is this:
select(0, NULL, NULL, NULL, {3, 0}) = 0 (Timeout)
however, with real_time=True, I get this:
select(0, NULL, NULL, NULL, {3, 0}) = ? ERESTARTNOHAND (To be restarted if no handler)
I think that what happens is that the syscall is interrupted because the TIMER signal fired; CPython is not prepared to handle this case, and so it immediately exit the sleep(). However, I am not sure why it happens only in real_time mode.
Metadata
Metadata
Assignees
Labels
No labels