This is an archive of the discontinued LLVM Phabricator instance.

Fix deadlock in ExecuteOneLine on Windows
ClosedPublic

Authored by zturner on Oct 8 2014, 1:18 PM.

Details

Summary

Python one-line execution was using ConnectionFileDescriptor to do a non-blocking read against a pipe. This won't work on Windows, as CFD is implemented using select(), and select() only works with sockets on Windows.

The solution is to use ConnectionGenericFile on Windows, which uses the native API to do overlapped I/O on the pipe. This in turn requires re-implementing Host::Pipe on Windows using native OS handles instead of the more portable _pipe CRT api.

There is an outstanding issue after applying this patch, which is that output re-direction doesn't seem to be happening (i.e. the read end of the pipe is not detecting data on the pipe before it is closed). This will be investigated separately in a follow-up patch.

Diff Detail

Repository
rL LLVM

Event Timeline

zturner updated this revision to Diff 14594.Oct 8 2014, 1:18 PM
zturner retitled this revision from to Fix deadlock in ExecuteOneLine on Windows.
zturner updated this object.
zturner edited the test plan for this revision. (Show Details)
zturner added a reviewer: clayborg.
zturner added a subscriber: Unknown Object (MLST).

Just to clarify, the outstanding issue mentioned only occurs on Windows. Nothing on the posix side has changed.

clayborg accepted this revision.Oct 8 2014, 1:40 PM
clayborg edited edge metadata.

Looks good.

This revision is now accepted and ready to land.Oct 8 2014, 1:40 PM
zturner closed this revision.Oct 8 2014, 1:49 PM
zturner updated this revision to Diff 14603.

Closed by commit rL219339 (authored by @zturner).

lldb/trunk/source/Host/CMakeLists.txt