memray: Possible deadlock caught with strace (double FUTEX_WAIT_PRIVATE)

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Hello, I’m having a possible deadlock when executing memray and it seems to have appeared on the strace output log. The relevant snippet is here:

(...)
41784 clone(child_stack=0x7fd4d91fefb0, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tidptr=0x7fd4d91ff9d0, tls=0x7fd4d91ff700, child_tidptr=0x7fd4d91ff9d0) = 41805
41784 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
41805 set_robust_list(0x7fd4d91ff9e0, 24 <unfinished ...>
41784 getrandom( <unfinished ...>
41805 <... set_robust_list resumed>)    = 0
41784 <... getrandom resumed>"\x06\x80\x35\x11\x1d\x77\x9c\xb0\x59\xb8\x96\x47\x4b\xc7\xe5\xe7\x66\xe8\x13\x26\xf6\xf9\x77\x27\x08\x1f\xe7\x9d\x28\x60\x2d\xa7", 32, GRND_NONBLOCK) = 32
41805 futex(0x7fd50c85a908, FUTEX_WAIT_PRIVATE, 2, NULL <unfinished ...>
41784 open("/proc/sys/vm/overcommit_memory", O_RDONLY) = 5
41784 read(5, "0\n", 32)                = 2
41784 close(5)                          = 0
41784 futex(0x1a49990, FUTEX_WAIT_PRIVATE, 2, NULL <unfinished ...>
41793 <... futex resumed>)              = -1 ETIMEDOUT (Connection timed out)
41793 futex(0x20c64a8, FUTEX_WAKE_PRIVATE, 1) = 0
41793 read(4, "290925 23905 8178 599 0 164167 0"..., 8191) = 33
41793 read(4, "", 8191)                 = 0
41793 lseek(4, 0, SEEK_SET)             = 0
41793 futex(0x1a49990, FUTEX_WAIT_PRIVATE, 2, NULL <unfinished ...>
(...)

The actual program running is rail-estimate in function load_slow_modules(), from here:

https://github.com/linea-it/pz-compute/blob/main/rail_scripts/rail-estimate#L114

That function recursively loads a large amount of libraries, I can still find out more precisely the point it happened if necessary and if some other library could be causing the deadlock instead.

Expected Behavior

Without running memray, the load_slow_modules() function works normally and the python modules are successfully loaded.

Steps To Reproduce

memray run -f -o memray.bin $ALTHOME/bin/rail-estimate -a lephare \
    $SCRATCH/input/hdf5/ref/objectTable_tract_5065_DC2_2_2i_runs_DP0_2_v23_0_1_PREOPS-905_step3_29_20220314T204515Z-part2.hdf5 output1.hdf5

Memray Version

1.13.4

Python Version

3.11

Operating System

Linux

Anything else?

Full strace log attached:

trace.gz

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 27 (15 by maintainers)

Most upvoted comments

Hello, Pablo, memray 1.14 is working fine with lephare without deadlocks, thank you very much!

Ok, thank you, I’ll test it later this week.

Thank you all for the help !