-
Notifications
You must be signed in to change notification settings - Fork 37.7k
test: Fix p2p_invalid_messages failing in Python 3.8 because of warning #17931
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I think it's somewhat strange for the test to fail on a warning, but I also think this change makes sense. ACK f117fb0 if it passes travis |
I think currently the tests fail if the python side prints anything to stdout/stderr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK f117fb0 - observed the failure (it's the only test that fails) with Python 3.8.1, tested the fix with 3.5.6 and 3.8.1. This is our only usage of asyncio.coroutine
.
72/136 - p2p_invalid_messages.py failed, Duration: 9 s
stdout:
2020-01-16T09:37:44.223000Z TestFramework (INFO): Initializing test directory /var/folders/z2/cn877pxd3czdfh47mfkmbwgm0000gn/T/test_runner_₿_🏃_20200116_173347/p2p_invalid_messages_62
2020-01-16T09:37:46.045000Z TestFramework (INFO): Sending a bunch of large, junk messages to test memory exhaustion. May take a bit...
2020-01-16T09:37:51.293000Z TestFramework (INFO): Waiting for node to drop junk messages.
2020-01-16T09:37:51.344000Z TestFramework (INFO): Skipping test p2p_invalid_messages/1 (oversized message) under macOS
2020-01-16T09:37:51.348000Z TestFramework (INFO): Sending a message with incorrect size of 2
2020-01-16T09:37:51.413000Z TestFramework.mininode (WARNING): Connection lost to 127.0.0.1:11744 due to [Errno 54] Connection reset by peer
2020-01-16T09:37:51.525000Z TestFramework (INFO): Sending a message with incorrect size of 77
2020-01-16T09:37:51.585000Z TestFramework.mininode (WARNING): Connection lost to 127.0.0.1:11744 due to [Errno 54] Connection reset by peer
2020-01-16T09:37:51.692000Z TestFramework (INFO): Sending a message with incorrect size of 78
2020-01-16T09:37:51.880000Z TestFramework (INFO): Sending a message with incorrect size of 79
2020-01-16T09:37:52.212000Z TestFramework (INFO): Stopping nodes
2020-01-16T09:37:52.691000Z TestFramework (INFO): Cleaning up /var/folders/z2/cn877pxd3czdfh47mfkmbwgm0000gn/T/test_runner_₿_🏃_20200116_173347/p2p_invalid_messages_62 on exit
2020-01-16T09:37:52.691000Z TestFramework (INFO): Tests successful
stderr:
/Users/michael/github/bitcoin/test/functional/p2p_invalid_messages.py:154: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
asyncio.run_coroutine_threadsafe(asyncio.coroutine(swap_magic_bytes)(), NetworkThread.network_event_loop).result()
…cause of warning f117fb0 Replace coroutine with async def in p2p_invalid_messages.py (Elichai Turkel) Pull request description: In Python 3.8 `p2p_invalid_messages.py` fails because of the following warning python produce: ``` 2020-01-15T13:02:14.486000Z TestFramework (INFO): Initializing test directory /tmp/bitcoin_func_test_3xq0f6uh ./test/functional/p2p_invalid_messages.py:154: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead asyncio.run_coroutine_threadsafe(asyncio.coroutine(swap_magic_bytes)(), NetworkThread.network_event_loop).result() 2020-01-15T13:02:15.306000Z TestFramework (INFO): Sending a bunch of large, junk messages to test memory exhaustion. May take a bit... 2020-01-15T13:02:17.971000Z TestFramework (INFO): Waiting for node to drop junk messages. 2020-01-15T13:02:18.042000Z TestFramework.mininode (WARNING): Connection lost to 127.0.0.1:12826 due to [Errno 104] Connection reset by peer 2020-01-15T13:02:18.141000Z TestFramework (INFO): Sending a message with incorrect size of 2 2020-01-15T13:02:18.293000Z TestFramework (INFO): Sending a message with incorrect size of 77 2020-01-15T13:02:18.344000Z TestFramework.mininode (WARNING): Connection lost to 127.0.0.1:12826 due to [Errno 104] Connection reset by peer 2020-01-15T13:02:18.445000Z TestFramework (INFO): Sending a message with incorrect size of 78 2020-01-15T13:02:18.597000Z TestFramework (INFO): Sending a message with incorrect size of 79 2020-01-15T13:02:18.902000Z TestFramework (INFO): Stopping nodes 2020-01-15T13:02:19.154000Z TestFramework (INFO): Cleaning up /tmp/bitcoin_func_test_3xq0f6uh on exit 2020-01-15T13:02:19.154000Z TestFramework (INFO): Tests successful ``` so as it says I replaced the co-routine with `async def` which IIUC is supported since Python 3.5, so this makes the test pass both on 3.5+ and on 3.8 https://docs.python.org/3.5/library/asyncio-task.html ("The async def type of coroutine was added in Python 3.5, and is recommended if there is no need to support older Python versions") ACKs for top commit: laanwj: ACK f117fb0 if it passes travis fanquake: ACK f117fb0 - observed the failure (it's the only test that fails) with Python 3.8.1, tested the fix with 3.5.6 and 3.8.1. This is our only usage of `asyncio.coroutine`. Tree-SHA512: c21d50b23ef4d8a777fd1d9dfe433c85b0b5fff35afbd338817021ffcd42caea64b4c70e46cb3a8a543a1bf2aaa9a6b4f075f6493ab64192bc12bf8bafc54a87
- doc: fix git add argument bitcoin#18513 - build: Fix libevent linking for bench_bitcoin binary bitcoin#18397 - script: fix SCRIPT_ERR_SIG_PUSHONLY error string bitcoin#18412 - doc: Comment fix merkle.cpp bitcoin#18379 - log: Fix UB with bench on genesis block bitcoin#15283 - test: Fix mining to an invalid target + ensure that a new block has the correct hash internally bitcoin#18350 - Fix missing header in sync.h bitcoin#18357 - refactor: Fix implicit value conversion in formatPingTime bitcoin#18260 - Fix .gitignore policy in build_msvc directory bitcoin#18108 - build: Fix behavior when ALLOW_HOST_PACKAGES unset bitcoin#18051 - test: Fix p2p_invalid_messages failing in Python 3.8 because of warning bitcoin#17931 - qa: Fix double-negative arg test bitcoin#17893 - build: Fix configure report about qr bitcoin#17547 - log: Fix log message for -par=1 bitcoin#17325 - bench: Fix negative values and zero for -evals flag bitcoin#17267 - depends: fix boost mac cross build with clang 9+ bitcoin#17231 - doc: Fix broken bitcoin-cli examples bitcoin#17119 - doc: fix Makefile target in benchmarking.md bitcoin#17081 - contrib: fix minor typos in makeseeds.py bitcoin#17042 - test: Fix Python Docstring to include all Args. bitcoin#17030 - doc: Fix some misspellings bitcoin#17351 - doc: Doxygen-friendly script/descriptor.h comments bitcoin#16947 - doc: Fix doxygen errors bitcoin#17945 - doc: Doxygen-friendly CuckooCache comments bitcoin#16986 - doc: Add to Doxygen documentation guidelines bitcoin#17873
- doc: fix git add argument bitcoin#18513 - build: Fix libevent linking for bench_bitcoin binary bitcoin#18397 - script: fix SCRIPT_ERR_SIG_PUSHONLY error string bitcoin#18412 - doc: Comment fix merkle.cpp bitcoin#18379 - log: Fix UB with bench on genesis block bitcoin#15283 - test: Fix mining to an invalid target + ensure that a new block has the correct hash internally bitcoin#18350 - Fix missing header in sync.h bitcoin#18357 - refactor: Fix implicit value conversion in formatPingTime bitcoin#18260 - Fix .gitignore policy in build_msvc directory bitcoin#18108 - build: Fix behavior when ALLOW_HOST_PACKAGES unset bitcoin#18051 - test: Fix p2p_invalid_messages failing in Python 3.8 because of warning bitcoin#17931 - qa: Fix double-negative arg test bitcoin#17893 - build: Fix configure report about qr bitcoin#17547 - log: Fix log message for -par=1 bitcoin#17325 - bench: Fix negative values and zero for -evals flag bitcoin#17267 - depends: fix boost mac cross build with clang 9+ bitcoin#17231 - doc: Fix broken bitcoin-cli examples bitcoin#17119 - doc: fix Makefile target in benchmarking.md bitcoin#17081 - contrib: fix minor typos in makeseeds.py bitcoin#17042 - test: Fix Python Docstring to include all Args. bitcoin#17030 - doc: Fix some misspellings bitcoin#17351 - doc: Doxygen-friendly script/descriptor.h comments bitcoin#16947 - doc: Fix doxygen errors bitcoin#17945 - doc: Doxygen-friendly CuckooCache comments bitcoin#16986 - doc: Add to Doxygen documentation guidelines bitcoin#17873 - depends: Consistent use of package variable bitcoin#17928 - init: Replace URL_WEBSITE with PACKAGE_URL bitcoin#18503 - doc: Add missed copyright headers bitcoin#17691
…cause of warning Summary: f117fb00da747147cddfb071c1427a2754c278cd Replace coroutine with async def in p2p_invalid_messages.py (Elichai Turkel) Pull request description: In Python 3.8 `p2p_invalid_messages.py` fails because of the following warning python produce: ``` 2020-01-15T13:02:14.486000Z TestFramework (INFO): Initializing test directory /tmp/bitcoin_func_test_3xq0f6uh ./test/functional/p2p_invalid_messages.py:154: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead asyncio.run_coroutine_threadsafe(asyncio.coroutine(swap_magic_bytes)(), NetworkThread.network_event_loop).result() 2020-01-15T13:02:15.306000Z TestFramework (INFO): Sending a bunch of large, junk messages to test memory exhaustion. May take a bit... 2020-01-15T13:02:17.971000Z TestFramework (INFO): Waiting for node to drop junk messages. 2020-01-15T13:02:18.042000Z TestFramework.mininode (WARNING): Connection lost to 127.0.0.1:12826 due to [Errno 104] Connection reset by peer 2020-01-15T13:02:18.141000Z TestFramework (INFO): Sending a message with incorrect size of 2 2020-01-15T13:02:18.293000Z TestFramework (INFO): Sending a message with incorrect size of 77 2020-01-15T13:02:18.344000Z TestFramework.mininode (WARNING): Connection lost to 127.0.0.1:12826 due to [Errno 104] Connection reset by peer 2020-01-15T13:02:18.445000Z TestFramework (INFO): Sending a message with incorrect size of 78 2020-01-15T13:02:18.597000Z TestFramework (INFO): Sending a message with incorrect size of 79 2020-01-15T13:02:18.902000Z TestFramework (INFO): Stopping nodes 2020-01-15T13:02:19.154000Z TestFramework (INFO): Cleaning up /tmp/bitcoin_func_test_3xq0f6uh on exit 2020-01-15T13:02:19.154000Z TestFramework (INFO): Tests successful ``` so as it says I replaced the co-routine with `async def` which IIUC is supported since Python 3.5, so this makes the test pass both on 3.5+ and on 3.8 https://docs.python.org/3.5/library/asyncio-task.html ("The async def type of coroutine was added in Python 3.5, and is recommended if there is no need to support older Python versions") ACKs for top commit: laanwj: ACK f117fb00da747147cddfb071c1427a2754c278cd if it passes travis fanquake: ACK f117fb00da747147cddfb071c1427a2754c278cd - observed the failure (it's the only test that fails) with Python 3.8.1, tested the fix with 3.5.6 and 3.8.1. This is our only usage of `asyncio.coroutine`. Tree-SHA512: c21d50b23ef4d8a777fd1d9dfe433c85b0b5fff35afbd338817021ffcd42caea64b4c70e46cb3a8a543a1bf2aaa9a6b4f075f6493ab64192bc12bf8bafc54a87 Backport of Core [[bitcoin/bitcoin#17931 | PR17931]] This fixes an issue that @deadalnix experienced where Python 3.8+ fails on this test. Test Plan: ``` test_runner.py p2p_invalid_messages ``` Reviewers: #bitcoin_abc, deadalnix Reviewed By: #bitcoin_abc, deadalnix Subscribers: deadalnix Differential Revision: https://reviews.bitcoinabc.org/D6462
…cause of warning Summary: f117fb00da747147cddfb071c1427a2754c278cd Replace coroutine with async def in p2p_invalid_messages.py (Elichai Turkel) Pull request description: In Python 3.8 `p2p_invalid_messages.py` fails because of the following warning python produce: ``` 2020-01-15T13:02:14.486000Z TestFramework (INFO): Initializing test directory /tmp/bitcoin_func_test_3xq0f6uh ./test/functional/p2p_invalid_messages.py:154: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead asyncio.run_coroutine_threadsafe(asyncio.coroutine(swap_magic_bytes)(), NetworkThread.network_event_loop).result() 2020-01-15T13:02:15.306000Z TestFramework (INFO): Sending a bunch of large, junk messages to test memory exhaustion. May take a bit... 2020-01-15T13:02:17.971000Z TestFramework (INFO): Waiting for node to drop junk messages. 2020-01-15T13:02:18.042000Z TestFramework.mininode (WARNING): Connection lost to 127.0.0.1:12826 due to [Errno 104] Connection reset by peer 2020-01-15T13:02:18.141000Z TestFramework (INFO): Sending a message with incorrect size of 2 2020-01-15T13:02:18.293000Z TestFramework (INFO): Sending a message with incorrect size of 77 2020-01-15T13:02:18.344000Z TestFramework.mininode (WARNING): Connection lost to 127.0.0.1:12826 due to [Errno 104] Connection reset by peer 2020-01-15T13:02:18.445000Z TestFramework (INFO): Sending a message with incorrect size of 78 2020-01-15T13:02:18.597000Z TestFramework (INFO): Sending a message with incorrect size of 79 2020-01-15T13:02:18.902000Z TestFramework (INFO): Stopping nodes 2020-01-15T13:02:19.154000Z TestFramework (INFO): Cleaning up /tmp/bitcoin_func_test_3xq0f6uh on exit 2020-01-15T13:02:19.154000Z TestFramework (INFO): Tests successful ``` so as it says I replaced the co-routine with `async def` which IIUC is supported since Python 3.5, so this makes the test pass both on 3.5+ and on 3.8 https://docs.python.org/3.5/library/asyncio-task.html ("The async def type of coroutine was added in Python 3.5, and is recommended if there is no need to support older Python versions") ACKs for top commit: laanwj: ACK f117fb00da747147cddfb071c1427a2754c278cd if it passes travis fanquake: ACK f117fb00da747147cddfb071c1427a2754c278cd - observed the failure (it's the only test that fails) with Python 3.8.1, tested the fix with 3.5.6 and 3.8.1. This is our only usage of `asyncio.coroutine`. Tree-SHA512: c21d50b23ef4d8a777fd1d9dfe433c85b0b5fff35afbd338817021ffcd42caea64b4c70e46cb3a8a543a1bf2aaa9a6b4f075f6493ab64192bc12bf8bafc54a87 Backport of Core [[bitcoin/bitcoin#17931 | PR17931]] This fixes an issue that @deadalnix experienced where Python 3.8+ fails on this test. Test Plan: ``` test_runner.py p2p_invalid_messages ``` Differential Revision: https://reviews.bitcoinabc.org/D6462
…t framework update) 7b04c0a [Test] Clean duplicate connections creation in mining_pos_coldStaking.py (furszy) 15a799e [Test] MAX_PROTOCOL_MESSAGE_LENGTH PIVXified. (furszy) 0aedf35 [tests] Don't import asyncio to test magic bytes (John Newbery) 9bb5309 Refactor resource exhaustion test (Troy Giorshev) 589a780 Fix "invalid message size" test (Troy Giorshev) 8a0c12b Move size limits to module-global (Troy Giorshev) b3391c5 Remove two unneeded tests (Troy Giorshev) 1404e68 test: Add various low-level p2p tests (furszy) 8aaf7e1 test: Remove fragile assert_memory_usage_stable (MarcoFalke) f68e22c [Test] p2p_invalid_messages.py do not change msg.command in test_command and raise sync_with_ping timeout (furszy) c851c0b Test framework: Wait for verack by default on every new connection (furszy) c02e9a0 [Test] move framework subversion to string (furszy) 3472a39 Replace coroutine with async def in p2p_invalid_messages.py (Elichai Turkel) 33c7b19 net_processing: align msg checksum check properly. (furszy) 7f71b1b Hash P2P messages as they are received instead of at process-time (furszy) 215a638 test: Skip flaky p2p_invalid_messages test on macOS (Fabian Jahr) c11f565 qa: Make swap_magic_bytes in p2p_invalid_messages atomic (MarcoFalke) be979ad test: Fix race in p2p_invalid_messages (MarcoFalke) 6a72f0c qa: Add tests for invalid message headers (MarcoFalke) 51ddd3d Introduce p2p_invalid_messages.py test (furszy) 55a37b5 net: fix missing jump line in "Oversized message from peer.." error. (furszy) 0edfce5 test_node: get_mem_rss fixups (MarcoFalke) 6f21213 tests: add P2PConnection.send_raw_message (James O'Beirne) ae68c6e tests: add utility to assert node memory usage hasn't increased (James O'Beirne) 8469afe test: forward timeouts properly in send_blocks_and_test (James O'Beirne) db28a53 Skip is_closing() check when not available. (Daniel Kraft) be9dacb tests: fixes mininode's P2PConnection sending messages on closing transport (marcoagner) 53599c8 qa: Avoid start/stop of the network thread mid-test (furszy) 688190c [qa] mininode: Expose connection state through is_connected (MarcoFalke) Pull request description: Part of the deep and long net and ser work that I'm doing (and Tor v3 onion addresses support). Friend of #2359. Focused on the end goal of implementing the `p2p_invalid_messages` functional test which validates that invalid msg headers, msg types, oversized payloads and inventory msgs aren't accepted nor can cause a resource exhaustion. And an extra covered scenario, in `p2p_invalid_tx.py`, for the orphan pool overflow. Plus, to get up to the goal, had to work over the functional test framework as well. So.. adapted list: * bitcoin#9045. * bitcoin#13512. * bitcoin#13517. * bitcoin#13715. * bitcoin#13747. * bitcoin#14456. * bitcoin#14522. * bitcoin#14672. * bitcoin#14693. * bitcoin#14812. * bitcoin#15246. * bitcoin#15330. * bitcoin#15697. * bitcoin#16445. * bitcoin#17931. * bitcoin#17469. * bitcoin#18628 (only `p2p_invalid_tx.py` and `p2p_invalid_messages.py`. We don't support the other tests yet). * bitcoin#19177. * bitcoin#19264. ACKs for top commit: random-zebra: utACK 7b04c0a and merging... Tree-SHA512: 48d1f1a6acc24a9abce033fbf1f281ba4392147da39d118a694a09d63c3e0610cc1a29d711b434b16cc0d0e030dd9f1a89843870091b6999b862b9ab18a20679
…ecause of warning
In Python 3.8
p2p_invalid_messages.py
fails because of the following warning python produce:so as it says I replaced the co-routine with
async def
which IIUC is supported since Python 3.5, so this makes the test pass both on 3.5+ and on 3.8https://docs.python.org/3.5/library/asyncio-task.html ("The async def type of coroutine was added in Python 3.5, and is recommended if there is no need to support older Python versions")