zopefoundation / transaction

Generic transaction implementation for Python.
Other
70 stars 31 forks source link

an object can join a transaction multiple times #2

Closed jvanasco closed 5 years ago

jvanasco commented 11 years ago

While working on the mail package, I noticed that a resource could join a transaction multiple times.

I'm not sure this if this is a bug or intended behavior. I couldn't think of any situation where a resource should join a transaction multiple times, so I wanted to report it. If this happens, seemingly random errors appear in the two-phase commit, as the object will have tpc_begin called for each join.

if there's no reason for multiple joins, it might make sense to raise an exception if something is joined a multiple time -- though this would also require tracking of the raw and wrapped resources ( line 162 ).

https://github.com/zopefoundation/transaction/blob/master/transaction/_transaction.py#L145-L179

d-maurer commented 5 years ago

@jvanasco

I'm not sure this if this is a bug or intended behavior.

I would say, it is a bug in the data manager managing the resource: it should track whether it has already joined the current transaction. All data managers I have seen up to now do this.

jamadden commented 5 years ago

I would agree that it's a bug in the data manager.

Since this was a question that was asked and answered and hasn't had any activity in several months I'm going to go ahead and close this. Feel free to open a new issue if there's more to discuss.