fix racing condition: releasing request may result in a pthread unlock error