Discussion:
[omniORB] client publishes localhost (127.0.0.1) when listening on hostname
Igor Lautar
2008-06-09 13:04:02 UTC
Permalink
Hi,

Some background info how we use omniORB.

Client side servant uses hostname as interface on which to listen. In
addition, we add two endpoints. Configuration is as follows:
(replaced actual hostname with <HOSTNAME>)

[01164 06 10:26:12.578] D 4 omniORB: Configuration file
"C:\OMNIORB.CFG" either does not exist or is not a file. No settings
read.
[01164 06 10:26:12.593] D 4 omniORB: Version: 4.1.1
[01164 06 10:26:12.593] D 4 omniORB: Distribution date: Sun Oct 7
16:41:47 BST 2007 dgrisby
[01164 06 10:26:12.609] D 4 omniORB: Warning: unable to create an
IPv6 socket. Unable to obtain the list of IPv6 interface addresses
(10047).
[01164 06 10:26:12.609] D 4 omniORB: My addresses are:
[01164 06 10:26:12.609] D 4 omniORB: 127.0.0.1
[01164 06 10:26:12.609] D 4 omniORB: Native char code sets: UTF-8
ISO-8859-1.
[01164 06 10:26:12.609] D 4 omniORB: Transmission char code sets:
UTF-8(1.2) UTF-8(1.1) ISO-8859-1(1.2) ISO-8859-1(1.1) ISO-8859-1(1.0).
[01164 06 10:26:12.609] D 4 omniORB: Native wide char code sets:
UTF-16.
[01164 06 10:26:12.609] D 4 omniORB: Transmission wide char code
sets: UTF-16(1.2).
[01164 06 10:26:12.625] D 4 omniORB: Initialising omniDynamic
library.
[01164 06 10:26:12.625] D 4 omniORB: Current configuration is as
follows:
[01164 06 10:26:12.625] D 4 omniORB: DefaultInitRef (file) =
[01164 06 10:26:12.625] D 4 omniORB: DefaultInitRef (args) =
[01164 06 10:26:12.625] D 4 omniORB: abortOnInternalError = 0
[01164 06 10:26:12.625] D 4 omniORB: abortOnNativeException = 0
[01164 06 10:26:12.625] D 4 omniORB: acceptBiDirectionalGIOP = 0
[01164 06 10:26:12.625] D 4 omniORB: acceptMisalignedTcIndirections
= 0
[01164 06 10:26:12.625] D 4 omniORB: bootstrapAgentHostname =
[01164 06 10:26:12.625] D 4 omniORB: bootstrapAgentPort = 900
[01164 06 10:26:12.625] D 4 omniORB: clientCallTimeOutPeriod = 0
[01164 06 10:26:12.625] D 4 omniORB: clientConnectTimeOutPeriod = 0
[01164 06 10:26:12.625] D 4 omniORB: clientTransportRule = *
unix,ssl,tcp
[01164 06 10:26:12.625] D 4 omniORB: configFile = C:\OMNIORB.CFG
[01164 06 10:26:12.625] D 4 omniORB: connectionWatchImmediate = 0
[01164 06 10:26:12.625] D 4 omniORB: connectionWatchPeriod = 50000
[01164 06 10:26:12.625] D 4 omniORB: copyValuesInLocalCalls = 1
[01164 06 10:26:12.625] D 4 omniORB: diiThrowsSysExceptions = 0
[01164 06 10:26:12.625] D 4 omniORB: dumpConfiguration = 0
[01164 06 10:26:12.625] D 4 omniORB: endPoint =
giop:tcp:0.0.0.0:23230
[01164 06 10:26:12.625] D 4 omniORB: endPoint =
giop:tcp:<HOSTNAME>:23230
[01164 06 10:26:12.625] D 4 omniORB: endPointPublish = addr
[01164 06 10:26:12.625] D 4 omniORB: giopMaxMsgSize = 2097152
[01164 06 10:26:12.625] D 4 omniORB: giopTargetAddressMode =
KeyAddr
[01164 06 10:26:12.625] D 4 omniORB: id = omniORB4
[01164 06 10:26:12.625] D 4 omniORB: idleThreadTimeout = 10
[01164 06 10:26:12.625] D 4 omniORB: inConScanPeriod = 180
[01164 06 10:26:12.625] D 4 omniORB: lcdMode = 0
[01164 06 10:26:12.625] D 4 omniORB: maxGIOPConnectionPerServer = 5
[01164 06 10:26:12.625] D 4 omniORB: maxGIOPVersion = 1.2
[01164 06 10:26:12.625] D 4 omniORB:
maxInterleavedCallsPerConnection = 5
[01164 06 10:26:12.625] D 4 omniORB: maxServerThreadPerConnection =
100
[01164 06 10:26:12.625] D 4 omniORB: maxServerThreadPoolSize = 100
[01164 06 10:26:12.625] D 4 omniORB: maxSocketRecv = 131072
[01164 06 10:26:12.625] D 4 omniORB: maxSocketSend = 131072
[01164 06 10:26:12.625] D 4 omniORB: nativeCharCodeSet = UTF-8
[01164 06 10:26:12.625] D 4 omniORB: nativeWCharCodeSet = UTF-16
[01164 06 10:26:12.625] D 4 omniORB: objectTableSize = 0
[01164 06 10:26:12.625] D 4 omniORB: offerBiDirectionalGIOP = 0
[01164 06 10:26:12.625] D 4 omniORB: oneCallPerConnection = 1
[01164 06 10:26:12.625] D 4 omniORB: outConScanPeriod = 120
[01164 06 10:26:12.625] D 4 omniORB: poaHoldRequestTimeout = 0
[01164 06 10:26:12.625] D 4 omniORB: poaUniquePersistentSystemIds =
1
[01164 06 10:26:12.625] D 4 omniORB: principal = [Null]
[01164 06 10:26:12.625] D 4 omniORB: resetTimeOutOnRetries = 0
[01164 06 10:26:12.625] D 4 omniORB: scanGranularity = 5
[01164 06 10:26:12.625] D 4 omniORB: serverCallTimeOutPeriod = 0
[01164 06 10:26:12.625] D 4 omniORB: serverTransportRule = *
unix,ssl,tcp
[01164 06 10:26:12.625] D 4 omniORB: socketSendBuffer = 16384
[01164 06 10:26:12.625] D 4 omniORB: strictIIOP = 1
[01164 06 10:26:12.625] D 4 omniORB: supportBootstrapAgent = 0
[01164 06 10:26:12.625] D 4 omniORB: supportCurrent = 1
[01164 06 10:26:12.625] D 4 omniORB: supportPerThreadTimeOut = 0
[01164 06 10:26:12.625] D 4 omniORB: tcAliasExpand = 0
[01164 06 10:26:12.625] D 4 omniORB: threadPerConnectionLowerLimit
= 9000
[01164 06 10:26:12.625] D 4 omniORB: threadPerConnectionPolicy = 1
[01164 06 10:26:12.625] D 4 omniORB: threadPerConnectionUpperLimit
= 10000
[01164 06 10:26:12.625] D 4 omniORB: threadPoolWatchConnection = 1
[01164 06 10:26:12.625] D 4 omniORB: traceExceptions = 0
[01164 06 10:26:12.625] D 4 omniORB: traceFile = [stderr]
[01164 06 10:26:12.625] D 4 omniORB: traceInvocationReturns = 0
[01164 06 10:26:12.625] D 4 omniORB: traceInvocations = 1
[01164 06 10:26:12.625] D 4 omniORB: traceLevel = 20
[01164 06 10:26:12.625] D 4 omniORB: traceThreadId = 0
[01164 06 10:26:12.625] D 4 omniORB: traceTime = 0
[01164 06 10:26:12.625] D 4 omniORB: unixTransportDirectory =
/tmp/omni-%u
[01164 06 10:26:12.625] D 4 omniORB: unixTransportPermission = 777
[01164 06 10:26:12.625] D 4 omniORB: useTypeCodeIndirections = 1
[01164 06 10:26:12.625] D 4 omniORB: verifyObjectExistsAndType = 1
[01164 06 10:26:12.625] D 4 omniORB: Initialising incoming endpoints.
[01164 06 10:26:12.625] D 4 omniORB: Instantiate endpoint
'giop:tcp:0.0.0.0:23230'
[01164 06 10:26:12.640] D 4 omniORB: Warning: the local loop back
interface (127.0.0.1)
[01164 06 10:26:12.640] D 4 is the only address available for this
server.
[01164 06 10:26:12.640] D 4 omniORB: Instantiate endpoint
'giop:tcp:<HOSTNAME>:23230'
[01164 06 10:26:12.734] D 4 omniORB: Publish specification: 'addr'
[01164 06 10:26:12.734] D 4 omniORB: Publish endpoint
'giop:tcp:127.0.0.1:23230'
[01164 06 10:26:12.734] D 4 omniORB: Publish endpoint
'giop:tcp:<HOSTNAME>:23230'
[01164 06 10:26:12.734] D 4 omniORB: Starting serving incoming
endpoints.



So it seams like servant is listening only on 127.0.0.1.

But some time later, server _can_ connect to it using external
interface:

[00000 06 10:29:50.921] D 0 omniORB: Server accepted connection from
giop:tcp:192.168.0.39:4220
[00000 06 10:29:50.921] D 0 omniORB: AsyncInvoker: thread id = 5 has
started. Total threads = 4
[00000 06 10:29:50.921] D 0 omniORB: Accepted connection from
giop:tcp:192.168.0.39:4220 because of this rule: "* unix,ssl,tcp"
[00000 06 10:29:50.921] D 0 omniORB: Dispatching remote call '_is_a'
to: key<clientService> (active)
[00000 06 10:29:50.921] D 0 omniORB: Dispatching remote call 'GetIOR'
to: key<clientService> (active)
[01544 06 10:29:50.921] --> 1 cas_Corba::Instance()$Rev: 18110 $
[01544 06 10:29:50.921] <-- 1 cas_Corba::Instance()
[01544 06 10:29:50.921] D 0 omniORB: Creating ref to local:
key<clientService>
[01544 06 10:29:50.921] D 0 target id :
IDL:omg.org/CORBA/Object:1.0
[01544 06 10:29:50.921] D 0 most derived id:
IDL:HSL/i_CSVC/i_ClientSvc:1.0
[01544 06 10:29:50.921] D 0 omniORB:
ObjRef(IDL:HSL/i_CSVC/i_ClientSvc:1.0) -- deleted.
[01544 06 10:29:58.390] D 0 omniORB: Dispatching remote call '_is_a'
to: key<clientService> (active)
[01544 06 10:29:58.390] D 0 omniORB: Dispatching remote call 'GetIOR'
to: key<clientService> (active)

We use corbaloc to connect to servant and GetIOR is our helper call that
returns properly defined IOR (with UTF encoding) to support unicode.

What happens is that IP encoded in string returned by GetIOR is
127.0.0.1. Problem is that the same servant is also running on the host
which acts as a client, so next call ends up on same host. Why is
127.0.0.1 published if it is also listening on external interface (or
better question, why is it first on list of published IPs).

GetIOR call is simply:

CORBA::Object_var obj = a_servant->_this();
CORBA::String_var sior = m_orb->object_to_string(obj);
return std::string((char*)sior);

Where a_servant == this from calling servant.

We have observed this behaviour during network drops, but it is not
consistent. For example, during hibernation, network cable pluged out
etc.

omniORB version is 4.1.1, platform is Windows, both XP/Vista etc. are
affected.

Endpoints:
[01164 06 10:26:12.625] D 4 omniORB: endPoint =
giop:tcp:0.0.0.0:23230
[01164 06 10:26:12.625] D 4 omniORB: endPoint =
giop:tcp:<HOSTNAME>:23230

Are used to overcome IPv6 problem we encountered (listening only on
IPv6, but not on IPv4 - only affected Vista).

Now my question, is this behaviour known, is it expected and how can it
be prevented :) ?

Ideally, client should not publish 127.0.0.1, if it the only address
(and we are listening on 0.0.0.0). If it is not the only address (as it
was the case here), it should publish it as last IP on list.

Can this be achieved by altering omniORB configuration?

Thank you,
Igor
Igor Lautar
2008-06-10 17:52:00 UTC
Permalink
Hi All,

Some updates on this subject.

It seams specifying both endPoints (giop:tcp:0.0.0.0:23230 &
giop:tcp:<HOSTNAME>:23230) was the culprint. Because 0.0.0.0 was first
in list, IPs were being published. So in case where there were multiple
IPs, wrong one could be provided. We preffer hostnames (as client can
then resolve IP, depending on which subnet is located etc.), so we had
to change ordering of endPoints during initialization.

We've just moved giop:tcp:<HOSTNAME>:23230 before giop:tcp:0.0.0.0:23230
during initialization and now hostname is being published in IORs.

Issue mentioned previously is hard to reproduce, but this makes sense
for me and I expect to not be a problem any more (as wrong IP cannot be
published now).

Any comments/ideas?

Regards,
Igor

Igor Lautar wrote:
<cut>
Duncan Grisby
2008-06-10 19:35:45 UTC
Permalink
Post by Igor Lautar
It seams specifying both endPoints (giop:tcp:0.0.0.0:23230 &
giop:tcp:<HOSTNAME>:23230) was the culprint. Because 0.0.0.0 was first
in list, IPs were being published. So in case where there were multiple
IPs, wrong one could be provided. We preffer hostnames (as client can
then resolve IP, depending on which subnet is located etc.), so we had
to change ordering of endPoints during initialization.
We've just moved giop:tcp:<HOSTNAME>:23230 before giop:tcp:0.0.0.0:23230
during initialization and now hostname is being published in IORs.
That's because the default publishing rule is to publish just one
address. Your server is presumably starting before the network
interfaces are initialised, meaning only the loopback is available when
omniORB looks.

For what you are trying to achieve, you should actually specify just one
endPoint, and use endPointPublish to publish the address. You should use
this setup:

endPoint = giop:tcp:0.0.0.0:23230
endPointPublish = giop:tcp:<hostname>:23230

Cheers,

Duncan.
--
-- Duncan Grisby --
-- ***@grisby.org --
-- http://www.grisby.org --
Igor Lautar
2008-06-10 19:54:16 UTC
Permalink
Hi,
Post by Duncan Grisby
That's because the default publishing rule is to publish just one
address. Your server is presumably starting before the network
interfaces are initialised, meaning only the loopback is available
when omniORB looks.
For what you are trying to achieve, you should actually specify just
one endPoint, and use endPointPublish to publish the address. You
endPoint = giop:tcp:0.0.0.0:23230
endPointPublish = giop:tcp:<hostname>:23230
Just to sumarize if I understand properly:
1) omniORB on server starts-up before wanted network interface is
initialized
- or some interface goes down in the meantime and comes back later
etc., but
this is not 100% reproducible, have seen it on XP/Vista, omniORB
was initialized
when non-loop was available, but after some network problems
started to publish
127.0.0.1
2) omniORB takes whatever interface is available (127.0.0.1) and uses
this when
publishing IORs
3) some network interface comes up (ex. 192.168.0.1)
4) omniORB now listens on new interface as well (due to 0.0.0.0
endpoint) but
still only publishes interface from point (1)

Is my understanding correct?

One other question.
We have started using two endpoints (giop:tcp:0.0.0.0:23230,
giop:tcp:<hostname>:23230)
after moving to omniORB 4.1.1 (from 4.0.7). With default Vista
instalation, you also
get IPv6, so with endpoint set to giop:tcp:<hostname>:23230, it wouldn't
bind to IPv4
interfaces.

Is this normal behaviour? My understanding (when specifying such
endpoint) would be:
'bind to everything this hostname resolves to, IPv6 or IPv4'.

Does this makes sense or is my assumption invalid?

Thank you for help,
Igor
Duncan Grisby
2008-06-16 22:32:16 UTC
Permalink
Post by Igor Lautar
1) omniORB on server starts-up before wanted network interface is
initialized
Yes.
Post by Igor Lautar
- or some interface goes down in the meantime and comes back later
etc., but this is not 100% reproducible, have seen it on XP/Vista,
omniORB was initialized when non-loop was available, but after some
network problems started to publish 127.0.0.1
omniORB never changes what it publishes. It sticks with whatever it saw
when it started up. If the network interface was down when omniORB
started up, then it would see just 127.0.0.1. If it failed after omniORB
had started, that wouldn't change what omniORB did.
Post by Igor Lautar
2) omniORB takes whatever interface is available (127.0.0.1) and uses
this when publishing IORs
Yes. It will always pick something else in preference to 127.0.0.1 (or
::1 in IPv6), but will use that if it's all there is.
Post by Igor Lautar
3) some network interface comes up (ex. 192.168.0.1)
4) omniORB now listens on new interface as well (due to 0.0.0.0
endpoint) but
still only publishes interface from point (1)
Is my understanding correct?
Yes.
Post by Igor Lautar
One other question.
We have started using two endpoints (giop:tcp:0.0.0.0:23230,
giop:tcp:<hostname>:23230)
after moving to omniORB 4.1.1 (from 4.0.7). With default Vista
instalation, you also
get IPv6, so with endpoint set to giop:tcp:<hostname>:23230, it wouldn't
bind to IPv4
interfaces.
Is this normal behaviour? My understanding (when specifying such
'bind to everything this hostname resolves to, IPv6 or IPv4'.
No -- omniORB does a single hostname lookup and uses the first address
it gets.

That's why you should use endPointPublish -- that way, you publish the
name you want but you listen on all interfaces. Except that pre-Vista,
Windows couldn't listen on both IPv4 and IPv6 with the same socket.

Cheers,

Duncan.
--
-- Duncan Grisby --
-- ***@grisby.org --
-- http://www.grisby.org --
Loading...