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

Starting pants shows useless "Initializing Nailgun pool ..." log lines #21863

Open
huonw opened this issue Jan 22, 2025 · 3 comments · May be fixed by #21865
Open

Starting pants shows useless "Initializing Nailgun pool ..." log lines #21863

huonw opened this issue Jan 22, 2025 · 3 comments · May be fixed by #21865
Labels

Comments

@huonw
Copy link
Contributor

huonw commented Jan 22, 2025

Describe the bug

It seems that Pants recently (between 2.21 and 2.22) started always logging two log lines about initializing Nailgun. These seem of low interest in most circumstances, and thus not worth telling the user about.

Reproducer:

cd $(mktemp -d)
touch pants.toml

echo "OK: 2.21"
PANTS_VERSION=2.21.0 pants --no-pantsd version

echo
echo "OK: 2.22.0.dev3"
PANTS_VERSION=2.22.0.dev3 pants --no-pantsd version

echo
echo "BUG: 2.22.0a0"
PANTS_VERSION=2.22.0a0 pants --no-pantsd version

echo
echo "BUG: 2.22"
PANTS_VERSION=2.22.0 pants --no-pantsd version

Output:

OK: 2.21
2.21.0

OK: 2.22.0.dev3
2.22.0.dev3

BUG: 2.22.0a0
13:03:39.51 [INFO] Initializing Nailgun pool for 16 processes...
13:03:42.55 [INFO] Initializing Nailgun pool for 16 processes...
2.22.0a0

BUG: 2.22
13:03:45.59 [INFO] Initializing Nailgun pool for 16 processes...
13:03:48.71 [INFO] Initializing Nailgun pool for 16 processes...
2.22.0

Pants version

2.22.0a0 and newer

OS
macOS

Additional info
N/A

@huonw huonw added the bug label Jan 22, 2025
@huonw
Copy link
Contributor Author

huonw commented Jan 22, 2025

The relevant diff of releases is: release_2.22.0.dev3...release_2.22.0a0

Looks like #20946 introduced this line, after turning some other logs down.

@huonw huonw linked a pull request Jan 22, 2025 that will close this issue
@cburroughs
Copy link
Contributor

I've also wondered, why does the same log message appear twice? Do we initialize twice?

@huonw
Copy link
Contributor Author

huonw commented Jan 22, 2025

I'm not sure yet.

Initial investigation:

Extra factor, with pantsd (i.e. no --no-pantsd flag) it only appears once:

cd $(mktemp -d)
touch pants.toml

echo "First"
PANTS_VERSION=2.22.0 pants version

echo
echo "Second"
PANTS_VERSION=2.22.0 pants version
First
09:12:21.26 [INFO] Initializing scheduler...
09:12:21.28 [INFO] Initializing Nailgun pool for 16 processes...
09:12:21.43 [INFO] Scheduler initialized.
2.22.0

Second
2.22.0

There's a few layers of functions from NailgunPool::new to EngineInitializer.setup_graph that are only called in one place (and not in a loop, AFAICT):

Finally, EngineInitializer.setup_graph is called in three places:

  1. create_bootstrap_scheduler:
    EngineInitializer.setup_graph(
  2. PantsDaemonCore._initialize:
    self._scheduler = EngineInitializer.setup_graph(
  3. LocalPantsRunner.create:
    scheduler = EngineInitializer.setup_graph(

Thus, for why things happen twice, the surface level is that the scheduler is initialised/graph is set-up for both bootstrapping (call site 1 is eventually also called in or before LocalPantsRunner.create too) and for "real" (call sites 2 and 3).

For why Pantsd behaves differently... my current hypothesises are:

  1. turning off pantsd goes down an extra codepath??
  2. initialising pantsd still does this twice, but the log line from one of them is hidden??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants