-
Couldn't load subscription status.
- Fork 151
Open
Description
Specifically, check for defined? ActiveRecord::Base and Resque.redis. Then we can remove those bits from the necessary config for probably 95% of users (and remove one of the most common misconfigurations). Any other connections will still need to be managed manually (and we will still need to document this in the README).
We should do a quick search for open TCP sockets and issue a warning if any of them were shared from the master. e.g.
# helper
def open_tcp_sockets
return [] if configured_to_ignore_open_socket_warnings?
ObjectSpace.each_object(TCPSocket).each_with_object({}) do |f,h|
fd = f.fileno rescue nil
h[fd] = f if fd && (!f.closed? rescue nil)
end
# immediately after fork
tcp_from_master = open_tcp_sockets
# after running the after fork hooks
current_open_tcp_fds = open_tcp_socket_fds.keys
(tcp_from_master.keys & current_open_tcp_fds).each do |fd|
socket = tcp_from_master[fd]
unless configured_to_ignore_warning_for?(socket)
print_warning_for(socket)
end
endWe could also extend this to open File, IO, UDPSocket, etc, but those are more likely to be legitimately shared between master/worker.
codyrobbins
Metadata
Metadata
Assignees
Labels
No labels