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

Can't ^C when using the daemon, during connection to pailgun #5220

Closed
illicitonion opened this issue Dec 18, 2017 · 2 comments
Closed

Can't ^C when using the daemon, during connection to pailgun #5220

illicitonion opened this issue Dec 18, 2017 · 2 comments

Comments

@illicitonion
Copy link
Contributor

There are a bunch of ^Cs in the middle of this log which were ignored (see that the process fully resolved and gave a list of changed targets)

pants$ ./pants -ldebug --changed-parent=master list
DEBUG] Selected watchman binary bootstrapped to: /Users/dwagnerhall/.cache/pants/bin/watchman/mac/10.13/4.5.0/watchman
DEBUG] Executing: git --git-dir=/Users/dwagnerhall/src/github.com/pantsbuild/pants/.git --work-tree=/Users/dwagnerhall/src/github.com/pantsbuild/pants rev-parse --abbrev-ref HEAD
DEBUG] Detected git repository at /Users/dwagnerhall/src/github.com/pantsbuild/pants on branch dwagnerhall/options/targetroots
DEBUG] Target alias resources has already been registered. Overwriting!
DEBUG] ProjectTree ignore_patterns: ['.*/', '/dist/', '/build-support/*.venv/']
DEBUG] loading native engine python module from: /var/folders/1j/jzw90nc51nn_358mmhnwc_fh0000gn/T/tmpsUEMGN
DEBUG] Selected watchman binary bootstrapped to: /Users/dwagnerhall/.cache/pants/bin/watchman/mac/10.13/4.5.0/watchman
DEBUG] watchman is running, pid=80339 socket=/Users/dwagnerhall/src/github.com/pantsbuild/pants/.pids/watchman/watchman.sock
DEBUG] acquiring lock: <pants.process.lock.OwnerPrintingInterProcessFileLock object at 0x103a591d0>
DEBUG] pantsd: is_alive=True new_fingerprint=fddd842df3ffcde738721674a3c1c0cbea94aa3a current_fingerprint=cf404e17a8a81843b45dd2283b2d9b81ab7f448b
DEBUG] terminating pantsd
DEBUG] sending signal 15 to pid 80341
DEBUG] successfully terminated pid 80341
DEBUG] purging metadata directory: /Users/dwagnerhall/src/github.com/pantsbuild/pants/.pids/pantsd
DEBUG] launching pantsd
DEBUG] purging metadata directory: /Users/dwagnerhall/src/github.com/pantsbuild/pants/.pids/pantsd
DEBUG] cmd is: PANTS_ENTRYPOINT=pants.pantsd.pants_daemon:launch /Users/dwagnerhall/src/github.com/pantsbuild/pants/build-support/pants_dev_deps.venv/bin/python /Users/dwagnerhall/src/github.com/pantsbuild/pants/src/python/pants/bin/pants_loader.py -ldebug --changed-parent=master list
DEBUG] released lock: <pants.process.lock.OwnerPrintingInterProcessFileLock object at 0x103a591d0>
DEBUG] pantsd is running at pid 80654, pailgun port is 55209
DEBUG] connecting to pailgun on port 55209
^C^C^C^CDEBUG] Target alias resources has already been registered. Overwriting!
DEBUG] spec_roots are: OrderedSet()
DEBUG] changed_request is: ChangedRequest(changes_since='master', diffspec=None, include_dependees='none', fast=False)
DEBUG] Executing: git --git-dir=/Users/dwagnerhall/src/github.com/pantsbuild/pants/.git --work-tree=/Users/dwagnerhall/src/github.com/pantsbuild/pants diff --name-only HEAD -- /Users/dwagnerhall/src/github.com/pantsbuild/pants
DEBUG] Executing: git --git-dir=/Users/dwagnerhall/src/github.com/pantsbuild/pants/.git --work-tree=/Users/dwagnerhall/src/github.com/pantsbuild/pants diff --name-only master...HEAD -- /Users/dwagnerhall/src/github.com/pantsbuild/pants
DEBUG] Executing: git --git-dir=/Users/dwagnerhall/src/github.com/pantsbuild/pants/.git --work-tree=/Users/dwagnerhall/src/github.com/pantsbuild/pants ls-files --other --exclude-standard -- /Users/dwagnerhall/src/github.com/pantsbuild/pants
DEBUG] changed files: set([u'src/python/pants/init/target_roots.py', u'pants.ini', u'tests/python/pants_test/engine/legacy/test_graph.py', u'src/python/pants/pantsd/service/pailgun_service.py'])
DEBUG] Launching 4 roots.
DEBUG] Root Select(AscendantAddresses(directory=u'src/python/pants/init'), =Collection.of(HydratedTarget)) completed.
DEBUG] Root Select(AscendantAddresses(directory=u'tests/python/pants_test/engine/legacy'), =Collection.of(HydratedTarget)) completed.
DEBUG] Root Select(AscendantAddresses(directory=u'src/python/pants/pantsd/service'), =Collection.of(HydratedTarget)) completed.
DEBUG] Root Select(AscendantAddresses(directory=u''), =Collection.of(HydratedTarget)) completed.
DEBUG] computed 4 nodes in 0.003063 seconds. there are 2932 total nodes.
DEBUG] changed addresses: [BuildFileAddress(src/python/pants/init/BUILD, init), BuildFileAddress(tests/python/pants_test/engine/legacy/BUILD, graph), BuildFileAddress(src/python/pants/pantsd/service/BUILD, pailgun_service)]
DEBUG] target_roots are: ChangedTargetRoots((SingleAddress(directory='src/python/pants/init', name='init'), SingleAddress(directory='tests/python/pants_test/engine/legacy', name='graph'), SingleAddress(directory='src/python/pants/pantsd/service', name='pailgun_service')))
DEBUG] build_graph is: <pants.engine.legacy.graph.LegacyBuildGraph object at 0x110d83150>
DEBUG] Injecting to <pants.engine.legacy.graph.LegacyBuildGraph object at 0x110d83150>: (SingleAddress(directory='src/python/pants/init', name='init'), SingleAddress(directory='tests/python/pants_test/engine/legacy', name='graph'), SingleAddress(directory='src/python/pants/pantsd/service', name='pailgun_service'))
DEBUG] Launching 6 roots.
DEBUG] Root Select(SingleAddress(directory='src/python/pants/init', name='init'), =Collection.of(HydratedTarget)) completed.
DEBUG] Root Select(SingleAddress(directory='src/python/pants/init', name='init'), =BuildFileAddresses) completed.
DEBUG] Root Select(SingleAddress(directory='tests/python/pants_test/engine/legacy', name='graph'), =Collection.of(HydratedTarget)) completed.
DEBUG] Root Select(SingleAddress(directory='tests/python/pants_test/engine/legacy', name='graph'), =BuildFileAddresses) completed.
DEBUG] Root Select(SingleAddress(directory='src/python/pants/pantsd/service', name='pailgun_service'), =Collection.of(HydratedTarget)) completed.
DEBUG] Root Select(SingleAddress(directory='src/python/pants/pantsd/service', name='pailgun_service'), =BuildFileAddresses) completed.
DEBUG] computed 6 nodes in 0.004505 seconds. there are 2935 total nodes.
DEBUG] address_mapper is: <pants.engine.legacy.address_mapper.LegacyAddressMapper object at 0x110d83390>
DEBUG] Launching 1 roots.
DEBUG] Root Select(SingleAddress(directory=u'list', name=u'list'), =BuildFileAddresses) completed.
DEBUG] computed 1 nodes in 0.009143 seconds. there are 2940 total nodes.
DEBUG] Injecting to <pants.engine.legacy.graph.LegacyBuildGraph object at 0x110d83150>: (SingleAddress(directory='src/python/pants/init', name='init'), SingleAddress(directory='tests/python/pants_test/engine/legacy', name='graph'), SingleAddress(directory='src/python/pants/pantsd/service', name='pailgun_service'))
DEBUG] Launching 6 roots.
DEBUG] Root Select(SingleAddress(directory='src/python/pants/init', name='init'), =Collection.of(HydratedTarget)) completed.
DEBUG] Root Select(SingleAddress(directory='src/python/pants/init', name='init'), =BuildFileAddresses) completed.
DEBUG] Root Select(SingleAddress(directory='tests/python/pants_test/engine/legacy', name='graph'), =Collection.of(HydratedTarget)) completed.
DEBUG] Root Select(SingleAddress(directory='tests/python/pants_test/engine/legacy', name='graph'), =BuildFileAddresses) completed.
DEBUG] Root Select(SingleAddress(directory='src/python/pants/pantsd/service', name='pailgun_service'), =Collection.of(HydratedTarget)) completed.
DEBUG] Root Select(SingleAddress(directory='src/python/pants/pantsd/service', name='pailgun_service'), =BuildFileAddresses) completed.
DEBUG] computed 6 nodes in 0.001575 seconds. there are 2940 total nodes.
DEBUG] Executing: git --git-dir=/Users/dwagnerhall/src/github.com/pantsbuild/pants/.git --work-tree=/Users/dwagnerhall/src/github.com/pantsbuild/pants rev-parse HEAD
DEBUG] Executing: git --git-dir=/Users/dwagnerhall/src/github.com/pantsbuild/pants/.git --work-tree=/Users/dwagnerhall/src/github.com/pantsbuild/pants rev-parse --abbrev-ref HEAD
src/python/pants/init:init
tests/python/pants_test/engine/legacy:graph
src/python/pants/pantsd/service:pailgun_service
@kwlzn kwlzn added the pantsd label Jan 5, 2018
@kwlzn
Copy link
Member

kwlzn commented Jan 5, 2018

I'm able to repro this too. I also see a strange delay in handling the ^C without the daemon enabled, but that eventually results in a segv.

I believe whats happening here in the daemon context is roughly along the lines of:

  1. the thin client launches the daemon and connects to it, issuing an execution request to the captive engine/scheduler
  2. the way the thin client handles control-C is by storing the PID of the pantsd-runner and then sending a signal to it via os.kill().
  3. the PID is not sent to the thin client until the pantsd-runner forks, to avoid the signal hitting pantsd directly (which will presumably crash and lose all daemon state), so until the fork happens, control-C is effectively an un-retried no-op

so to fix, I think we'll have to:

(1) instruct the thin client to target the daemon process for control-c signals in addition to the pantsd-runner
and
(2A) be ok with crashing the daemon if a user hits control-C during the sync phase (based on presumed default signal handling)
or
(2B) figure out how to plumb a smarter signal handler into the daemon that would be able to gracefully interrupt engine execution without crashing

@blorente
Copy link
Contributor

blorente commented Jul 2, 2019

Closed in #7924

@blorente blorente closed this as completed Jul 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants