Skip to content

New C++ libtool shell can deadlock #415

@rockbruno

Description

@rockbruno

I'm upgrading our repo to the latest version of apple_support, but ran into an issue with this specific commit from 1.20.0.

Basically, while this works fine on my machine, our CI gets stuck on linking steps. After some painful debugging, I found out that what's happening is that the underlying libtool invocation is getting stuck on a printf call:

Call graph:
    7883 Thread_1103693   DispatchQueue_1: com.apple.main-thread  (serial)
      7883 start  (in dyld) + 2840  [0x187a64274]
        7883 main  (in libtool) + 9300  [0x10433556c]
          7883 create_library  (in libtool) + 500  [0x104336810]
            7883 fprintf  (in libsystem_c.dylib) + 68  [0x187c89958]
              7883 vfprintf_l  (in libsystem_c.dylib) + 156  [0x187c89a00]
                7883 __xvprintf  (in libsystem_c.dylib) + 292  [0x187c89b44]
                  7883 __sflush  (in libsystem_c.dylib) + 232  [0x187c87d0c]
                    7883 _swrite  (in libsystem_c.dylib) + 108  [0x187c89c6c]
                      7883 __swrite  (in libsystem_c.dylib) + 24  [0x187ca8dcc]
                        7883 __write_nocancel  (in libsystem_kernel.dylib) + 8  [0x187da6dc4]

Total number in stack (recursive counted multiple, when >=5):

Sort by top of stack, same collapsed (when >= 5):
        __write_nocancel  (in libsystem_kernel.dylib)        7883

I eventually traced it down to how the new wrapper handles pipes, as I was able to fix this by commenting out all the related code (plus it worked fine on the previous shell version).

However I can't say exactly what is wrong about the code as it works fine on my machine. I'm not sure what's particularly different about my CI's environment that would trigger this so I can't provide exact reproduction steps either... From what I understand, this might have something to do with how the code only reads stderr after the process exits, while it appears that in this case the tool is expecting something to read the output immediatelly.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions