could not accept socket

This is a discussion on could not accept socket within the Linux Programming forums, part of the Platform Specific Boards category; I'm having this intermittent problem with a server program I wrote, and every couple of weeks, it terminates because it ...

  1. #1
    Registered User
    Join Date
    Oct 2006
    Posts
    2,360

    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
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,484
    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?
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  3. #3
    Registered User
    Join Date
    Oct 2006
    Posts
    2,360
    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
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,484
    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)
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

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-15-2006, 11:42 PM
  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, 04:59 PM
  4. when to close a socket
    By Wisefool in forum Networking/Device Communication
    Replies: 5
    Last Post: 11-02-2003, 09: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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21