if (!transaction.addFrameToTransaction(frame)) {
Frame errorFrame = Frames.createErrorFrame("Frame not added to transaction",
Headers.create(Frame.ID, id, Frame.TRANSACTION, txId),
"Message delivery failed - the frame cannot be added to the transaction - the number of allowed thread " +
"may have been reached");
<BUG>connection.handler().unregisterTransactionsFromConnection(connection);
</BUG>
connection.write(errorFrame);
connection.close();
return;

if (!transaction.addFrameToTransaction(frame)) {
Frame errorFrame = Frames.createErrorFrame("Frame not added to transaction",
Headers.create(Frame.ID, id, Frame.TRANSACTION, txId),
"Message delivery failed - the frame cannot be added to the transaction - the number of allowed thread " +
"may have been reached");
Transactions.INSTANCE.unregisterTransactionsFromConnection(connection);
connection.write(errorFrame);
connection.close();
return;
