{"action":"opened","issue":{"url":"https://api.github.com/repos/nvie/rq/issues/709","repository_url":"https://api.github.com/repos/nvie/rq","labels_url":"https://api.github.com/repos/nvie/rq/issues/709/labels{/name}","comments_url":"https://api.github.com/repos/nvie/rq/issues/709/comments","events_url":"https://api.github.com/repos/nvie/rq/issues/709/events","html_url":"https://github.com/nvie/rq/issues/709","id":156522399,"number":709,"title":"Signal handlers and multiprocessing library conflict","user":{"login":"uiii","id":179219,"avatar_url":"https://avatars.githubusercontent.com/u/179219?v=3","gravatar_id":"","url":"https://api.github.com/users/uiii","html_url":"https://github.com/uiii","followers_url":"https://api.github.com/users/uiii/followers","following_url":"https://api.github.com/users/uiii/following{/other_user}","gists_url":"https://api.github.com/users/uiii/gists{/gist_id}","starred_url":"https://api.github.com/users/uiii/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uiii/subscriptions","organizations_url":"https://api.github.com/users/uiii/orgs","repos_url":"https://api.github.com/users/uiii/repos","events_url":"https://api.github.com/users/uiii/events{/privacy}","received_events_url":"https://api.github.com/users/uiii/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-05-24T14:27:38Z","updated_at":"2016-05-24T14:27:38Z","closed_at":null,"body":"Hi, I have a problem when I use `rq` and `multiprocessing` together. The problem is because `rq` set custom signal handlers, so when I need to terminate the process I get an error and the process is not terminated. I had this problem specifically with `fusepy` library.\r\n\r\nConsider this code example:\r\n\r\n```python\r\nredis = redis.StrictRedis()\r\nqueue = rq.Queue(connection=redis)\r\nworker = rq.SimpleWorker(\r\n        queues=[queue],\r\n        connection=redis\r\n)\r\nworker.work(burst=True) \r\n\r\n# solution comes here (see bellow)\r\n...\r\n\r\nprocess = Process(\r\n    target=FUSE, \r\n    args=(fuse_operations, moutpoint, nothreads=True, foreground=foreground,), \r\n    daemon=True)\r\n\r\nprocess.start()\r\n    \r\n...\r\n\r\nprocess.terminate()  # this throws error\r\n```\r\n\r\nAt the last line I get an error, but the fuse process is not terminated:\r\n```\r\nTraceback (most recent call last):\r\n  File \"_ctypes/callbacks.c\", line 234, in 'calling callback function'\r\n  File \"/home/uiii/.cache/virtualenv/konzum/lib/python3.5/site-packages/fuse.py\", line 490, in _wrapper\r\n    @staticmethod\r\n  File \"/home/uiii/.cache/virtualenv/konzum/lib/python3.5/site-packages/rq/worker.py\", line 363, in request_stop\r\n    raise StopRequested()\r\nrq.worker.StopRequested\r\nfuse: bad error value: 32708112\r\n```\r\n\r\nSolution? Just add these two lines after `worker.work`:\r\n```\r\nsignal.signal(signal.SIGINT, signal.SIG_DFL)\r\nsignal.signal(signal.SIGTERM, signal.SIG_DFL)\r\n```"}}
{"actor":{"display_login":"uiii"}}