This allows any resources held by the watcher to be released in the child
process, where they won't be needed.
This is particularly important in kqueue-based watcher implementations.
The way kqueue works requires an open file descriptor for each file and
directory watched. In the case of modules being loaded from a local::lib,
this can easily amount to many thousands of file descriptors. This is not
only wasteful, but it also prevents select(2) from being called on any
file descriptor subsequently opened: you're likely to get EINVAL because the
descriptor exceeds FD_SETSIZE.
This file documents the revision history for Perl extension Catalyst-Devel.
- Typo fixes. RT#87103
+ - Catalyst::Restarter::Forking: clear watcher in child process.
+ RT#119830
1.39 2013-06-14 12:44:17
- Write =encoding utf8 into generated Pod files so that things
);
has _watcher => (
- is => 'rw',
- isa => 'File::ChangeNotify::Watcher',
+ is => 'rw',
+ isa => 'File::ChangeNotify::Watcher',
+ clearer => '_clear_watcher',
);
has _filter => (
$self->_child($pid);
}
else {
+ # Only the parent process needs to watch for changes, so the child
+ # should release any resources held by the watcher:
+ $self->_clear_watcher;
$self->start_sub->();
}
}