<#22224 Additional diagnostics about reason for pa...
# github-notifications
c
#22224 Additional diagnostics about reason for pantsd restarts Issue created by huonw Is your feature request related to a problem? Please describe. Currently, the pantsd daemon will restart sometimes for non-obvious reasons. This can take a long time. It'd be nice if there was more diagnostics about why each restart happens, so that people can solve "obvious" issues and reduce spurious restarts. Currently, it'll just say something like the following, with no indication of which options changed:
Copy code
12:25:06.88 [INFO] Initialization options changed: reinitializing scheduler...
...
Describe the solution you'd like At least one of: 1. When the scheduler needs to restart, the "reinitialising" message should summarise what's changed (e.g.
Initialization options (--pants-distdir, --level) changed: ...
) 2. Setting
--level=debug
should include all the details 3. The
pants.log
file should include all the details unconditionally I think we shouldn't just rely on (2) (
--level=debug
) because it can be hard to reproducer scheduler restarts, to be able to re-run with
--level=debug
, and, setting that setting itself requires a restart and thus might disturb observations. The code that decides when to restart and how to explain it is at: pants/src/python/pants/pantsd/pants_daemon_core.py Lines 134 to 164 in</pantsbuild/pants/commit/82b1bb82fd4b609856c2aeab7ebb929793d52427|82b1bb8> | scheduler_restart_explanation: str \| None = None | | ------------------------------------------------------------------------------------------- | | | | # Because these options are computed dynamically via side effects like reading from a file, | | # they need to be re-evaluated every run. We only reinitialize the scheduler if changes | | # were made, though. | | dynamic_remote_options, auth_plugin_result = DynamicRemoteOptions.from_options( | | options, | | env, | | self._prior_auth_plugin_result, | | remote_auth_plugin_func=build_config.remote_auth_plugin_func, | | ) | | remote_options_changed = ( | | self._prior_dynamic_remote_options is not None | | and dynamic_remote_options != self._prior_dynamic_remote_options | | ) | | if remote_options_changed: | | scheduler_restart_explanation = "Remote cache/execution options updated" | | | | # Compute the fingerprint of the bootstrap options. Note that unlike | | # PantsDaemonProcessManager (which fingerprints only
daemon=True
options), this | | # fingerprints all fingerprintable options in the bootstrap options, which are | | # all used to construct a Scheduler. | | options_fingerprint = OptionsFingerprinter.combined_options_fingerprint_for_scope( | | GLOBAL_SCOPE, | | options_bootstrapper.bootstrap_options, | | ) | | bootstrap_options_changed = ( | | self._fingerprint is not None and options_fingerprint != self._fingerprint | | ) | | if bootstrap_options_changed: | | scheduler_restart_explanation = "Initialization options changed" | I suspect the
self._fingerprint
string could store a (stable) JSON blob, rather than a hash, to be able to introspect the differences between old and new. Describe alternatives you've considered Making scheduler restarts so fast that it doesn't matter when it happens... this seems unobtainable in the short term. Additional context N/A pantsbuild/pants