diff --git a/docs/changelog.md b/docs/changelog.md index cb58c9c9..7148a739 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -7,6 +7,7 @@ * Added a custom 502 page for apps which use host forwarding. This lets you see the status and logs of your container while you're waiting for its HTTP service to come online * **Misc** * Implemented a [networking fix](https://github.com/docker/machine/pull/3112) the Dusty team implemented in Docker Machine within Dusty + * The daemon now raises its open file handle limit to 8192, which should prevent some OSErrors during parallelized Git operations ## 0.7.0 (February 18, 2016) diff --git a/dusty/constants.py b/dusty/constants.py index a743d4ff..32c438c8 100644 --- a/dusty/constants.py +++ b/dusty/constants.py @@ -30,6 +30,8 @@ DAEMON_HTTP_BIND_IP = '127.0.0.1' DAEMON_HTTP_BIND_PORT = 60912 +FILE_HANDLE_LIMIT = 8192 + FIRST_RUN_FILE_PATH = '/.dusty_first_time_started' CONTAINER_LOG_PATH = "/var/log" diff --git a/dusty/daemon.py b/dusty/daemon.py index c627a412..c4674b35 100644 --- a/dusty/daemon.py +++ b/dusty/daemon.py @@ -12,6 +12,7 @@ import logging import socket import threading +import resource # requests refused to play nicely with pyinstaller import httplib @@ -64,6 +65,14 @@ def close_client_connection(terminator=SOCKET_TERMINATOR): close_socket_logger() connection.close() +def _increase_file_handle_limit(): + """Raise the open file handles permitted by the Dusty daemon process + and its child processes. The number we choose here needs to be within + the OS X default kernel hard limit, which is 10240.""" + logging.info('Increasing file handle limit to {}'.format(constants.FILE_HANDLE_LIMIT)) + resource.setrlimit(resource.RLIMIT_NOFILE, + (constants.FILE_HANDLE_LIMIT, resource.RLIM_INFINITY)) + def shut_down_http_server(): logging.info('Daemon is shutting down HTTP server') try: @@ -137,6 +146,7 @@ def _listen_on_socket(socket_path, suppress_warnings): def main(): args = docopt(__doc__) configure_logging() + _increase_file_handle_limit() init_yaml_constructor() preflight_check() if args['--preflight-only']: