Archived

This forum has been archived. Please start a new discussion on GitHub.

stringToProxy takes excessively long to return

I'm having trouble with stringToProxy in a c# client I'm writing. The same call in Java takes <10ms to return, but in c# takes over 5 seconds. I isolated the example as much as possible. I read a post here saying stringToProxy doesn't go out over the network and is local only, making the behavior even more odd as if called on localhost(127.0.0.1) it will return in <10ms as well.

I'm using Ice 3.1.1. Here is the entire code & log:

Code:
using System;
using System.IO;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using System.Threading;
using Ice;
using peer;
using Exception = System.Exception;

namespace TeRK.communications
{
    public class TempCommunicator
    {
        private readonly StringBuilder LOG = new StringBuilder();
        
        private static Communicator communicator;
        
        private void log(string message)
        {
            message = DateTime.Now +" : " + message+"\n";
            LOG.Append(message);            
        }

        private void writeLog(string path)
        {
            TextWriter logger = new StreamWriter(path, false);
            logger.Write(LOG.ToString());
            logger.Close();
        }

        public TempCommunicator(string configFileClasspath)
        {
            log("Constructor called");
            try
            {
                InitializationData initData = new InitializationData();
                initData.properties = Util.createProperties();
                initData.properties.load(configFileClasspath);
                communicator = Util.initialize(initData);
                log("Properties Loaded!");
            }
            catch (Exception e)
            {
                log(e.ToString());
                throw e;
            }
            string proxy1 = "'::TeRK::TeRKUser':tcp -h 127.0.0.1 -p 10101";
            log("Calling stringToProxy on " + proxy1);
            communicator.stringToProxy(proxy1);
            log("Complete!");
            
            string proxy2 = "'::TeRK::TeRKUser':tcp -h 192.168.0.16 -p 10101";
            log("Calling stringToProxy on " + proxy2);
            communicator.stringToProxy(proxy2);
            log("Complete!");

            log("Constructor terminated");
            writeLog("C:\\tempCommLog.txt");
        }
    }
}

log:
7/8/2008 11:52:34 AM : Constructor called
7/8/2008 11:52:34 AM : Properties Loaded!
7/8/2008 11:52:34 AM : Calling stringToProxy on '::TeRK::TeRKUser':tcp -h 127.0.0.1 -p 10101
7/8/2008 11:52:34 AM : Complete!
7/8/2008 11:52:34 AM : Calling stringToProxy on '::TeRK::TeRKUser':tcp -h 192.168.0.16 -p 10101
7/8/2008 11:52:39 AM : Complete!
7/8/2008 11:52:39 AM : Constructor terminated

You can see the localhost stringToProxy call returns almost immediately, while the stringToProxy call on 192.168.0.16 (the same client running on another computer on the same router) takes over 5 seconds. A ping to that machine takes <1 ms, and both calls yield proxies that work fine with immediate response times, stringToProxy just takes excessively long for remote clients.

Is there some special behavior or settings needed for stringToProxy to work properly?

My ice properties file follows, although most aren't used for this reduced example.
Ice.ProgramName=QwerkService

Ice.Package.peer=edu.cmu.ri.mrpl
Ice.Package.TeRK=edu.cmu.ri.mrpl
Ice.Default.Package=edu.cmu.ri.mrpl

Qwerk.Service.Client.Endpoints=tcp

# Active connection management must be disabled when using bidirectional connections.
Ice.ACM.Client=0
Ice.ACM.Server=0

# Print warning messages for certain exceptional conditions in connections
Ice.Warn.Connections=1

Ice.Logger.Timestamp=1

Ice.ThreadPool.Client.Size=5
Ice.ThreadPool.Client.SizeMax=20
Ice.ThreadPool.Server.Size=5
Ice.ThreadPool.Server.SizeMax=20

# protocol and port to use for direct connect
TeRK.direct-connect.protocol=tcp
TeRK.direct-connect.port=10101

Comments

  • matthew
    matthew NL, Canada
    stringToProxy only parses the string. It does not do any network lookups or any other time consuming operation. To confirm, I tested this with Ice 3.3 and encountered no issues.

    Unfortunately, we do not offer free support for old versions of Ice. I recommend upgrading to Ice 3.3 and re-testing. If you continue to encounter problems please let us know.
  • Alright, so if stringToProxy only parses the string in 3.3, where was the time consuming operation that exists in 3.1.1 moved to in 3.3? I don't want to upgrade and run into the same problem somewhere else.
  • matthew
    matthew NL, Canada
    stringToProxy has always only parsed the string. As to why it is taking time on your configuration, I'm not sure. However, as I wrote we don't provide free support for old versions of Ice so, other than subscribing to our commercial support, or debugging the problem yourself, your best bet is to upgrade to Ice 3.3.