{"action":"created","issue":{"url":"https://api.github.com/repos/ethereum/web3.py/issues/443","repository_url":"https://api.github.com/repos/ethereum/web3.py","labels_url":"https://api.github.com/repos/ethereum/web3.py/issues/443/labels{/name}","comments_url":"https://api.github.com/repos/ethereum/web3.py/issues/443/comments","events_url":"https://api.github.com/repos/ethereum/web3.py/issues/443/events","html_url":"https://github.com/ethereum/web3.py/issues/443","id":275152658,"number":443,"title":"Suspicion that `@reject_recursive_repeats` is not thread-safe","user":{"login":"reverendus","id":10530476,"avatar_url":"https://avatars1.githubusercontent.com/u/10530476?v=4","gravatar_id":"","url":"https://api.github.com/users/reverendus","html_url":"https://github.com/reverendus","followers_url":"https://api.github.com/users/reverendus/followers","following_url":"https://api.github.com/users/reverendus/following{/other_user}","gists_url":"https://api.github.com/users/reverendus/gists{/gist_id}","starred_url":"https://api.github.com/users/reverendus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reverendus/subscriptions","organizations_url":"https://api.github.com/users/reverendus/orgs","repos_url":"https://api.github.com/users/reverendus/repos","events_url":"https://api.github.com/users/reverendus/events{/privacy}","received_events_url":"https://api.github.com/users/reverendus/received_events","type":"User","site_admin":false},"labels":[{"id":358201382,"url":"https://api.github.com/repos/ethereum/web3.py/labels/Bug","name":"Bug","color":"b60205","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-11-19T11:49:16Z","updated_at":"2017-11-22T21:27:53Z","closed_at":"2017-11-22T21:27:53Z","author_association":"CONTRIBUTOR","body":"* Version: 3.16.2\r\n* Python: 3.6\r\n* OS: osx\r\n\r\n\r\n### What was wrong?\r\n\r\nWhen executing a few contract calls concurrently, I kept getting errors like:\r\n\r\n```\r\nFile \"/usr/local/lib/python3.6/site-packages/web3/contract.py\", line 870, in call_contract_function\r\n    normalized_data = map_abi_data(normalizers, output_types, output_data)\r\n  File \"/usr/local/lib/python3.6/site-packages/eth_utils/string.py\", line 85, in inner\r\n    return force_obj_to_text(fn(*args, **kwargs))\r\n  File \"/usr/local/lib/python3.6/site-packages/web3/utils/abi.py\", line 437, in map_abi_data\r\n    return pipe(data, *pipeline)\r\n  File \"cytoolz/functoolz.pyx\", line 586, in cytoolz.functoolz.pipe (cytoolz/functoolz.c:10663)\r\n  File \"cytoolz/functoolz.pyx\", line 562, in cytoolz.functoolz.c_pipe (cytoolz/functoolz.c:10494)\r\n  File \"/usr/local/lib/python3.6/site-packages/web3/utils/decorators.py\", line 31, in wrapped\r\n    wrapped_val = to_wrap(*args)\r\n  File \"/usr/local/lib/python3.6/site-packages/web3/utils/formatters.py\", line 117, in recursive_map\r\n    items_mapped = map_collection(recurse, data)\r\n  File \"/usr/local/lib/python3.6/site-packages/web3/utils/formatters.py\", line 104, in map_collection\r\n    return datatype(map(func, collection))\r\n  File \"/usr/local/lib/python3.6/site-packages/web3/utils/formatters.py\", line 116, in recurse\r\n    return recursive_map(func, item)\r\n  File \"/usr/local/lib/python3.6/site-packages/web3/utils/decorators.py\", line 29, in wrapped\r\n    raise ValueError('Recursively called %s with %r' % (to_wrap, args))\r\nValueError: Recursively called <function recursive_map at 0x7f012ea030d0> with (<function strip_abi_type at 0x7f012ea06ae8>, ABITypedData(abi_type='address', data='0x168910909606A2Fca90D4C28Fa39b50407b9C526'))\r\n```\r\n\r\nand\r\n\r\n```\r\n  File \"/usr/local/lib/python3.6/site-packages/web3/contract.py\", line 870, in call_contract_function\r\n    normalized_data = map_abi_data(normalizers, output_types, output_data)\r\n  File \"/usr/local/lib/python3.6/site-packages/eth_utils/string.py\", line 85, in inner\r\n    return force_obj_to_text(fn(*args, **kwargs))\r\n  File \"/usr/local/lib/python3.6/site-packages/web3/utils/abi.py\", line 437, in map_abi_data\r\n    return pipe(data, *pipeline)\r\n  File \"cytoolz/functoolz.pyx\", line 586, in cytoolz.functoolz.pipe (cytoolz/functoolz.c:10663)\r\n  File \"cytoolz/functoolz.pyx\", line 562, in cytoolz.functoolz.c_pipe (cytoolz/functoolz.c:10494)\r\n  File \"/usr/local/lib/python3.6/site-packages/web3/utils/decorators.py\", line 29, in wrapped\r\n    raise ValueError('Recursively called %s with %r' % (to_wrap, args))\r\nValueError: Recursively called <function recursive_map at 0x7f012ea030d0> with (<function strip_abi_type at 0x7f012ea06ae8>, [ABITypedData(abi_type='uint256', data=1000000000000000000), ABITypedData(abi_type='address', data='0xC66eA802717bFb9833400264Dd12c2bCeAa34a6d'), ABITypedData(abi_type='uint256', data=100000000000000000000), ABITypedData(abi_type='address', data='0xECF8F87f810EcF450940c9f60066b4a7a501d6A7'), ABITypedData(abi_type='address', data='0xbe69Be9133DAA77AeAFcA0d6330c7Ba44f597b15'), ABITypedData(abi_type='bool', data=True), ABITypedData(abi_type='uint64', data=1505245070)])\r\n```\r\n\r\nWe are connecting to a Parity node.\r\n\r\n### How can it be fixed?\r\n\r\nMy suspicion is that because `@reject_recursive_repeats` keeps state in `to_wrap.__already_called`, this is not thread-safe and will fail if two threads want to parse the same data at the same time.\r\n"},"comment":{"url":"https://api.github.com/repos/ethereum/web3.py/issues/comments/346477905","html_url":"https://github.com/ethereum/web3.py/issues/443#issuecomment-346477905","issue_url":"https://api.github.com/repos/ethereum/web3.py/issues/443","id":346477905,"user":{"login":"carver","id":205327,"avatar_url":"https://avatars0.githubusercontent.com/u/205327?v=4","gravatar_id":"","url":"https://api.github.com/users/carver","html_url":"https://github.com/carver","followers_url":"https://api.github.com/users/carver/followers","following_url":"https://api.github.com/users/carver/following{/other_user}","gists_url":"https://api.github.com/users/carver/gists{/gist_id}","starred_url":"https://api.github.com/users/carver/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carver/subscriptions","organizations_url":"https://api.github.com/users/carver/orgs","repos_url":"https://api.github.com/users/carver/repos","events_url":"https://api.github.com/users/carver/events{/privacy}","received_events_url":"https://api.github.com/users/carver/received_events","type":"User","site_admin":false},"created_at":"2017-11-22T21:27:53Z","updated_at":"2017-11-22T21:27:53Z","author_association":"COLLABORATOR","body":"Released in v3.16.3"}}
{"actor":{"display_login":"carver"}}