InsightSoftwareConsortium / InsightSoftwareConsortium/ITK
blocked forever in select() from kwsysProcessWaitForPipe when running under TSan on macOS
- Dominant language
- C++
- Stars
- 1.7k
- Forks
- 748
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 64
Description
I've been working on finding & fixing ITK tests under Thread Sanitizer (TSan). I've tried on 3 Macs:
1. intel macOS 10.14
2. intel macOS 11.6
3. arm64 macos 12.2
On the last one only, many tests block forever with this backtrace:
```
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
* frame #0: 0x000000018deab5f8 libsystem_kernel.dylib`__select + 8
frame #1: 0x00000001015137c0 itkTestDriver`kwsysProcessWaitForPipe(cp=0x000000010a703200, data=0x0000000000000000, length=0x0000000000000000, wd=0x000000016fdfe850) at ProcessUNIX.c:1227:23
frame #2: 0x0000000101512a90 itkTestDriver`itksysProcess_WaitForData(cp=0x000000010a703200, data=0x0000000000000000, length=0x0000000000000000, userTimeout=0x0000000000000000) at ProcessUNIX.c:1090:11
frame #3: 0x000000010150c498 itkTestDriver`itksysProcess_WaitForExit(cp=0x000000010a703200, userTimeout=0x0000000000000000) at ProcessUNIX.c:1339:20
frame #4: 0x0000000100006458 itkTestDriver`TestDriverInvokeProcess(args=size=6) at itkTestDriver.cxx:196:3
frame #5: 0x0000000100006c40 itkTestDriver`main(argc=7, argv=0x000000016fdff500) at itkTestDriver.cxx:311:14
frame #6: 0x000000010378108c dyld`start + 520
(lldb) fr sel 1
frame #1: 0x00000001015137c0 itkTestDriver`kwsysProcessWaitForPipe(cp=0x000000010a703200, data=0x0000000000000000, length=0x0000000000000000, wd=0x000000016fdfe850) at ProcessUNIX.c:1227:23
1224
1225 /* Run select to block until data are available. Repeat call
1226 until it is not interrupted. */
-> 1227 while (((numReady = select(max + 1, &cp->PipeSet, 0, 0, timeout)) < 0) &&
1228 (errno == EINTR)) {
1229 }
1230
(lldb) p timeout
(kwsysProcessTimeNative *) $0 = NULL
```
As per man page "If timeout is a null pointer, the select blocks indefinitely".
Not sure if it's due to arm64 or due to macOS 12.x. I don' have intel on macOS 12 handy.
Contributor guide
Assessment
This issue has not been assessed yet.