Martin Hansen <lists / ruby-forum.com> wrote:
> I am trying to emulate UNIX command line pipes in a Ruby-only solution
> that uses multiple cores. Eventually, the records piped from command to
> command will be Ruby objects marshaled using msgpack. Unfortunately, the
> code hangs after the first dump command. I am really trying to figure
> out what causes this deadlock and how to resolve it.

Hey, I'm not familiar with either parallel or msgpack, but can you try
using strace (or similar syscall tracer for your OS) on the spawned
processes?  You'll probably find one (or more) processes is stuck in the
read/write/select syscalls and which FDs they're stuck on.

If you're on Linux, perhaps check out dtas-graph, a Perl script I wrote
for visualizing the pipelines and dataflows within dtas-player[1].  I
combined it with strace for debugging, because it was sometimes
confusing to associate the FDs shown in strace output with the actual
pipes/connected process on the other end(s).

dtas-graph should work on any Linux processes using pipes, not just
dtas-player.

	git clone git://80x24.org/dtas dtas

	# You'll need the Graph::Easy perl module,
	# "apt-get install libgraph-easy-perl" if you're on Debian,
	# I would've written it in Ruby but I couldn't find a graphing
	# library in Ruby with ASCII/UTF-8 text output.
	perl dtas/perl/dtas-graph $PID_OF_MAIN_PROCESS

Sample output: http://dtas.80x24.org/dtas-graph-sample.txt

Arrows denote direction of data flow, on the lines are the file
descriptor numbers associated with the pipe for each process.  Boxes
either represent processes (identified via PIDs) or pipe objects
(identified via PIPEID:PIPE_INO mapping).


[1] - duct tape audio suite - http://dtas.80x24.org/