Address zombie process in the replication by using waitpid

Submitted by:	delphij
Ticket:	#6052

(cherry picked from commit 7b1438e2920fb2b8e44f8a690c6334d868da869a)