{"action":"closed","issue":{"url":"https://api.github.com/repos/pytorch/pytorch/issues/1868","repository_url":"https://api.github.com/repos/pytorch/pytorch","labels_url":"https://api.github.com/repos/pytorch/pytorch/issues/1868/labels{/name}","comments_url":"https://api.github.com/repos/pytorch/pytorch/issues/1868/comments","events_url":"https://api.github.com/repos/pytorch/pytorch/issues/1868/events","html_url":"https://github.com/pytorch/pytorch/issues/1868","id":237626525,"node_id":"MDU6SXNzdWUyMzc2MjY1MjU=","number":1868,"title":"segfault in python multithreaded setting","user":{"login":"soumith","id":1310570,"node_id":"MDQ6VXNlcjEzMTA1NzA=","avatar_url":"https://avatars0.githubusercontent.com/u/1310570?v=4","gravatar_id":"","url":"https://api.github.com/users/soumith","html_url":"https://github.com/soumith","followers_url":"https://api.github.com/users/soumith/followers","following_url":"https://api.github.com/users/soumith/following{/other_user}","gists_url":"https://api.github.com/users/soumith/gists{/gist_id}","starred_url":"https://api.github.com/users/soumith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/soumith/subscriptions","organizations_url":"https://api.github.com/users/soumith/orgs","repos_url":"https://api.github.com/users/soumith/repos","events_url":"https://api.github.com/users/soumith/events{/privacy}","received_events_url":"https://api.github.com/users/soumith/received_events","type":"User","site_admin":false},"labels":[{"id":424131847,"node_id":"MDU6TGFiZWw0MjQxMzE4NDc=","url":"https://api.github.com/repos/pytorch/pytorch/labels/bug","name":"bug","color":"b60205","default":true},{"id":443484050,"node_id":"MDU6TGFiZWw0NDM0ODQwNTA=","url":"https://api.github.com/repos/pytorch/pytorch/labels/medium%20priority","name":"medium priority","color":"fbca04","default":false}],"state":"closed","locked":false,"assignee":{"login":"yf225","id":4063635,"node_id":"MDQ6VXNlcjQwNjM2MzU=","avatar_url":"https://avatars0.githubusercontent.com/u/4063635?v=4","gravatar_id":"","url":"https://api.github.com/users/yf225","html_url":"https://github.com/yf225","followers_url":"https://api.github.com/users/yf225/followers","following_url":"https://api.github.com/users/yf225/following{/other_user}","gists_url":"https://api.github.com/users/yf225/gists{/gist_id}","starred_url":"https://api.github.com/users/yf225/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yf225/subscriptions","organizations_url":"https://api.github.com/users/yf225/orgs","repos_url":"https://api.github.com/users/yf225/repos","events_url":"https://api.github.com/users/yf225/events{/privacy}","received_events_url":"https://api.github.com/users/yf225/received_events","type":"User","site_admin":false},"assignees":[{"login":"yf225","id":4063635,"node_id":"MDQ6VXNlcjQwNjM2MzU=","avatar_url":"https://avatars0.githubusercontent.com/u/4063635?v=4","gravatar_id":"","url":"https://api.github.com/users/yf225","html_url":"https://github.com/yf225","followers_url":"https://api.github.com/users/yf225/followers","following_url":"https://api.github.com/users/yf225/following{/other_user}","gists_url":"https://api.github.com/users/yf225/gists{/gist_id}","starred_url":"https://api.github.com/users/yf225/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yf225/subscriptions","organizations_url":"https://api.github.com/users/yf225/orgs","repos_url":"https://api.github.com/users/yf225/repos","events_url":"https://api.github.com/users/yf225/events{/privacy}","received_events_url":"https://api.github.com/users/yf225/received_events","type":"User","site_admin":false}],"milestone":null,"comments":10,"created_at":"2017-06-21T18:36:46Z","updated_at":"2018-11-12T23:29:17Z","closed_at":"2018-11-12T23:29:17Z","author_association":"MEMBER","body":"Zihang Dai reports (and I've reproduced) that the autograd engine is not thread-safe.\r\nHere's a repro script: https://gist.github.com/zihangdai/fc8f76fbb8a0f6323a6b31e6d98ceb50\r\nRun it a few times, occassionally it segfaults.\r\n\r\nSegfault is from a much different location, when cleaning up imports:\r\n\r\n```\r\nThread 1 \"python\" received signal SIGSEGV, Segmentation fault.\r\nmalloc_consolidate (av=av@entry=0x7ffff70a8b20 <main_arena>) at malloc.c:4167\r\n4167    malloc.c: No such file or directory.\r\n(gdb) where\r\n#0  malloc_consolidate (av=av@entry=0x7ffff70a8b20 <main_arena>) at malloc.c:4167\r\n#1  0x00007ffff6d64678 in _int_free (av=0x7ffff70a8b20 <main_arena>, p=<optimized out>, have_lock=0) at malloc.c:4075\r\n#2  0x00007ffff6d6853c in __GI___libc_free (mem=<optimized out>) at malloc.c:2968\r\n#3  0x00007ffff7a6a427 in dict_dealloc (mp=0x7ffff7ed0c58) at Objects/dictobject.c:1044\r\n#4  0x00007ffff7a682c7 in insertdict_by_entry (mp=0x7ffff7ed0d70, key='build_time_vars', hash=<optimized out>, ep=<optimized out>, value=<optimized out>) at Objects/dictobject.c:519\r\n#5  0x00007ffff7a6b79c in insertdict (value=None, hash=-295987683324531010, key='build_time_vars', mp=0x7ffff7ed0d70) at Objects/dictobject.c:556\r\n#6  dict_set_item_by_hash_or_entry (value=None, ep=0x0, hash=-295987683324531010, key='build_time_vars',\r\n    op={'__builtins__': {'bytearray': <type at remote 0x7ffff7d7c300>, 'IndexError': <type at remote 0x7ffff7d82bc0>, 'all': <built-in function all>, 'help': <_Helper at remote 0x7ffff7ed8c50>, 'vars': <built-in function vars>, 'SyntaxError': <type at remote 0x7ffff7d82540>, 'unicode': <type at remote 0x7ffff7d99040>, 'UnicodeDecodeError': <type at remote 0x7ffff7d833e0>, 'memoryview': <type at remote 0x7ffff7d8d900>, 'isinstance': <built-in function isinstance>, 'copyright': <_Printer(_Printer__data='Copyright (c) 2001-2016 Python Software Foundation.\\nAll Rights Reserved.\\n\\nCopyright (c) 2000 BeOpen.com.\\nAll Rights Reserved.\\n\\nCopyright (c) 1995-2001 Corporation for National Research Initiatives.\\nAll Rights Reserved.\\n\\nCopyright (c) 1991-1995 Stichting Mathematisch Centrum, Amsterdam.\\nAll Rights Reserved.', _Printer__lines=None, _Printer__name='copyright', _Printer__dirs=(), _Printer__files=(...)) at remote 0x7ffff7ed8a10>, 'NameError': <type at remote 0x7ffff7d82060>, 'BytesWarning': <type at remote 0x7ffff...(truncated)) at Objects/dictobject.c:795\r\n#7  PyDict_SetItem (\r\n    op={'__builtins__': {'bytearray': <type at remote 0x7ffff7d7c300>, 'IndexError': <type at remote 0x7ffff7d82bc0>, 'all': <built-in function all>, 'help': <_Helper at remote 0x7ffff7ed8c50>, 'vars': <built-in function vars>, 'SyntaxError': <type at remote 0x7ffff7d82540>, 'unicode': <type at remote 0x7ffff7d99040>, 'UnicodeDecodeError': <type at remote 0x7ffff7d833e0>, 'memoryview': <type at remote 0x7ffff7d8d900>, 'isinstance': <built-in function isinstance>, 'copyright': <_Printer(_Printer__data='Copyright (c) 2001-2016 Python Software Foundation.\\nAll Rights Reserved.\\n\\nCopyright (c) 2000 BeOpen.com.\\nAll Rights Reserved.\\n\\nCopyright (c) 1995-2001 Corporation for National Research Initiatives.\\nAll Rights Reserved.\\n\\nCopyright (c) 1991-1995 Stichting Mathematisch Centrum, Amsterdam.\\nAll Rights Reserved.', _Printer__lines=None, _Printer__name='copyright', _Printer__dirs=(), _Printer__files=(...)) at remote 0x7ffff7ed8a10>, 'NameError': <type at remote 0x7ffff7d82060>, 'BytesWarning': <type at remote 0x7ffff...(truncated), key='build_time_vars', value=None)\r\n    at Objects/dictobject.c:848\r\n#8  0x00007ffff7a6ea8d in _PyModule_Clear (m=<optimized out>) at Objects/moduleobject.c:139\r\n#9  0x00007ffff7aec4a1 in PyImport_Cleanup () at Python/import.c:512\r\n#10 0x00007ffff7af957b in Py_Finalize () at Python/pythonrun.c:458\r\n#11 0x00007ffff7b0f8e5 in Py_Main (argc=<optimized out>, argv=<optimized out>) at Modules/main.c:670\r\n#12 0x00007ffff6d04830 in __libc_start_main (main=0x4007f0 <main>, argc=2, argv=0x7fffffffe008, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffdff8) at ../csu/libc-start.c:291\r\n#13 0x0000000000400729 in _start ()\r\n```\r\n"}}
{"actor":{"display_login":"facebook-github-bot"}}