Port Exception in TransactionImpl#begin method can leave thread in unusable state to 3.3

Port of #3166