Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 12-03-2005
rhochmuth rhochmuth is offline
Registered User
 
Name: Roland Hochmuth
Organization: HP
Project: RGS
 
Join Date: Aug 2003
Posts: 86
How to re-establish glacier2 session after connection explicitly closed?

I've just added support for glacier2 in my application and all is working with the initial connection establishment. My client application has a disconnect and connect button . When the disconnect button is selected all the connections are explicitly close by invoking ice_connection()->close(true) on all the proxies. This works when not using a glacier2 router, but when the router is enabled it looks like close(..) closes the glacier2 session. If the connect button is then selected the client cannot re-connect back to the server.

Does this sound like the expected behaviour and is there a way to re-establish the router session and connection if close has been invoked on the proxies connection?

I've tried to do a few things, such as create a new router session again, but it doesn't appear to work. It seems like the router session needs to be created first, at least this is how all the examples are listed, and then the router is added to the adapter.

I've also removed all invocations of close(..), and this appears to work, but I'm not sure if there are some other issues with my application when doing this so I'll need to do some more experimenting. If I can't create a new session then is the only other alternative to not invoke close(...)?

Regards --Roland
Reply With Quote
  #2 (permalink)  
Old 12-03-2005
marc's Avatar
marc marc is offline
ZeroC Staff
 
Name: Marc Laukien
Organization: ZeroC, Inc.
Project: The Internet Communications Engine
 
Join Date: Feb 2003
Location: Florida
Posts: 1,781
If the connection is closed, you must login again, and create a new session. Your old proxies cannot be used anymore. If your client hosts Ice objects, then you must change the category for these objects to the new Glacier2-supplied category.

Can you give me specific details about what problems you are having when your create and use a new session?
Reply With Quote
  #3 (permalink)  
Old 12-03-2005
rhochmuth rhochmuth is offline
Registered User
 
Name: Roland Hochmuth
Organization: HP
Project: RGS
 
Join Date: Aug 2003
Posts: 86
Hi Marc, Here is where I'm at.

1. First time through everything works as expected.

2. After the disconnect button is selected all the proxies that the client created to the server are force closed.

3. The second time through ForcedCloseConnectionException occurs when trying to invoke router->createSession(...)

I noticed that if I selected the connect button again the ForcedCloseConnectionException does not occur.

4. I added another invocation of router-createSession(...) in the catch block if the first one failed as follows:

try
{
router->createSession(...)
}
catch (const Ice::Exception&)
{
try
{
router->createSession(...)
}
catch (const Ice::Exception&)
{
throw;
}
}

Surprisingly the 2nd invocation of createSession passes.

5. Unfortunately a few lines later, when I try to create a new proxy to the server using a checked cast the client emits a ConnectionLostException.

Incidentally, despite my earlier post, I was able to create the object adapter without having a router session yet so that part is working.

Regards --Roland
Reply With Quote
  #4 (permalink)  
Old 12-04-2005
bernard's Avatar
bernard bernard is online now
ZeroC Staff
 
Name: Bernard Normier
Organization: ZeroC, Inc.
Project: Ice
 
Join Date: Feb 2003
Location: Palm Beach Gardens, FL
Posts: 816
Hi Roland,

Could you try to enable retries in your client? The manual used to say not to use retries with Glacier2. In fact retries are not harmful with Glacier2, but they should not be useful either (since you need to recreate a session when an error occurs and the connection is closed).

We are however aware of a bug in Ice where an invocation on a proxy-with-a-closed-connection is not attempted even once, and it looks like you're hitting this bug. Retries is a good work-around. We'll fix this bug soon.

Best regards,
Bernard
__________________
Bernard Normier
ZeroC, Inc.
Reply With Quote
  #5 (permalink)  
Old 12-04-2005
rhochmuth rhochmuth is offline
Registered User
 
Name: Roland Hochmuth
Organization: HP
Project: RGS
 
Join Date: Aug 2003
Posts: 86
Hi Bernard, That helped. Adding retries allowed the 2nd invocation of router->createSession(..) to pass.

I'm now seeing a different issue. A few lines later in the code the proxy to the server is created using stringToProxy(...). Then it is converted to a secure twoway proxy using a checked cast and this fails with ObjectNotExistException.

After I create a new router session is there anything else that I need to do?

Regards --Roland
__________________
Roland Hochmuth
Hewlett-Packard
3404 East Harmony Rd.
Fort Collins, CO 80528
Reply With Quote
  #6 (permalink)  
Old 12-04-2005
rhochmuth rhochmuth is offline
Registered User
 
Name: Roland Hochmuth
Organization: HP
Project: RGS
 
Join Date: Aug 2003
Posts: 86
Hi Bernard and Marc, Just a couple of other items.

The 1st time through everything works and things are done in this order.

1. Create object adapter.
2. Get default router and add the router to the adapter.
3. Activate the adapter.
4. Create the router session.
5. Get the proxy to the server.
6. Create the clien callback object, get router category and add to id, add callback object to object adapter and get the local proxy.
7. Register the client callback proxy with the server.

When the disconnect button is selected, all the connections are explicitly closed on the client side.

When connect button is selected again we start with step 4 above just creating a new router session. At step 5 is where the ObjectNotExistException exception occurs when doing a checked cast, but it is the same exact code path as is the first time pass.

If a re-start the client application everything works the first pass through again.

Regards --Roland
__________________
Roland Hochmuth
Hewlett-Packard
3404 East Harmony Rd.
Fort Collins, CO 80528
Reply With Quote
  #7 (permalink)  
Old 12-05-2005
marc's Avatar
marc marc is offline
ZeroC Staff
 
Name: Marc Laukien
Organization: ZeroC, Inc.
Project: The Internet Communications Engine
 
Join Date: Feb 2003
Location: Florida
Posts: 1,781
We are currently investigating the problem with a modified version of our chat demo. We'll get back to you as soon as we know more.
Reply With Quote
  #8 (permalink)  
Old 12-05-2005
matthew's Avatar
matthew matthew is online now
ZeroC Staff
 
Name: Matthew Newhook
Organization: ZeroC, Inc.
Project: Internet Communications Engine
 
Join Date: Feb 2003
Location: NL, Canada
Posts: 1,060
Hi Roland,

I've been looking into your problem. A couple of questions.

What version of Ice are you using? Have you tried Ice 3.0?

Your instructions I don't think are quite correct. You cannot add the router to the object adapter until you've established a session since this makes an invocation on the router which is rejected if the session is not yet established.

I've been able to get the chat demo to work, but I had to make a couple of unexpected changes. I'm investing the exact reason -- sorry about the delay.
Reply With Quote
  #9 (permalink)  
Old 12-05-2005
rhochmuth rhochmuth is offline
Registered User
 
Name: Roland Hochmuth
Organization: HP
Project: RGS
 
Join Date: Aug 2003
Posts: 86
Hi Mathew, We're using Release 2.1.0. I haven't tried Release 3.0 yet.

Your right about the session. I always create the router session before the object adapter. My mistake.

Thanks for looking into this!

Regards --Roland
__________________
Roland Hochmuth
Hewlett-Packard
3404 East Harmony Rd.
Fort Collins, CO 80528
Reply With Quote
  #10 (permalink)  
Old 03-22-2007
joshmoore joshmoore is offline
Registered User
 
Name: Josh Moore
Organization: Glencoe Software, Inc.
Project: OMERO, http://trac.openmicroscopy.org.uk/omero
 
Join Date: Feb 2007
Location: Germany
Posts: 59
Any change in ability to re-establish glacier2 session?

Quote:
Originally Posted by marc View Post
If the connection is closed, you must login again, and create a new session. Your old proxies cannot be used anymore. If your client hosts Ice objects, then you must change the category for these objects to the new Glacier2-supplied category.
Has this changed in Ice 3.1.1 or Ice 3.2? We are examining a workflow of the form:

Code:
        ice = new IceServiceFactory(); // creates communicator
        ice.createSession(); // gets router and session
        ice.longRunningAsyncTask();
        String id = ice.getSessionId(); // uses comm.proxyToString()
        ice.destroy(); // destroys communicator

        // creates a new communicator
        ice = new IceServiceFactory();
        ice.useSession(id); // fails with Ice.ConnectionLostException on checked cast
        ice.checkOnLongRunningTask();
in which long running activities should persist after a client disconnects (and only be destroyed on timeout).
Reply With Quote
  #11 (permalink)  
Old 03-22-2007
benoit's Avatar
benoit benoit is offline
ZeroC Staff
 
Name: Benoit Foucher
Organization: ZeroC, Inc.
Project: Ice
 
Join Date: Feb 2003
Location: Rennes, France
Posts: 1,540
Hi,

No, this hasn't changed. A session is transient and is considered destroyed when the connection to the router is closed. So you should re-create a new session instead of trying to re-use the previous one and register new callback objects with the server to get notifications from the server regarding your long running task.

Let us know if you need more informatin!

Cheers,
Benoit.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Session Management with Glacier2 question 123w456t Help Center 1 03-29-2006 06:46 PM
Glacier2 session expiration Nis Baggesen Help Center 10 03-21-2006 08:05 AM
Session dashie Help Center 3 02-19-2006 10:40 PM
Glacier2 checkedCast loses connection... Unreasonable Help Center 7 11-01-2005 03:30 PM
How to use session? Dmitriy Help Center 2 06-18-2004 10:22 AM


All times are GMT -4. The time now is 10:47 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.