Re: lots of ReadConflictErrors

Jim Fulton <[email protected]>
Newsgroups gmane.comp.web.zope.zodb
Message-ID <CAPDm-FhoAzAuVXL6s4=Smp73OKear4xBV6xvcHZu0oeKchsW2Q@mail.gmail.com>
You've found a bug. :(

I hate the attempts API.  Hate hate hate it. I wrote it in an attempt
:) to try to make the flawed Python context model work.  It's very
hard to reason about, because it's a stupid twister of a model. Using
it is an incantation at best and we obviously can't get the
implementation right. I'm sorry.

I'm going to replace it
(https://groups.google.com/forum/#!topic/python-transaction/3eUzBzX2sRU).
Soon. (I plan to provide a PR in the next few days.)

Jim

On Thu, Oct 6, 2016 at 7:56 PM, Boylan, Ross <[email protected]> wrote:
> Short version:  transaction retries seem to execute multiple times even if all executions succeed.
>
> While trying to come up with a simpler example I had this code at the end:
> aTM = transaction.TransactionManager()
> conn = db.open(aTM)
> for attempt in aTM.attempts(10):
>     with attempt:
>         aTree = conn.root.foo
>         print("Inserted {} objects from {} threads: {}".format(len(aTree), nThread, list(aTree.keys())))
> I had the impression from http://www.zodb.org/en/latest/guide/transactions-and-threading.html
> that this should have one successful execution (because the for attempt .. with attempt: is said to be equivalent to an earlier code block that had that semantics; also the example at http://zodb.readthedocs.io/en/latest/transactions.html#retrying-transactions is consistent with this interpretation).  But it seems to execute 10 times, i.e., the print statement is executed 10 times.  I'll add that at this point all the writer threads had completed, so I don't think an error should be possible.  I was trying to use the retry formulation everywhere to avoid mixing different transaction idioms.
>
> So, have I misunderstood?  Coded it wrong? Found a bug?
>
> Ross
>
> P.S. If I've understood earlier advice I can do without the explicit transaction manager; I'm just trying not to change too much at once.
> ________________________________________
> From: [email protected] [[email protected]] on behalf of Jim Fulton [[email protected]]
> Sent: Thursday, October 06, 2016 3:13 PM
> To: Boylan, Ross
> Cc: Jim Fulton; zodb ‎[[email protected]]‎
> Subject: Re: [ZODB] lots of ReadConflictErrors
>
> On Thu, Oct 6, 2016 at 5:40 PM, Boylan, Ross <[email protected]> wrote:
>> "readCurrent" is not in my code or in the stack traces I sent in this email thread, and so I don't know why you say I'm calling it.
>
> The stack trace ends in checkCurrentSerialInTransaction.  This is a
> storage method that's called during the commit process if something
> has called readCurrent on the connection in the transaction being
> committed.
>
> So a mystery for you to solve is what in your application is calling
> readCurrent.
>
> Jim
>
> --
> Jim Fulton
> http://jimfulton.info



-- 
Jim Fulton
http://jimfulton.info

-- 
You received this message because you are subscribed to the Google Groups "zodb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.