AP
Size: a a a
AP
AP
b
close()
. Что-то -типа https://metacpan.org/pod/POSIX::AtFork + пробежаться по всем моим открытым сокетам (в потомке) и сделать им close
.AP
YK
VG
Note also that before invoking fork() to spawn a new process, all Net::ZooKeeper handles should be destroyed so that all connections to ZooKeeper are closed and all internal POSIX threads have exited. If a child process needs to communicate with ZooKeeper it should open its own private connections after it is created by fork().и
On occasion the ZooKeeper client code may not be able to quickly reconnect to a live server and the caller may want to destroy the existing Net::ZooKeeper handle object and attempt a fresh connection using the same session ID as before with a new Net::ZooKeeper object. To do so, save the session_id attribute value before undefining the old handle object and then pass that binary string as the value of the 'session_id' option to the new() method when creating the next handle object. After the successful completion of a method which requires communication with the server, if the new handle object's session_id attribute value matches the old session ID then the session has been successfully maintained; otherwise, the old session was expired by the cluster.Т.е. как я понял, если я хочу форкаться, то нужно пересоздать сессию.
my $zkh = Net::ZooKeeper->new('zoo1:2181');Из документации zookeeper-а нашёл:
...
my $session_id = $zkh->{session_id};
$zkh = Net::ZooKeeper->new('zoo1:2181', session_id => $session_id);
# в этот момент эфемерные узлы уже сдохли
...
When a client gets a handle to the ZooKeeper service, ZooKeeper creates a ZooKeeper session, represented as a 64-bit number, that it assigns to the client. If the client connects to a different ZooKeeper server, it will send the session id as a part of the connection handshake. As a security measure, the server creates a password for the session id that any ZooKeeper server can validate.The password is sent to the client with the session id when the client establishes the session. The client sends this password with the session id whenever it reestablishes the session with a new server.Выше написано про пароль к сессии, которого не знаю, где взять, чтобы продолжить сессию.
VG
VG
SZ
VG
SZ
AP
AS
AS
AS
OP
SZ
SR
DF