If a Set request is aborted (e.g. by connection loss or master restart), the subagent may provoke memory leak. This is because a TestSet may allocate memory and CleanupSet may not be called in case of failure.
The situation could be handled by calling CleanupSet internally if a TestSet is received, effectively cleaning up the last SET request before serving a new one. Caution: can SET requests be interleaved?