set close-on-exec for all sockets

Bug #1006186 reported by Jason Toffaletti
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
libmemcached
Fix Released
Medium
Brian Aker

Bug Description

libmemcached doesn't set close-on-exec so all of the file descriptors it creates are inherited by child processes. As far as I can tell, the children can't use these file descriptors for any useful purpose so its a resource leak.

all socket() calls should add " | SOCK_CLOEXEC" to the socket type argument. if the platform doesn't support SOCK_CLOEXEC, but children inherit parent fd, then SOCK_CLOEXEC can be defined to 0 to make the compiler happy, and fnctl can be used to set FD_CLOEXEC.

Revision history for this message
Brian Aker (brianaker) wrote :

I will be curious to see how many platforms this works on now a days :)

Thanks for pointing this out!

Changed in libmemcached:
importance: Undecided → Medium
assignee: nobody → Brian Aker (brianaker)
milestone: none → 1.0.9
status: New → In Progress
Brian Aker (brianaker)
Changed in libmemcached:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.