Skip to content
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

stop and join watchdog observer #11706

Merged
merged 1 commit into from
Jun 8, 2022
Merged

Conversation

altendky
Copy link
Contributor

@altendky altendky commented May 29, 2022

Draft for:

Note possible upstream fix for the issue at gorakhargosh/watchdog#895 being tested in #11710.

This is in accordance with the watchdog example. For inotify at least the .stop() call ends up calling the remove unschedule call anyways.

https://github.com/gorakhargosh/watchdog/tree/72f2eb7203659c11c4f0703c818dcb88fe527e99#example-api-usage

This appears to be only used in test code. This lowers the bar for trying this out in main to see how it holds up but also raises the question of why we aren't doing any shutdown at all for normal runs, seemingly.

This was found while looking into the following traceback we occasionally get in CI.

 ____________ ERROR at teardown of TestWalletSync.test_almost_recent ____________
venv/lib/python3.10/site-packages/_pytest/runner.py:338: in from_call
    result: Optional[TResult] = func()
venv/lib/python3.10/site-packages/_pytest/runner.py:259: in <lambda>
    lambda: ihook(item=item, **kwds), when=when, reraise=reraise
venv/lib/python3.10/site-packages/pluggy/_hooks.py:265: in __call__
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
venv/lib/python3.10/site-packages/pluggy/_manager.py:80: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
venv/lib/python3.10/site-packages/_pytest/threadexception.py:88: in pytest_runtest_teardown
    yield from thread_exception_runtest_hook()
venv/lib/python3.10/site-packages/_pytest/threadexception.py:73: in thread_exception_runtest_hook
    warnings.warn(pytest.PytestUnhandledThreadExceptionWarning(msg))
E   pytest.PytestUnhandledThreadExceptionWarning: Exception in thread Thread-44
E   
E   Traceback (most recent call last):
E     File "/opt/hostedtoolcache/Python/3.10.4/x64/lib/python3.10/threading.py", line 1009, in _bootstrap_inner
E       self.run()
E     File "/home/runner/work/chia-blockchain/chia-blockchain/venv/lib/python3.10/site-packages/watchdog/observers/inotify_buffer.py", line 88, in run
E       inotify_events = self._inotify.read_events()
E     File "/home/runner/work/chia-blockchain/chia-blockchain/venv/lib/python3.10/site-packages/watchdog/observers/inotify_c.py", line 285, in read_events
E       event_buffer = os.read(self._inotify_fd, event_buffer_size)
E   OSError: [Errno 9] Bad file descriptor

I don't have any historical data on how often this was happening so the several CI reruns below aren't any sort of proof that the issue is actually fixed. I just figured I'd give it a chance to still pop up and also collect a list of other flakes that are still hanging around. So far it looks like CI is in a pretty good state right now in terms of flakes. But yeah, the bad file descriptor issue did still show up with just this change.

This is in accordance with the example.  For inotify at least the `.stop()`
call ends up calling the removed unschedule call anyways.

https://github.com/gorakhargosh/watchdog/tree/72f2eb7203659c11c4f0703c818dcb88fe527e99#example-api-usage
@altendky altendky requested a review from paninaro May 29, 2022 21:47
@altendky altendky closed this May 29, 2022
@altendky altendky reopened this May 29, 2022
@altendky
Copy link
Contributor Author

Tracking flakes while rerunning this.

https://github.com/Chia-Network/chia-blockchain/runs/6646220657?check_suite_focus=true

=================================== FAILURES ===================================
______________________ test_get_transaction_count[False] _______________________
tests/wallet/rpc/test_wallet_rpc.py:517: in test_get_transaction_count
    await generate_funds(full_node_api, env.wallet_1)
tests/wallet/rpc/test_wallet_rpc.py:82: in generate_funds
    initial_balances = await wallet_bundle.rpc_client.get_wallet_balance(str(wallet_id))
chia/rpc/wallet_rpc_client.py:92: in get_wallet_balance
    return (await self.fetch("get_wallet_balance", {"wallet_id": wallet_id}))["wallet_balance"]
chia/rpc/rpc_client.py:[46](https://github.com/Chia-Network/chia-blockchain/runs/6646220657?check_suite_focus=true#step:10:47): in fetch
    response.raise_for_status()
venv/lib/python3.10/site-packages/aiohttp/client_reqrep.py:1004: in raise_for_status
    raise ClientResponseError(
E   aiohttp.client_exceptions.ClientResponseError: 404, message='Not Found', url=URL('https://localhost:44815/get_wallet_balance')
---------------------------- Captured stdout setup -----------------------------
  create_block_tools_async called 58 times
Found private CA in /tmp/tmpcjwpfu9i, using it to generate TLS certificates
BlockTools daemon port: [47](https://github.com/Chia-Network/chia-blockchain/runs/6646220657?check_suite_focus=true#step:10:48)607
  create_block_tools_async called [59](https://github.com/Chia-Network/chia-blockchain/runs/6646220657?check_suite_focus=true#step:10:60) times
Found private CA in /tmp/tmp9m5ybcyo, using it to generate TLS certificates
BlockTools daemon port: 22378
  create_block_tools_async called [60](https://github.com/Chia-Network/chia-blockchain/runs/6646220657?check_suite_focus=true#step:10:61) times
Found private CA in /tmp/tmp6n3e4izc, using it to generate TLS certificates
BlockTools daemon port: 17606
=========================== short test summary info ============================
FAILED tests/wallet/rpc/test_wallet_rpc.py::test_get_transaction_count[False]

@altendky altendky closed this May 29, 2022
@altendky altendky reopened this May 29, 2022
@altendky altendky closed this May 29, 2022
@altendky altendky reopened this May 29, 2022
@altendky altendky closed this May 29, 2022
@altendky altendky reopened this May 29, 2022
@altendky altendky closed this May 29, 2022
@altendky altendky reopened this May 29, 2022
@altendky altendky closed this May 30, 2022
@altendky altendky reopened this May 30, 2022
@altendky
Copy link
Contributor Author

PyPI went down for a bit.

@altendky altendky closed this May 30, 2022
@altendky altendky reopened this May 30, 2022
@altendky altendky closed this May 30, 2022
@altendky altendky reopened this May 30, 2022
@altendky
Copy link
Contributor Author

https://github.com/Chia-Network/chia-blockchain/runs/6646942280?check_suite_focus=true

=================================== FAILURES ===================================
__________ TestFullSync.test_sync_from_fork_point_and_weight_proof[1] __________
[gw1] darwin -- Python 3.10.4 /Users/runner/work/chia-blockchain/chia-blockchain/venv/bin/python
tests/core/full_node/full_sync/test_full_sync.py:160: in test_sync_from_fork_point_and_weight_proof
    await time_out_assert(180, node_height_exactly, True, full_node_2, num_blocks_initial - 1)
E   AssertionError: Timed assertion timed out after 180 seconds: expected True, got False
---------------------------- Captured stdout setup -----------------------------
  create_block_tools called 1 times
Found private CA in /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/tmptqn458q1, using it to generate TLS certificates
BlockTools daemon port: 60245
File found at: /Users/runner/work/chia-blockchain/chia-blockchain/.chia/blocks/test_blocks_1000_rc5.db

 loaded /Users/runner/work/chia-blockchain/chia-blockchain/.chia/blocks/test_blocks_1000_rc5.db with 1000 blocks
File found at: /Users/runner/work/chia-blockchain/chia-blockchain/.chia/blocks/test_blocks_400_rc5.db

 loaded /Users/runner/work/chia-blockchain/chia-blockchain/.chia/blocks/test_blocks_400_rc5.db with 400 blocks
  create_block_tools_async called 1 times
Found private CA in /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/tmpp7_1lz_z, using it to generate TLS certificates
BlockTools daemon port: 7530
  create_block_tools_async called 2 times
Found private CA in /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/tmpnmipu6mw, using it to generate TLS certificates
BlockTools daemon port: 4[114](https://github.com/Chia-Network/chia-blockchain/runs/6646942280?check_suite_focus=true#step:10:115)6
  create_block_tools_async called 3 times
Found private CA in /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/tmprik1rzl2, using it to generate TLS certificates
BlockTools daemon port: 39257
------------------------------ Captured log call -------------------------------
00:41:35 chia.full_node.full_node: ERROR got weight proof request for unknown peak 6b51d431df5d7f141cbececcf79edf3dd861c3b4069f0b11661a3eefacbba918
---------------------------- Captured log teardown -----------------------------
00:44:37 chia.consensus.blockchain: ERROR Error while adding block 94ecfcd24e58ba413acc4925ff4b7b09c2a6b27938d420bfbf6c2ce98fd7b55d height 857, rolling back: Traceback (most recent call last):
  File "/Users/runner/work/chia-blockchain/chia-blockchain/chia/consensus/blockchain.py", line 273, in receive_block
    await self.block_store.add_full_block(header_hash, block, block_record)
  File "/Users/runner/work/chia-blockchain/chia-blockchain/chia/full_node/block_store.py", line 179, in add_full_block
    async with self.db_wrapper.write_db() as conn:
  File "/Users/runner/hostedtoolcache/Python/3.10.4/x64/lib/python3.10/contextlib.py", line 199, in __aenter__
    return await anext(self.gen)
  File "/Users/runner/work/chia-blockchain/chia-blockchain/chia/util/db_wrapper.py", line 87, in write_db
    await self._write_connection.execute(f"SAVEPOINT {name}")
  File "/Users/runner/work/chia-blockchain/chia-blockchain/venv/lib/python3.10/site-packages/aiosqlite/core.py", line 184, in execute
    cursor = await self._execute(self._conn.execute, sql, parameters)
  File "/Users/runner/work/chia-blockchain/chia-blockchain/venv/lib/python3.10/site-packages/aiosqlite/core.py", line 129, in _execute
    return await future
asyncio.exceptions.CancelledError
 
00:44:37 chia.full_node.full_node: WARNING Syncing failed, CancelledError
00:44:37 chia.full_node.full_node: WARNING Syncing failed, CancelledError
__________ TestFullSync.test_sync_from_fork_point_and_weight_proof[2] __________
[gw3] darwin -- Python 3.10.4 /Users/runner/work/chia-blockchain/chia-blockchain/venv/bin/python
tests/core/full_node/full_sync/test_full_sync.py:160: in test_sync_from_fork_point_and_weight_proof
    await time_out_assert(180, node_height_exactly, True, full_node_2, num_blocks_initial - 1)
E   AssertionError: Timed assertion timed out after 180 seconds: expected True, got False
---------------------------- Captured stdout setup -----------------------------
  create_block_tools called 1 times
Found private CA in /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/tmphy3prl9k, using it to generate TLS certificates
BlockTools daemon port: 43376
File found at: /Users/runner/work/chia-blockchain/chia-blockchain/.chia/blocks/test_blocks_1000_rc5.db

 loaded /Users/runner/work/chia-blockchain/chia-blockchain/.chia/blocks/test_blocks_1000_rc5.db with 1000 blocks
File found at: /Users/runner/work/chia-blockchain/chia-blockchain/.chia/blocks/test_blocks_400_rc5.db

 loaded /Users/runner/work/chia-blockchain/chia-blockchain/.chia/blocks/test_blocks_400_rc5.db with 400 blocks
  create_block_tools_async called 1 times
Found private CA in /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/tmphwxntve3, using it to generate TLS certificates
BlockTools daemon port: 34205
  create_block_tools_async called 2 times
Found private CA in /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/tmpqc4dy6zi, using it to generate TLS certificates
BlockTools daemon port: 20727
  create_block_tools_async called 3 times
Found private CA in /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/tmpqeepyc8x, using it to generate TLS certificates
BlockTools daemon port: 14908
------------------------------ Captured log call -------------------------------
00:41:35 chia.full_node.full_node: ERROR got weight proof request for unknown peak 6b51d431df5d7f141cbececcf79edf3dd861c3b4069f0b[116](https://github.com/Chia-Network/chia-blockchain/runs/6646942280?check_suite_focus=true#step:10:117)61a3eefacbba918
---------------------------- Captured log teardown -----------------------------
00:44:36 chia.consensus.blockchain: ERROR Error while adding block 2561af40c29343a46ecbecf7887c17240718990dc51659b6440f180de2c0b67b height 856, rolling back: Traceback (most recent call last):
  File "/Users/runner/work/chia-blockchain/chia-blockchain/chia/consensus/blockchain.py", line 273, in receive_block
    await self.block_store.add_full_block(header_hash, block, block_record)
  File "/Users/runner/work/chia-blockchain/chia-blockchain/chia/full_node/block_store.py", line 179, in add_full_block
    async with self.db_wrapper.write_db() as conn:
  File "/Users/runner/hostedtoolcache/Python/3.10.4/x64/lib/python3.10/contextlib.py", line 199, in __aenter__
    return await anext(self.gen)
  File "/Users/runner/work/chia-blockchain/chia-blockchain/chia/util/db_wrapper.py", line 87, in write_db
    await self._write_connection.execute(f"SAVEPOINT {name}")
  File "/Users/runner/work/chia-blockchain/chia-blockchain/venv/lib/python3.10/site-packages/aiosqlite/core.py", line 184, in execute
    cursor = await self._execute(self._conn.execute, sql, parameters)
  File "/Users/runner/work/chia-blockchain/chia-blockchain/venv/lib/python3.10/site-packages/aiosqlite/core.py", line [129](https://github.com/Chia-Network/chia-blockchain/runs/6646942280?check_suite_focus=true#step:10:130), in _execute
    return await future
asyncio.exceptions.CancelledError
 
00:44:36 chia.full_node.full_node: WARNING Syncing failed, CancelledError
00:44:36 chia.full_node.full_node: WARNING Syncing failed, CancelledError
=========================== short test summary info ============================
FAILED tests/core/full_node/full_sync/test_full_sync.py::TestFullSync::test_sync_from_fork_point_and_weight_proof[1]
FAILED tests/core/full_node/full_sync/test_full_sync.py::TestFullSync::test_sync_from_fork_point_and_weight_proof[2]

@altendky altendky closed this May 30, 2022
@altendky altendky reopened this May 30, 2022
@altendky altendky closed this May 30, 2022
@altendky altendky reopened this May 30, 2022
@altendky
Copy link
Contributor Author

https://github.com/Chia-Network/chia-blockchain/runs/6647224077?check_suite_focus=true

==================================== ERRORS ====================================
_________ ERROR at teardown of TestCATWallet.test_cat_hint[False-True] _________
venv/lib/python3.10/site-packages/_pytest/runner.py:338: in from_call
    result: Optional[TResult] = func()
venv/lib/python3.10/site-packages/_pytest/runner.py:259: in <lambda>
    lambda: ihook(item=item, **kwds), when=when, reraise=reraise
venv/lib/python3.10/site-packages/pluggy/_hooks.py:265: in __call__
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
venv/lib/python3.10/site-packages/pluggy/_manager.py:80: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
venv/lib/python3.10/site-packages/_pytest/threadexception.py:88: in pytest_runtest_teardown
    yield from thread_exception_runtest_hook()
venv/lib/python3.10/site-packages/_pytest/threadexception.py:73: in thread_exception_runtest_hook
    warnings.warn(pytest.PytestUnhandledThreadExceptionWarning(msg))
E   pytest.PytestUnhandledThreadExceptionWarning: Exception in thread Thread-430
E   
E   Traceback (most recent call last):
E     File "/opt/hostedtoolcache/Python/3.10.4/x64/lib/python3.10/threading.py", line 1009, in _bootstrap_inner
E       self.run()
E     File "/home/runner/work/chia-blockchain/chia-blockchain/venv/lib/python3.10/site-packages/watchdog/observers/inotify_buffer.py", line 88, in run
E       inotify_events = self._inotify.read_events()
E     File "/home/runner/work/chia-blockchain/chia-blockchain/venv/lib/python3.10/site-packages/watchdog/observers/inotify_c.py", line 285, in read_events
E       event_buffer = os.read(self._inotify_fd, event_buffer_size)
E   OSError: [Errno 9] Bad file descriptor
---------------------------- Captured stdout setup -----------------------------
  create_block_tools_async called 48 times
Found private CA in /tmp/tmp3v_lpu11, using it to generate TLS certificates
BlockTools daemon port: 49438
  create_block_tools_async called 49 times
Found private CA in /tmp/tmp38kg08gr, using it to generate TLS certificates
BlockTools daemon port: 4326
  create_block_tools_async called 50 times
Found private CA in /tmp/tmpd_8ggwp5, using it to generate TLS certificates
BlockTools daemon port: 55577
------------------------------ Captured log call -------------------------------
01:26:33 chia.wallet.wallet_node: WARNING SpendBundle has been rejected by the FullNode. {'error': 'ALREADY_INCLUDING_TRANSACTION',
 'status': 3,
 'txid': '0x15a215e847b4cf49897be84033ce9fc95c[52](https://github.com/Chia-Network/chia-blockchain/runs/6647224077?check_suite_focus=true#step:10:53)aa4e74f283c8b35[54](https://github.com/Chia-Network/chia-blockchain/runs/6647224077?check_suite_focus=true#step:10:55)35acd6f1c49'}
01:26:33 chia.wallet.wallet_node: WARNING SpendBundle has been rejected by the FullNode. {'error': 'ALREADY_INCLUDING_TRANSACTION',
 'status': 3,
 'txid': '0x15a215e847b4cf49897be84033ce9fc95c52aa4e74f283c8b3[55](https://github.com/Chia-Network/chia-blockchain/runs/6647224077?check_suite_focus=true#step:10:56)435acd6f1c49'}
=========================== short test summary info ============================
ERROR tests/wallet/cat_wallet/test_cat_wallet.py::TestCATWallet::test_cat_hint[False-True]

@altendky altendky closed this May 30, 2022
@altendky altendky reopened this May 30, 2022
@altendky altendky marked this pull request as ready for review June 4, 2022 23:14
@altendky altendky added the ready_to_merge Submitter and reviewers think this is ready label Jun 4, 2022
Copy link
Contributor

@wjblanke wjblanke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aok

@wallentx wallentx merged commit 61fa0ed into main Jun 8, 2022
@wallentx wallentx deleted the stop_and_join_watchdog_observer branch June 8, 2022 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready_to_merge Submitter and reviewers think this is ready
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants