```release-note:bug sdk/queue: move lock before length check to prevent panics. ```