Results 1 to 5 of 5

Thread: Too many open files with IceJ

  1. #1
    lucsat's Avatar
    lucsat is offline Registered User
    Name: Jordi Rubio
    Organization: Grupo Intercom
    Project: I+D
    Join Date
    Oct 2005
    Location
    Terrassa
    Posts
    15

    Too many open files with IceJ

    Hi,

    I have a simple Ice Client/Server application in a Linux environment (Fedora Core 4 in the client side and Mandriva LE 2005 in the server side). The server is a simple Ice.Application, and the client is a Java servlet.

    This is the icebox.properties:

    Ice.ThreadPool.Client.SizeMax=10
    Ice.ThreadPool.Server.SizeMax=10

    I run 20 concurrent requests, and all works fine. I run 20 more concurrent, and the client hasn't problems. But if I run 20 more concurrent requests, the client (jakarta tomcat) throws a lot of exceptions:

    error: cannot create thread pool for connection:
    Ice.SocketException
    error = 0
    at IceInternal.Network.createTcpSocket(Network.java:1 04)
    (...)
    Caused by: java.net.SocketException: Too many open files
    at sun.nio.ch.Net.socket0(Native Method)

    What's the matter?

    I attach the server and client main classes in this issue.

    Thanks a lot for helping me!

    P.D.: I'm testing ICE for future developments. We have already programmed a medium multithread search java program, and we want to know if ICE is faster than a classical multithreading implementation.
    Attached Files Attached Files
    Last edited by lucsat; 10-31-2005 at 02:52 PM.
    Jordi Rubio Moreno
    Grupo Intercom
    www.grupointercom.com

  2. #2
    dwayne's Avatar
    dwayne is offline ZeroC Staff
    Name: Dwayne Boone
    Organization: ZeroC, Inc.
    Project: Internet Communications Engine
    Join Date
    Jan 2005
    Location
    St. John's, Newfoundland
    Posts
    397
    Please see http://www.zeroc.com/vbulletin/showthread.php?t=1697 for our support policy.

  3. #3
    lucsat's Avatar
    lucsat is offline Registered User
    Name: Jordi Rubio
    Organization: Grupo Intercom
    Project: I+D
    Join Date
    Oct 2005
    Location
    Terrassa
    Posts
    15
    Hi dwayne,

    I apologize for the mistake... (i'm newbie)

    Best regards...
    Jordi Rubio Moreno
    Grupo Intercom
    www.grupointercom.com

  4. #4
    mes's Avatar
    mes
    mes is offline ZeroC Staff
    Name: Mark Spruiell
    Organization: ZeroC, Inc.
    Project: Ice Developer
    Join Date
    Feb 2003
    Location
    California
    Posts
    1,441
    Hi,

    Creating a communicator is an expensive operation, and is not something I would recommend doing for every HTTP request.

    Rather, your servlet should create the communicator once (e.g., in the servlet's init method) and use that same instance for every HTTP request. Furthermore, if all HTTP requests result in invocations on the same Ice object, then your servlet should also create the proxy in the init method.

    For example:
    Code:
    public class MyServlet extends HttpServlet
    {
        public void init() throws ServletException
        {
            try
            {
                String[] args = {};
                _communicator = Ice.Util.initialize(args);
                Ice.ObjectPrx proxy = _communicator.stringToProxy("...");
                _searcher = SearcherPrxHelper.checkedCast(proxy);
                if(_searcher == null)
                {
                    throw new UnavailableException("Invalid proxy");
                }
            }
            catch(Exception ex)
            {
                UnavailableException e = new UnavailableException("Ice failure");
                e.initCause(ex);
                throw e;
            }
        }
    
        public void destroy()
        {
            if(_communicator != null)
            {
                try
                {
                    _communicator.destroy();
                }
                catch(Exception ex)
                {
                    // Ignore
                }
            }
        }
    
        ...
    
        private Ice.Communicator _communicator;
        private SearcherPrx _searcher;
    }
    We'll investigate whether the exception you saw is the result of a problem in Ice.

    Take care,
    - Mark

  5. #5
    lucsat's Avatar
    lucsat is offline Registered User
    Name: Jordi Rubio
    Organization: Grupo Intercom
    Project: I+D
    Join Date
    Oct 2005
    Location
    Terrassa
    Posts
    15

    Thumbs up Fantastic!

    Hi Mark!

    It works!!! Thanks a lot for your time!!!

    Best regards!
    Jordi Rubio Moreno
    Grupo Intercom
    www.grupointercom.com

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Problem including files in ice files
    By teoMalo in forum Help Center
    Replies: 4
    Last Post: 09-21-2009, 11:33 AM
  2. why do not open all source files to public?
    By Jiangyubao in forum Help Center
    Replies: 1
    Last Post: 05-09-2008, 02:41 AM
  3. any open-source projects use ICE?
    By zouming in forum Comments
    Replies: 1
    Last Post: 03-15-2007, 07:55 PM
  4. Why Ice open several ports at 127.0.0.1?
    By timeguest in forum Help Center
    Replies: 7
    Last Post: 04-22-2005, 07:43 AM
  5. Can ICE be used to create an Open OPC?
    By Jeff Holle in forum Comments
    Replies: 5
    Last Post: 10-07-2003, 01:44 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •