{"action":"created","issue":{"url":"https://api.github.com/repos/pyinstaller/pyinstaller/issues/1070","labels_url":"https://api.github.com/repos/pyinstaller/pyinstaller/issues/1070/labels{/name}","comments_url":"https://api.github.com/repos/pyinstaller/pyinstaller/issues/1070/comments","events_url":"https://api.github.com/repos/pyinstaller/pyinstaller/issues/1070/events","html_url":"https://github.com/pyinstaller/pyinstaller/issues/1070","id":47501404,"number":1070,"title":"\"ImportError: PYZ entry xxx failed to decompress\" in Gunicorn's worker process","user":{"login":"hyt-hz","id":2703311,"avatar_url":"https://avatars.githubusercontent.com/u/2703311?v=3","gravatar_id":"","url":"https://api.github.com/users/hyt-hz","html_url":"https://github.com/hyt-hz","followers_url":"https://api.github.com/users/hyt-hz/followers","following_url":"https://api.github.com/users/hyt-hz/following{/other_user}","gists_url":"https://api.github.com/users/hyt-hz/gists{/gist_id}","starred_url":"https://api.github.com/users/hyt-hz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hyt-hz/subscriptions","organizations_url":"https://api.github.com/users/hyt-hz/orgs","repos_url":"https://api.github.com/users/hyt-hz/repos","events_url":"https://api.github.com/users/hyt-hz/events{/privacy}","received_events_url":"https://api.github.com/users/hyt-hz/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/pyinstaller/pyinstaller/labels/Linux","name":"Linux","color":"d4c5f9"}],"state":"closed","locked":false,"assignee":{"login":"htgoebel","id":784161,"avatar_url":"https://avatars.githubusercontent.com/u/784161?v=3","gravatar_id":"","url":"https://api.github.com/users/htgoebel","html_url":"https://github.com/htgoebel","followers_url":"https://api.github.com/users/htgoebel/followers","following_url":"https://api.github.com/users/htgoebel/following{/other_user}","gists_url":"https://api.github.com/users/htgoebel/gists{/gist_id}","starred_url":"https://api.github.com/users/htgoebel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/htgoebel/subscriptions","organizations_url":"https://api.github.com/users/htgoebel/orgs","repos_url":"https://api.github.com/users/htgoebel/repos","events_url":"https://api.github.com/users/htgoebel/events{/privacy}","received_events_url":"https://api.github.com/users/htgoebel/received_events","type":"User","site_admin":false},"milestone":null,"comments":14,"created_at":"2014-11-01T09:12:36Z","updated_at":"2015-08-25T06:21:49Z","closed_at":"2015-06-30T12:27:38Z","body":"My Gunicorn application uses gevent wsgi server as its worker, and gunicorn forks multiple workers to better utilize multi-core CPUs. I bundled my application in one folder, but the bundled application failed randomly when starts up because the worker process failed immediately after forking.\r\n\r\n<pre><code>\r\n[2014-11-01 05:38:38 +0000] [872] [INFO] Booting worker with pid: 872\r\n[2014-11-01 05:38:38 +0000] [870] [ERROR] Exception in worker process:\r\nTraceback (most recent call last):\r\n  File \"/mnt/gss_hep/pyinstaller/build/gss/out00-PYZ.pyz/gunicorn.arbiter\", line 507, in spawn_worker\r\n  File \"/mnt/gss_hep/pyinstaller/build/gss/out00-PYZ.pyz/gunicorn.workers.ggevent\", line 193, in init_process\r\n  File \"/mnt/gss_hep/pyinstaller/build/gss/out00-PYZ.pyz/gunicorn.workers.base\", line 114, in init_process\r\n  File \"/mnt/gss_hep/pyinstaller/build/gss/out00-PYZ.pyz/gunicorn.app.base\", line 66, in wsgi\r\n  File \"<string>\", line 42, in load\r\n  File \"/home/hyt/pyenv/lib/python2.7/site-packages/PyInstaller/loader/pyi_importers.py\", line 270, in load_module\r\n    exec(bytecode, module.__dict__)\r\n  File \"/mnt/gss_hep/pyinstaller/build/gss/out00-PYZ.pyz/gss.api.rest\", line 9, in <module>\r\n  File \"/home/hyt/pyenv/lib/python2.7/site-packages/PyInstaller/loader/pyi_importers.py\", line 270, in load_module\r\n    exec(bytecode, module.__dict__)\r\n  File \"/mnt/gss_hep/pyinstaller/build/gss/out00-PYZ.pyz/flask\", line 19, in <module>\r\n  File \"/home/hyt/pyenv/lib/python2.7/site-packages/PyInstaller/loader/pyi_importers.py\", line 270, in load_module\r\n    exec(bytecode, module.__dict__)\r\n  File \"/mnt/gss_hep/pyinstaller/build/gss/out00-PYZ.pyz/jinja2\", line 33, in <module>\r\n  File \"/home/hyt/pyenv/lib/python2.7/site-packages/PyInstaller/loader/pyi_importers.py\", line 270, in load_module\r\n    exec(bytecode, module.__dict__)\r\n  File \"/mnt/gss_hep/pyinstaller/build/gss/out00-PYZ.pyz/jinja2.environment\", line 21, in <module>\r\n  File \"/home/hyt/pyenv/lib/python2.7/site-packages/PyInstaller/loader/pyi_importers.py\", line 202, in load_module\r\n    is_pkg, bytecode = self._pyz_archive.extract(fullname)\r\n  File \"/home/hyt/pyenv/lib/python2.7/site-packages/PyInstaller/loader/pyi_archive.py\", line 315, in extract\r\n    raise ImportError(\"PYZ entry '%s' failed to decompress\" % name)\r\nImportError: PYZ entry 'jinja2.parser' failed to decompress\r\n</pre></code>\r\n\r\nThe failed PYZ entry is random, and if set worker process to 1 (only forks 1 worker process), everyting is fine, so I am guessing there is some kind of race condition concerning the opened ZlibArchive file, since all the worker processors share the same fd, and there might be chance they are seeking and reading this file at the same time, when trying to import module from it.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/pyinstaller/pyinstaller/issues/comments/134493839","html_url":"https://github.com/pyinstaller/pyinstaller/issues/1070#issuecomment-134493839","issue_url":"https://api.github.com/repos/pyinstaller/pyinstaller/issues/1070","id":134493839,"user":{"login":"Bluehorn","id":975735,"avatar_url":"https://avatars.githubusercontent.com/u/975735?v=3","gravatar_id":"","url":"https://api.github.com/users/Bluehorn","html_url":"https://github.com/Bluehorn","followers_url":"https://api.github.com/users/Bluehorn/followers","following_url":"https://api.github.com/users/Bluehorn/following{/other_user}","gists_url":"https://api.github.com/users/Bluehorn/gists{/gist_id}","starred_url":"https://api.github.com/users/Bluehorn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Bluehorn/subscriptions","organizations_url":"https://api.github.com/users/Bluehorn/orgs","repos_url":"https://api.github.com/users/Bluehorn/repos","events_url":"https://api.github.com/users/Bluehorn/events{/privacy}","received_events_url":"https://api.github.com/users/Bluehorn/received_events","type":"User","site_admin":false},"created_at":"2015-08-25T06:21:49Z","updated_at":"2015-08-25T06:21:49Z","body":"I just tested the example above with commit 5967ae25ff5541d468eb36a0b640fc6dcdb6a77f and it is still broken. I don't grok why this ticket is closed?"}}