Archived
This forum has been archived. Please start a new discussion on GitHub.
Ice hangs when glacier is restarted
Hello.
I use glacier2 router and icegrid.
When icegrid with router is restarted the client can not reconnect to icegrid's servers objects - it hangs. Wireshark shows that Ice is calling ice_isA method indefinitely without a pause.
To reproduce it three files are sufficient:
config:
First start icegrid:
Tested on Ice 3.3.1 under linux
I use glacier2 router and icegrid.
When icegrid with router is restarted the client can not reconnect to icegrid's servers objects - it hangs. Wireshark shows that Ice is calling ice_isA method indefinitely without a pause.
To reproduce it three files are sufficient:
config:
Ice.Default.Host=localhost Ice.Default.Locator=IceGrid/Locator:tcp -p 4061 IceGrid.Registry.Client.Endpoints=tcp -p 4061 IceGrid.Registry.Server.Endpoints=tcp IceGrid.Registry.Internal.Endpoints=default IceGrid.Registry.Data=db/registry IceGrid.Registry.PermissionsVerifier=IceGrid/NullPermissionsVerifier IceGrid.Registry.AdminPermissionsVerifier=IceGrid/NullPermissionsVerifier IceGrid.Node.Name=localhost IceGrid.Node.Endpoints=default IceGrid.Node.Data=db/node IceGrid.Node.CollocateRegistry=1 IceGridAdmin.Username=foo IceGridAdmin.Password=barapp.xml:
<icegrid>
<application name="Simple">
<node name="localhost">
<server id="glacier" exe="glacier2router" activation="always">
<property name="Glacier2.Client.Endpoints" value="tcp -h localhost -p 4063"/>
<property name="Glacier2.Server.Endpoints" value="tcp -h localhost"/>
<property name="Glacier2.SessionTimeout" value="60"/>
<property name="Glacier2.PermissionsVerifier" value="Glacier2/NullPermissionsVerifier"/>
<property name="Glacier2.Trace.Session" value="1"/>
</server>
</node>
</application>
</icegrid>
client.py:
#!/usr/bin/env python
import time, sys, Ice, Glacier2, IceGrid
class Client(Ice.Application):
def run(self, args):
obj = None
while True:
if obj:
if not self.ping(obj):
obj = None
else:
obj = self.connect()
time.sleep(2)
def connect( self ):
ic = self.communicator()
try:
router = ic.stringToProxy('Glacier2/router:tcp -h localhost -p 4063')
router = Glacier2.RouterPrx.checkedCast(router)
session = router.createSession('', '')
query = ic.stringToProxy('IceGrid/Query')
query = query.ice_router(router)
print 'casting...'
obj = IceGrid.QueryPrx.checkedCast(query) # hangs here after reconnect
print 'casting... done.'
return obj
except Ice.Exception, x:
return None
def ping( self, obj ):
try:
obj.ice_ping()
return True
except Ice.Exception, x:
return False
app = Client()
sys.exit(app.main(sys.argv))
First start icegrid:
$ icegridnode --Ice.Config=config --deploy app.xmlThen start client.py in another window. After that kill icegridnode and start it again.
$ ./client.py casting... casting... done. casting...
Tested on Ice 3.3.1 under linux
0
Comments
-
Hi,
This is a known problem where the Ice communicator is caching some information which prevent a new session from being created.
You need to destroy the communicator after the session is destroyed and create a new communicator before establishing a new session. Another option is to create an object adapter associated with the router after the session is created and destroy it once the session is destroyed.
Cheers,
Benoit.0 -
Thanks
Hello.
Thank you, Benoit. Workaround with adapter works fine.
Vsevolod0