Thread: could not accept socket

  1. #1
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445

    could not accept socket

    I'm having this intermittent problem with a server program I wrote, and every couple of weeks, it terminates because it fails in attempting to accept a socket. I am using a C++ wrapper class for the traditional unix socket api, and my machines which run the server are behind a barracuda load balancer. I suspect the load balancer of causing this problem, but have no proof of it. it is also possible that there is some sort of attack being perpetrated on my server, but there is no evidence of this. Is there any bug in the linux 2.6.x kernel that causes a system to run out of sockets over time? generally, my server will successfully accept thousands of connections before displaying this problem, so I doubt it's an issue with my code.

    Hardware:
    2x Dell PowerEdge 6850/4x dual core 2.66GHz CPU/16GB RAM

    OS:
    OpenSUSE 10.3 release/Kernel 2.6.22.5-31

    Other software:
    MySQL 5.0.45-22

  2. #2
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    Are you sure that your program closes sockets and frees other resourses as it should?
    there is 65000 ports available so maybe you accept new connections till you use all the ports not freeing any?
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  3. #3
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    Quote Originally Posted by vart View Post
    Are you sure that your program closes sockets and frees other resourses as it should?
    there is 65000 ports available so maybe you accept new connections till you use all the ports not freeing any?
    I hear you knockin, but the server only listens on one port. is it possible that each connection it hands off to a child process uses another port? in any case, I'm 90% certain that I'm closing and freeing the sockets, but I'll definitely go through my code some more...

  4. #4
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    I do not believe in the socket closing bug of the linux kernel
    Our SipServer program is developed for linux as well and could run stress of hundreds transactions per second during long hours without encountering problems like this...

    I suppose - you need to check other resources that could be leaked in your application (maybe not in your code but in classes you are using without proper destructors or something)
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Wrong accept() call?
    By Nephiroth in forum Networking/Device Communication
    Replies: 1
    Last Post: 02-16-2006, 12:42 AM
  2. Using a single socket for accept() as well as connect()?
    By nkhambal in forum Networking/Device Communication
    Replies: 3
    Last Post: 10-20-2005, 05:43 AM
  3. async Client/Server app, accept() stalls?
    By JaWiB in forum Networking/Device Communication
    Replies: 14
    Last Post: 01-31-2005, 05:59 PM
  4. when to close a socket
    By Wisefool in forum Networking/Device Communication
    Replies: 5
    Last Post: 11-02-2003, 10:33 AM
  5. socket newbie, losing a few chars from server to client
    By registering in forum Linux Programming
    Replies: 2
    Last Post: 06-07-2003, 11:48 AM