I've noticed in debugging a replication implementation that use of the
SQLMerge object creates orphaned processes (which prevent subsequent
synchronization until explicitly terminated) if the application that starts
the merge process terminates abnormally (e.g. like stopping it in the
Once this happens, I can't synchronize again until I explicitly kill the
processes on the publisher/distributor. I see messages from the SQLMerge
"The merge process could not initialize the Publisher
"Another merge agent for the subscription(s) is running."
Is there a way to prevent this from happening. The processes do not seem to
be cleaned up within any reasonable amount of time (e.g. even overnight),
and the replication monitor keeps showing the agent in a "retry" state until
I kill the process, even though the subscriber that started the merge
process is long gone.