Re: ZEO conflicts

Jim Fulton <[email protected]>
Newsgroups gmane.comp.web.zope.zodb
Message-ID <CAPDm-FjqtDt=+xxN8zc4SwPKdo36OFO4QR1MYgrXjKhg61VJ9A@mail.gmail.com>
On Tue, Oct 11, 2016 at 4:13 PM, Boylan, Ross <[email protected]> wrote:
> With ZEO clients some of my transactions seem to get lost without causing any reported error report on the client, despite having 10 retries and a long and variable delay between retries.  The clients are in separate threads, not separate processes, and I'm unclear exactly how this situation should be handled.  Some of the docs say
> "Any number of processes can create a ClientStorage instance, and any number of threads in each process can be using that instance. ClientStorage aggressively caches objects locally, so in order to avoid using stale data the ZEO server sends an invalidation message to all the connected ClientStorage instances on every write operation." (http://www.zodb.org/en/latest/articles/old-guide/zeo.html).  I tried to do almost everything within threads.

Create one client per process.  Create a database for the client, and
finally open connections is separate threads.  I guess I need to
update the ZEO docs to make this clearer.

Although there shouldn't be any harm in creating a client per thread,
it's just wasteful.

>  I'm also not sure if using transaction.commit() and related calls is safe in this context.

Yes, they are. Why wouldn't they be?

>
> The function executed in each thread is
> def tickle(i):
>     db = ZEO.DB(dbname)
>     conn = db.open()
>     if i==0:
>         @transact_retry()
>         def f1():
>             aTree = IOBTree()
>             conn.root.foo = aTree
>             return aTree
>         aTree = f1()
>         event.set()
>     else:
>         event.wait()
>         @transact_retry()
>         def f2():
>             return conn.root.foo
>         aTree = f2()
>     for j in range(2):
>         aRun = OneRun(i+j*nThread)
>         @transact_retry()
>         def f3(aRun):
>             aTree[aRun.num] = aRun
>         f3(aRun)
>     conn.close()
>
> dbname is a named pipe.

What?  Do you mean a unix-domain socket? Is dbname a string?

Jim

-- 
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.