From b34b7d4270eda98ee8e87516c044161232b335ae Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Tue, 16 Oct 2018 12:11:52 +0200 Subject: [PATCH] [FIX] server.py: `resource` is not available on Windows Rev. dcb56412d667231c5427b0cd76cfc1c6c4b1dd3c introduces limits for the threadedserver It uses `resource` to set the hard limit, but unfortunately `resource` is not available on Windows. As in the GeventServer, we therefore set the resource hard limit within a `if os.name == 'posix'` block, as in rev. c68b41bff2d5421e48b990da90362264a3c16a81 --- odoo/service/server.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/odoo/service/server.py b/odoo/service/server.py index a9b71404cfb..ebe4c57609c 100644 --- a/odoo/service/server.py +++ b/odoo/service/server.py @@ -341,13 +341,12 @@ class ThreadedServer(CommonServer): signal.signal(signal.SIGXCPU, self.signal_handler) signal.signal(signal.SIGQUIT, dumpstacks) signal.signal(signal.SIGUSR1, log_ormcache_stats) + soft, hard = resource.getrlimit(resource.RLIMIT_AS) + resource.setrlimit(resource.RLIMIT_AS, (config['limit_memory_hard'], hard)) elif os.name == 'nt': import win32api win32api.SetConsoleCtrlHandler(lambda sig: self.signal_handler(sig, None), 1) - soft, hard = resource.getrlimit(resource.RLIMIT_AS) - resource.setrlimit(resource.RLIMIT_AS, (config['limit_memory_hard'], hard)) - test_mode = config['test_enable'] or config['test_file'] if test_mode or (config['http_enable'] and not stop): # some tests need the http deamon to be available...