[Twisted-Python] Jelly assertion error when running client and server in the same process
Patrik Blommaskog
pb_twisted at olga.mine.nu
Tue Aug 5 15:03:28 MDT 2003
I have a client and a server application communicating using Twisted and PB.
They run fine as separate programs.
When adding some unit tests, I try to run both the server and a client in
the same application, but I get an assertion error as shown below. I don't
really understand enough of what's happening under the Twisted hood to tell
from the message and looking at flavors.py what's causing the problem.
The applications are growing, so I made an attempt to make a minimal example
from scratch to demonstrate the problem. However, I failed to reproduce it
this way. Since stripping down the applications to a bare minimum can take
some time, I would first like to ask the list if anyone can give me an
indication of what could be the problem? Even with my bad etiquette of not
providing an example, someone is likely to have written that assert
statement for a reason.
Traceback (most recent call last):
File "C:\Python22\Lib\site-packages\twisted\internet\base.py", line 368,
in runUntilCurrent
call.func(*call.args, **call.kw)
File "E:\p\storskogen\src\skogen\common\Core.py", line 132, in
onActorEntered
handler(actor)
File "E:\p\storskogen\src\skogen\server\PlayerPerspective.py", line 65, in
onActorEntered
self.remote.callRemote("addActor", actor)
File "C:\Python22\Lib\site-packages\twisted\spread\pb.py", line 323, in
callRemote
return self.broker._sendMessage('',self.perspective, self.luid, name,
args, kw)
--- <exception caught here> ---
File "C:\Python22\Lib\site-packages\twisted\spread\pb.py", line 788, in
_sendMessage
netArgs = self.serialize(args, perspective=perspective, method=message)
File "C:\Python22\Lib\site-packages\twisted\spread\pb.py", line 742, in
serialize
return jelly(object, self.security, None, self)
File "C:\Python22\Lib\site-packages\twisted\spread\jelly.py", line 845, in
jelly
return _Jellier(taster, persistentStore, invoker).jelly(object)
File "C:\Python22\Lib\site-packages\twisted\spread\jelly.py", line 451, in
jelly
sxp.append(self.jelly(item))
File "C:\Python22\Lib\site-packages\twisted\spread\jelly.py", line 407, in
jelly
return obj.jellyFor(self)
File "C:\Python22\Lib\site-packages\twisted\spread\flavors.py", line 434,
in jellyFor
assert jellier.invoker is self.broker, "You cannot exchange cached
proxies between brokers."
exceptions.AssertionError: You cannot exchange cached proxies between
brokers.
FWIW, I can say that the "self.remote.callRemote("addActor", actor)" line
belongs to the listener (server) side. Both peers make remote calls to each
other. The listener side has a number of Cacheable's and Cacheable's
containing Cacheable's, while the connecting side only exposes one
Referenceable.
- Patrik
More information about the Twisted-Python
mailing list