NAME
Patro::Server - remote object server for Patro
VERSION
0.16
DESCRIPTION
A server class for making references available to proxy clients in the Patro distribution. The server handles requests for any references that are being served, manipulates references on the server, and returns the results of operations to the proxy objects on the clients.
SERVER OPTIONS
Server options are configured through the global %Patro::Server::OPTS
hash. Changes to this hash generally only affect servers in threads and processes that are started after the changes are made; any desired changes should be made before the first call to "patronize" in Patro.
The server recognizes the following options in the %Patro::Server::OPTS
hash:
Server operation options
In its original incarnation, I imagined that the servers and clients would be tightly coupled. A server would start, and then the same person that started the server would start one or more clients on other machines in the same cluster. The clients would perform some tasks, and then exit. When the last client disconnected, and after a little bit of waiting to see if any new clients would connect, the server would shut down. Other server use cases are possible, but this is the use case that informed these server settings.
- keep_alive => seconds
-
After the server starts, this is the number of seconds it is guaranteed to stay up, even if no clients connect to it. The default is 30 seconds; you could set this to a very large value in order to have a persistent server.
- idle_timeout => seconds
-
After all clients have disconnected, this is the number of seconds to wait for another client to connect. If another client does not connect before this time expires, then the server will shut down (also subject to satisfying the
keep_alive
timeout, described above). The default is 30 seconds. - fincheck_freq => seconds
-
The number of seconds in between checks of which clients are still active. When no active clients are detected, the
idle_timeout
count down will begin.This check is implemented with a
SIGALRM
. That may be inconvenient to the many other programs and modules that would useSIGALRM
though, so this may change in the future.
Server security options
These options indicate whether certain operations that may be insecure or impolite are allowed on the server.
- secure_filehandles => bool
-
If this option is true, then proxies to filehandles will receive an error if they execute the
open
orclose
functions on the filehandles. If theopen
function is allowed, the client will have read/write access (with the userid of the server process) to any file on the server filesystem. Worse, the client could use a pipe open (open $proxy_fh, "| arbitrary command"
) and execute arbitrary code on the server. Callingclose
on a proxy filehandle is not so dangerous but it would still not be allowed if this option is set. - steal_lock_ok => bool
-
Patro
provides advisory locking on remote references. One option to the Patro::lock function is to allow a lock to be stolen from another monitor. Whether stealing locks should be allowed depends a lot on your application. Some reasons you might want to allow it is if you have slow and unreliable processes or if your application is prone to deadlock.
LICENSE AND COPYRIGHT
MIT License
Copyright (c) 2017, Marty O'Brien
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.