MB-12554: Don't blow the stack

Change-Id: I52e89ceb60ca41a80a703b1d94b1f561b23482bf
Reviewed-on: http://review.couchbase.org/42836
Reviewed-by: Volker Mische <volker.mische@gmail.com>
Reviewed-by: Dave Rigby <daver@couchbase.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>