The line d.appendVarFlag(task, "lockfiles", "${S}/singletask.lock") should be d.appendVarFlag(task, "lockfiles", " ${S}/singletask.lock") to avoid problems when a task already have a file listed in lockfiles.
So if a task already have do_foo[lockfiles] = "${SOMEDIR}/foo.lock" externalsrc will change the lockfiles varflag to "${SOMEDIR}/foo.lock${S}/singletask.lock" When a tack using this lockfile has run and the lockfile has been removed it still leaves "${SOMEDIR}/foo.lock${S}" behind. This will cause the foo task in a recipe not usein gexternalsrc to stall waiting for "${SOMEDIR}/foo.lock" - which is now actually a directory.
Trying to fix this on master I found it was already fixed in 7b73473bc9d19331a103cf4958059d3ceb84b486.
I was wrong, it was not fixed. Sorry about that.
Fix merged to master: http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=0899d9af1da320a857c4dd65db279b0173ad803a This is probably a candidate for fido as well.
Verified on jethro: 8c8c4ede3ff5ac8ca739020d9efed91159acccc1