Difficult (impossible?) to say without seeing your code. A typical cause of a hang might be waiting for a pipe to be closed by the writer or waiting on a signal.
You could try to use strace on the hanging process (strace -p pid) which could give you an idea.
we know this via logging mechanism be careful, the log file might not be up-to-date if some records are waiting in a buffer. Check by switching off buffering if you can.