Skip to content

Commit

Permalink
Create the sys_path_lock lock after the double forks
Browse files Browse the repository at this point in the history
If we create the asyncio lock before we do the double forks, we get
an "Bad file descriptor" when we try to start the asyncio endless loop.

See: https://python-tornado.narkive.com/a9lCRPxp/errno-9-bad-file-descriptor#post2

Closes: #13
  • Loading branch information
goneri committed Oct 19, 2020
1 parent 55c7d54 commit 66d0a1b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion plugins/module_utils/turbo/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
EmbeddedModuleSuccess,
)

sys_path_lock = asyncio.Lock()
sys_path_lock = None

import ansible.module_utils.basic

Expand Down Expand Up @@ -223,6 +223,7 @@ def stop(self):
args = parser.parse_args()
if args.fork:
fork_process()
sys_path_lock = asyncio.Lock()

server = AnsibleVMwareTurboMode()
server.socket_path = args.socket_path
Expand Down

0 comments on commit 66d0a1b

Please sign in to comment.