pants: Inconsistent goal output
On Pants main @ 6037e699 I encountered this failure with no information about why Flake8 failed:
$ ./pants --changed-since=upstream/main fmt lint check test
10:47:55.31 [INFO] Initializing scheduler...
10:47:55.41 [INFO] Scheduler initialized.
10:47:58.52 [INFO] Completed: Building autoflake.pex from autoflake_default_lockfile.txt
10:47:58.64 [WARN] Completed: Format with Autoflake - autoflake made changes.
10:48:03.67 [INFO] Completed: Building black.pex from black_default_lockfile.txt
10:48:04.21 [WARN] Completed: Format with Black - Black made changes.
reformatted src/python/pants/engine/process_test.py
All done! ✨ 🍰 ✨
1 file reformatted, 1 file left unchanged.
10:48:07.37 [INFO] Completed: Building docformatter.pex from docformatter_default_lockfile.txt
10:48:07.48 [INFO] Completed: Format with docformatter - Docformatter made no changes.
10:48:08.47 [INFO] Completed: Building isort.pex from isort_default_lockfile.txt
10:48:08.56 [INFO] Completed: Format with isort - isort made no changes.
+ Black made changes.
✓ Docformatter made no changes.
+ autoflake made changes.
✓ isort made no changes.
10:48:08.65 [INFO] Completed: Lint with isort - isort succeeded.
10:48:08.68 [INFO] Completed: Lint with autoflake - autoflake succeeded.
10:48:08.73 [INFO] Completed: Lint with docformatter - Docformatter succeeded.
10:48:09.02 [INFO] Completed: Lint with Black - Black succeeded.
All done! ✨ 🍰 ✨
2 files would be left unchanged.
10:48:11.36 [INFO] Completed: Building flake8.pex from 3rdparty/python/lockfiles/flake8.txt
✓ Black succeeded.
✓ Docformatter succeeded.
𐄂 Flake8 failed.
✓ autoflake succeeded.
✓ isort succeeded.
I re-ran and found:
$ ./pants --changed-since=upstream/main fmt lint check test
10:49:05.17 [INFO] Completed: Format with Autoflake - autoflake made no changes.
10:49:05.56 [INFO] Completed: Format with Black - Black made no changes.
All done! ✨ 🍰 ✨
2 files left unchanged.
10:49:05.56 [INFO] Completed: Format with docformatter - Docformatter made no changes.
10:49:05.56 [INFO] Completed: Format with isort - isort made no changes.
✓ Black made no changes.
✓ Docformatter made no changes.
✓ autoflake made no changes.
✓ isort made no changes.
10:49:05.57 [INFO] Completed: Lint with autoflake - autoflake succeeded.
10:49:05.57 [INFO] Completed: Lint with docformatter - Docformatter succeeded.
10:49:05.57 [INFO] Completed: Lint with Black - Black succeeded.
All done! ✨ 🍰 ✨
2 files would be left unchanged.
10:49:05.57 [INFO] Completed: Lint with isort - isort succeeded.
10:49:05.77 [ERROR] Completed: Lint with Flake8 - Flake8 failed (exit code 1).
src/python/pants/engine/process.py:537:1: W293 blank line contains whitespace
✓ Black succeeded.
✓ Docformatter succeeded.
𐄂 Flake8 failed.
✓ autoflake succeeded.
✓ isort succeeded.
So the issue was src/python/pants/engine/process.py:537:1: W293 blank line contains whitespace
but that was not reported on the 1st run. In the 1st run it’s just reported that the flake8.pex was built 10:48:11.36 [INFO] Completed: Building flake8.pex from 3rdparty/python/lockfiles/flake8.txt
, but not what the Completed: ...
of that pex’s execution was.
The pantsd.log shows the following for this session:
10:47:54.88 [INFO] handling request: `--changed-since=upstream/main fmt lint check test`
10:48:08.57 [INFO] notify invalidation: cleared 2 and dirtied 109 nodes for: {"src/python/pants/engine/process.py", "src/python/pants/engine"}
10:48:08.57 [INFO] notify invalidation: cleared 0 and dirtied 0 nodes for: {"src/python/pants/engine/process.py", "src/python/pants/engine"}
10:48:08.57 [INFO] notify invalidation: cleared 0 and dirtied 0 nodes for: {"src/python/pants/engine", "src/python/pants/engine/process.py"}
10:48:08.57 [INFO] notify invalidation: cleared 1 and dirtied 15 nodes for: {"src/python/pants/engine", "src/python/pants/engine/process_test.py"}
10:48:08.57 [INFO] notify invalidation: cleared 0 and dirtied 0 nodes for: {"src/python/pants/engine/process_test.py", "src/python/pants/engine"}
10:48:08.57 [INFO] notify invalidation: cleared 0 and dirtied 0 nodes for: {"src/python/pants/engine", "src/python/pants/engine/process_test.py"}
10:48:08.57 [INFO] notify invalidation: cleared 2 and dirtied 111 nodes for: {"src/python/pants/engine/process.py", "src/python/pants/engine"}
10:48:08.57 [INFO] notify invalidation: cleared 0 and dirtied 0 nodes for: {"src/python/pants/engine", "src/python/pants/engine/process_test.py"}
10:48:08.57 [INFO] notify invalidation: cleared 0 and dirtied 0 nodes for: {"src/python/pants/engine/process.py", "src/python/pants/engine"}
10:48:08.57 [INFO] Filesystem changed during run: retrying `PySnapshot` in 500ms...
10:48:08.57 [INFO] notify invalidation: cleared 0 and dirtied 0 nodes for: {"src/python/pants/engine", "src/python/pants/engine/process.py"}
10:48:08.57 [INFO] notify invalidation: cleared 0 and dirtied 0 nodes for: {"src/python/pants/engine", "src/python/pants/engine/process_test.py"}
10:48:08.57 [INFO] notify invalidation: cleared 0 and dirtied 0 nodes for: {"src/python/pants/engine", "src/python/pants/engine/process_test.py"}
10:48:11.56 [INFO] request completed: `--changed-since=upstream/main fmt lint check test`
10:49:04.98 [INFO] handling request: `--changed-since=upstream/main fmt lint check test`
10:49:05.77 [INFO] request completed: `--changed-since=upstream/main fmt lint check test`
10:49:15.41 [INFO] Extending leases
10:49:15.43 [INFO] Done extending leases
...
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 16 (16 by maintainers)
Commits related to this issue
- Fix dropped output race during UI teardown (#14093) As described in #13276 and #11626, a race condition can occur between releasing exclusive access to the Console and the dynamic UI shutting down. ... — committed to pantsbuild/pants by stuhood 2 years ago
- Fix dropped output race during UI teardown (#14093) As described in #13276 and #11626, a race condition can occur between releasing exclusive access to the Console and the dynamic UI shutting down. ... — committed to stuhood/pants by stuhood 2 years ago
- Fix dropped output race during UI teardown (cherrypick of #14093) (#14690) As described in #13276 and #11626, a race condition can occur between releasing exclusive access to the Console and the dyn... — committed to pantsbuild/pants by stuhood 2 years ago
Given that @jsirois can no longer repro, I’m going to re-resolve this, and have opened #14112 for the second issue. If we haven’t seen any deadlocks in a week or so with #14093, I’ll cherry-pick it to
2.8.x
and2.9.x
.@jsirois: I’ll likely pick this up as a broken window this week, since it seems like you’re poking at #13899. If you want to trade (since you have a repro for this one) please let me know.
@jsirois : based on the data you reported out-of-band, my best hypothesis is that this is due to these lines: https://github.com/pantsbuild/pants/blob/6b1d21590f09544245cd03949ba3281cfd4bf99e/src/rust/engine/ui/src/console_ui.rs#L117-L125 accepting stderr off the channel after the UI is already torn down.
These easiest path forward would be for you to confirm in your environment that that is what is happening. To do that, I’d recommend adding something like:
If that isn’t what is happening, then my next guess would be that
first_bar.println()
can silently fail if the UI is already torn down (which might be possible, since it doesn’t return an error?).Regardless though, the solution for either issue will likely be to fix the synchronization of teardown.