Skip to content

MailDataManager raises exception when transaction has after-commit hooks #30

@kilink

Description

@kilink

If a transaction has any after-commit hooks, abort is called on the transaction's resources after the hooks are called (see the _callAfterCommitHooks method):

https://github.com/zopefoundation/transaction/blob/master/transaction/_transaction.py#L372-L378

The MailDataManager treats this as an error condition and raises an exception without calling its onAbort callback.

I've added a test demonstrating the issue: kilink/repoze.sendmail@c26361e7ac4

(Note that I add the log handler just to demonstrate that an exception is being raised.)

I think the best way to deal with this may be to increment the MailDataManager's tpc_phase attribute in tpc_finish, and then check if the two-phase commit finished in the abort method; if that's the case, no exception should be raised.

Another question is whether the onAbort callback should be called in this case. I'm not sure that it should.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions