Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 03-03-2008
akryukov akryukov is offline
Registered User
 
Name: Anton Kryukov
Organization: Breakwater Trading
Project: Order Management System
 
Join Date: Feb 2008
Posts: 4
Question Problem using IceGrid administrative session

The following code:

std::string registryProxyStr = "IceGrid/Registry:tcp -p 4061";
IceGrid::RegistryPrx registry = IceGrid::RegistryPrx::checkedCast(
communicator->stringToProxy(registryProxyStr));

try
{
IceGrid::AdminSessionPrx session = registry->createAdminSession(
user, password);
session->keepAlive();
}
catch (Ice::Exception const & e)
{
// print out exception
throw;
}

produces an ObjectNotExist exception when invoking keepAlive on the session proxy:

object does not exist:
identity: `IceGrid/d542d531-7e39-4102-9d5f-23914df22e6c'
facet:
operation: keepAlive

I don't understand why the proxy just given to me by the registry would not point to an existing object.
I run the registry on the same box as the program. The IceGrid Admin GUI shows the registry dynamic well known object: IceGrid/Registry -t:tcp -h 10.20.5.167 -p 4061. registry->ice_toString() gives "IceGrid/Registry -t:tcp -h 127.0.0.1 -p 4061". session->ice_toString() gives "IceGrid/d542d531-7e39-4102-9d5f-23914df22e6c -t:tcp -h 10.20.5.167 -p 4061"

Any help is appreciated.
Reply With Quote
  #2 (permalink)  
Old 03-03-2008
benoit's Avatar
benoit benoit is online now
ZeroC Staff
 
Name: Benoit Foucher
Organization: ZeroC, Inc.
Project: Ice
 
Join Date: Feb 2003
Location: Rennes, France
Posts: 1,534
Hi,

Most likely, the keepAlive request is not sent over the connection that was used to create the session. Session objects can only be accessed from the network connection used to create the session for security reasons.

This can happen if the session proxy endpoints don't match the endpoints of the registry proxy (different timeout or IP address). Did you trying to print the session proxy? You could also enable Ice.Trace.Network=2 and Ice.Trace.Protocol=1 on the client to see if another network connection is being used to send the keepAlive request.

Cheers,
Benoit.
Reply With Quote
  #3 (permalink)  
Old 03-03-2008
akryukov akryukov is offline
Registered User
 
Name: Anton Kryukov
Organization: Breakwater Trading
Project: Order Management System
 
Join Date: Feb 2008
Posts: 4
Thanks. The proxy strings are in the original post. Yes, of course you are right - the endpoints turn out to be different, although they both (127.0.0.1:4061 and 10.20.5.167:4061) refer to the same host. Here is the log:

[ 03/03/08 12:43:22.615 Network: attempting to bind to tcp socket 127.0.0.1:0 ]
[ 03/03/08 12:43:22.630 Network: accepting tcp connections at 127.0.0.1:3108 ]
[ 03/03/08 12:43:23.443 Network: attempting to bind to tcp socket 10.20.5.167:0 ]
[ 03/03/08 12:43:23.443 Network: accepting tcp connections at 10.20.5.167:3111 ]
[ 03/03/08 12:43:23.458 Network: attempting to bind to tcp socket 127.0.0.1:0 ]
[ 03/03/08 12:43:23.458 Network: accepting tcp connections at 127.0.0.1:3114 ]
[ 03/03/08 12:43:23.458 Network: trying to establish tcp connection to 127.0.0.1:4061 ]
[ 03/03/08 12:43:23.458 Network: tcp connection established
local address = 127.0.0.1:3115
remote address = 127.0.0.1:4061 ]
[ 03/03/08 12:43:23.458 Protocol: received validate connection
message type = 3 (validate connection)
compression status = 0 (not compressed; do not compress response, if any)
message size = 14 ]
[ 03/03/08 12:43:23.458 Protocol: sending request
message type = 0 (request)
compression status = 0 (not compressed; do not compress response, if any)
message size = 74
request id = 1
identity = IceGrid/Registry
facet =
operation = ice_isA
mode = 1 (nonmutating)
context = ]
[ 03/03/08 12:43:23.458 Protocol: received reply
message type = 2 (reply)
compression status = 0 (not compressed; do not compress response, if any)
message size = 26
request id = 1
reply status = 0 (ok) ]
[ 03/03/08 12:43:24.130 Protocol: sending request
message type = 0 (request)
compression status = 0 (not compressed; do not compress response, if any)
message size = 64
request id = 2
identity = IceGrid/Registry
facet =
operation = getSessionTimeout
mode = 1 (nonmutating)
context = ]
[ 03/03/08 12:43:24.130 Protocol: received reply
message type = 2 (reply)
compression status = 0 (not compressed; do not compress response, if any)
message size = 29
request id = 2
reply status = 0 (ok) ]
[ 03/03/08 12:43:24.740 Protocol: sending request
message type = 0 (request)
compression status = 0 (not compressed; do not compress response, if any)
message size = 79
request id = 3
identity = IceGrid/Registry
facet =
operation = createAdminSession
mode = 0 (normal)
context = ]
[ 03/03/08 12:43:24.740 Protocol: received reply
message type = 2 (reply)
compression status = 0 (not compressed; do not compress response, if any)
message size = 105
request id = 3
reply status = 0 (ok) ]
[ 03/03/08 12:43:25.146 Network: trying to establish tcp connection to 10.20.5.167:4061 ]
[ 03/03/08 12:43:25.146 Network: tcp connection established
local address = 10.20.5.167:3118
remote address = 10.20.5.167:4061 ]
[ 03/03/08 12:43:25.146 Protocol: received validate connection
message type = 3 (validate connection)
compression status = 0 (not compressed; do not compress response, if any)
message size = 14 ]
[ 03/03/08 12:43:25.552 Protocol: sending request
message type = 0 (request)
compression status = 0 (not compressed; do not compress response, if any)
message size = 84
request id = 1
identity = IceGrid/d198bfed-ca7f-4031-9ee4-394b1ce3059f
facet =
operation = keepAlive
mode = 2 (idempotent)
context = ]
[ 03/03/08 12:43:25.552 Protocol: received reply
message type = 2 (reply)
compression status = 0 (not compressed; do not compress response, if any)
message size = 77
request id = 1
reply status = 2 (object not exist)
identity = IceGrid/d198bfed-ca7f-4031-9ee4-394b1ce3059f
facet =
operation = keepAlive ]
[ 03/03/08 12:43:26.630 Network: stopping to accept tcp connections at 10.20.5.167:3111 ]
[ 03/03/08 12:43:26.630 Network: stopping to accept tcp connections at 127.0.0.1:3114 ]
[ 03/03/08 12:43:26.630 Protocol: sending close connection
message type = 4 (close connection)
compression status = 1 (not compressed; compress response, if any)
message size = 14 ]
[ 03/03/08 12:43:26.630 Protocol: sending close connection
message type = 4 (close connection)
compression status = 1 (not compressed; compress response, if any)
message size = 14 ]
[ 03/03/08 12:43:26.630 Network: shutting down tcp connection for writing
local address = 127.0.0.1:3115
remote address = 127.0.0.1:4061 ]
[ 03/03/08 12:43:26.630 Network: closing tcp connection
local address = 127.0.0.1:3115
remote address = 127.0.0.1:4061 ]
[ 03/03/08 12:43:26.630 Network: shutting down tcp connection for writing
local address = 10.20.5.167:3118
remote address = 10.20.5.167:4061 ]
[ 03/03/08 12:43:26.630 Network: closing tcp connection
local address = 10.20.5.167:3118
remote address = 10.20.5.167:4061 ]
03/03/08 12:43:27.521 error: ServiceManager: exception while starting service ServerMonitor:
Outgoing.cpp:388: Ice::ObjectNotExistException:
object does not exist:
identity: `IceGrid/d198bfed-ca7f-4031-9ee4-394b1ce3059f'
facet:
operation: keepAlive
[ 03/03/08 12:43:27.521 Network: stopping to accept tcp connections at 127.0.0.1:3108 ]

Here is what I've done to go around this problem:


IceGrid::AdminSessionPrx session =
registry->createAdminSession(user, password);
Ice::ConnectionPtr conn = registry->ice_getConnection();
Ice::ObjectPrx prx = conn->createProxy(session->ice_getIdentity());
session = IceGrid::AdminSessionPrx::uncheckedCast(prx);

// session->ice_toString());

session->keepAlive();

Is this right? It seems to work. For some reason "session->ice_toString()" throws a FixedProxyException

Thanks
Reply With Quote
  #4 (permalink)  
Old 03-03-2008
akryukov akryukov is offline
Registered User
 
Name: Anton Kryukov
Organization: Breakwater Trading
Project: Order Management System
 
Join Date: Feb 2008
Posts: 4
Thanks. The proxy strings are in the original post. Yes, of course you are right - the endpoints turn out to be different, although they both (127.0.0.1:4061 and 10.20.5.167:4061) refer to the same host. Here is the log:

[ 03/03/08 12:43:22.615 Network: attempting to bind to tcp socket 127.0.0.1:0 ]
[ 03/03/08 12:43:22.630 Network: accepting tcp connections at 127.0.0.1:3108 ]
[ 03/03/08 12:43:23.443 Network: attempting to bind to tcp socket 10.20.5.167:0 ]
[ 03/03/08 12:43:23.443 Network: accepting tcp connections at 10.20.5.167:3111 ]
[ 03/03/08 12:43:23.458 Network: attempting to bind to tcp socket 127.0.0.1:0 ]
[ 03/03/08 12:43:23.458 Network: accepting tcp connections at 127.0.0.1:3114 ]
[ 03/03/08 12:43:23.458 Network: trying to establish tcp connection to 127.0.0.1:4061 ]
[ 03/03/08 12:43:23.458 Network: tcp connection established
local address = 127.0.0.1:3115
remote address = 127.0.0.1:4061 ]
[ 03/03/08 12:43:23.458 Protocol: received validate connection
message type = 3 (validate connection)
compression status = 0 (not compressed; do not compress response, if any)
message size = 14 ]
[ 03/03/08 12:43:23.458 Protocol: sending request
message type = 0 (request)
compression status = 0 (not compressed; do not compress response, if any)
message size = 74
request id = 1
identity = IceGrid/Registry
facet =
operation = ice_isA
mode = 1 (nonmutating)
context = ]
[ 03/03/08 12:43:23.458 Protocol: received reply
message type = 2 (reply)
compression status = 0 (not compressed; do not compress response, if any)
message size = 26
request id = 1
reply status = 0 (ok) ]
[ 03/03/08 12:43:24.130 Protocol: sending request
message type = 0 (request)
compression status = 0 (not compressed; do not compress response, if any)
message size = 64
request id = 2
identity = IceGrid/Registry
facet =
operation = getSessionTimeout
mode = 1 (nonmutating)
context = ]
[ 03/03/08 12:43:24.130 Protocol: received reply
message type = 2 (reply)
compression status = 0 (not compressed; do not compress response, if any)
message size = 29
request id = 2
reply status = 0 (ok) ]
[ 03/03/08 12:43:24.740 Protocol: sending request
message type = 0 (request)
compression status = 0 (not compressed; do not compress response, if any)
message size = 79
request id = 3
identity = IceGrid/Registry
facet =
operation = createAdminSession
mode = 0 (normal)
context = ]
[ 03/03/08 12:43:24.740 Protocol: received reply
message type = 2 (reply)
compression status = 0 (not compressed; do not compress response, if any)
message size = 105
request id = 3
reply status = 0 (ok) ]
[ 03/03/08 12:43:25.146 Network: trying to establish tcp connection to 10.20.5.167:4061 ]
[ 03/03/08 12:43:25.146 Network: tcp connection established
local address = 10.20.5.167:3118
remote address = 10.20.5.167:4061 ]
[ 03/03/08 12:43:25.146 Protocol: received validate connection
message type = 3 (validate connection)
compression status = 0 (not compressed; do not compress response, if any)
message size = 14 ]
[ 03/03/08 12:43:25.552 Protocol: sending request
message type = 0 (request)
compression status = 0 (not compressed; do not compress response, if any)
message size = 84
request id = 1
identity = IceGrid/d198bfed-ca7f-4031-9ee4-394b1ce3059f
facet =
operation = keepAlive
mode = 2 (idempotent)
context = ]
[ 03/03/08 12:43:25.552 Protocol: received reply
message type = 2 (reply)
compression status = 0 (not compressed; do not compress response, if any)
message size = 77
request id = 1
reply status = 2 (object not exist)
identity = IceGrid/d198bfed-ca7f-4031-9ee4-394b1ce3059f
facet =
operation = keepAlive ]

Here is what I've done to go around this problem:


IceGrid::AdminSessionPrx session =
registry->createAdminSession(user, password);
Ice::ConnectionPtr conn = registry->ice_getConnection();
Ice::ObjectPrx prx = conn->createProxy(session->ice_getIdentity());
session = IceGrid::AdminSessionPrx::uncheckedCast(prx);

// session->ice_toString());

session->keepAlive();

Is this right? It seems to work. For some reason "session->ice_toString()" throws a FixedProxyException

Thanks
Reply With Quote
  #5 (permalink)  
Old 03-03-2008
benoit's Avatar
benoit benoit is online now
ZeroC Staff
 
Name: Benoit Foucher
Organization: ZeroC, Inc.
Project: Ice
 
Join Date: Feb 2003
Location: Rennes, France
Posts: 1,534
While this works, you would have to do this for each proxy returned by the admin session (the proxy of the admin object, etc). Instead, I would recommend to use the well-known proxy to create the IceGrid::Registry proxy and configure the Ice.Default.Locator property (Ice.Default.Locator="IceGrid/Locator:tcp -p 4061"), for example:


Code:
// C++
Ice::ObjectPrx obj = communicator->stringToProxy("IceGrid/Registry");
IceGrid::RegistryPrx registry = IceGrid::RegistryPrx::checkedCast(obj);

try
{
    IceGrid::AdminSessionPrx session = registry->createAdminSession(user, password);
    session->keepAlive();
}
catch(const Ice::Exception& ex)
{
    cerr << ex << endl;
    throw;
}
Thanks to the Ice locator, the Ice runtime will retrieve the correct endpoints for the IceGrid/Registry object. These endpoints will be the same as the endpoints of the session proxy and you shouldn't have any more issues.

Cheers,
Benoit.
Reply With Quote
  #6 (permalink)  
Old 03-03-2008
akryukov akryukov is offline
Registered User
 
Name: Anton Kryukov
Organization: Breakwater Trading
Project: Order Management System
 
Join Date: Feb 2008
Posts: 4
Thanks a bunch. It worked.
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
Problem with IcePatch2 and IceGrid piontec Help Center 3 01-07-2008 08:29 AM
a problem of session-timeout on mobile phone neons Help Center 1 11-14-2007 09:42 AM
Upgrade to ice 3.2 : problem with Icegrid admin session Vivien Delage Help Center 2 10-15-2007 05:13 AM
Problem keeping IceGrid::Admin session alive borax00 Help Center 2 05-03-2007 04:55 AM
problem with IceGrid example bdk Help Center 3 09-29-2006 05:28 AM


All times are GMT -4. The time now is 10:53 AM.


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.