after_merge
stringlengths
28
79.6k
before_merge
stringlengths
20
79.6k
url
stringlengths
38
71
full_traceback
stringlengths
43
922k
traceback_type
stringclasses
555 values
def reset_interactive_output_stream(cls, interactive_output_stream): """ Class state: - Overwrites `cls._interactive_output_stream`. OS state: - Overwrites the SIGUSR2 handler. This method registers a SIGUSR2 handler, which permits a non-fatal `kill -31 <pants pid>` for stacktrace retrieval. This is also where the the error message on fatal exit will be printed to. """ try: # NB: mutate process-global state! # This permits a non-fatal `kill -31 <pants pid>` for stacktrace retrieval. faulthandler.register( signal.SIGUSR2, interactive_output_stream, all_threads=True, chain=False ) # NB: mutate the class variables! cls._interactive_output_stream = interactive_output_stream except ValueError: # Warn about "ValueError: IO on closed file" when the stream is closed. cls.log_exception( "Cannot reset interactive_output_stream -- stream (probably stderr) is closed" )
def reset_interactive_output_stream(cls, interactive_output_stream): """ Class state: - Overwrites `cls._interactive_output_stream`. OS state: - Overwrites the SIGUSR2 handler. This is where the the error message on exit will be printed to as well. """ try: # NB: mutate process-global state! if faulthandler.unregister(signal.SIGUSR2): logger.debug("re-registering a SIGUSR2 handler") # This permits a non-fatal `kill -31 <pants pid>` for stacktrace retrieval. faulthandler.register( signal.SIGUSR2, interactive_output_stream, all_threads=True, chain=False ) # NB: mutate the class variables! # We don't *necessarily* need to keep a reference to this, but we do here for clarity. cls._interactive_output_stream = interactive_output_stream except ValueError: # Warn about "ValueError: IO on closed file" when stderr is closed. ExceptionSink.log_exception("Cannot reset output stream - sys.stderr is closed")
https://github.com/pantsbuild/pants/issues/6847
23:26:42 01:10 [run] ============== test session starts =============== platform darwin -- Python 2.7.10, pytest-3.6.4, py-1.7.0, pluggy-0.7.1 -- /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python cachedir: .pants.d/.pytest_cache rootdir: /Users/travis/build/pantsbuild/pants/.pants.d, inifile: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest-prep/CPython-2.7.10/e241a5f8b7de6d34689cc9307d8d06eb155c7c78/pytest.ini plugins: timeout-1.2.1, cov-2.4.0 collecting ... collected 7 items tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_logs_on_terminate <- ../../../../../../System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/case.py SKIPPED [ 14%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 28%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_keyboardinterrupt_signals <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py FAILED [ 42%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_logs_unhandled_exception <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 57%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 71%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_exiter <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 85%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [100%] ==================== FAILURES ==================== ExceptionSinkIntegrationTest.test_keyboardinterrupt_signals self = <pants_test.base.test_exception_sink_integration.ExceptionSinkIntegrationTest testMethod=test_keyboardinterrupt_signals> def test_keyboardinterrupt_signals(self): for interrupt_signal in [signal.SIGINT, signal.SIGQUIT]: with self._send_signal_to_waiter_handle(interrupt_signal) as (workdir, waiter_run): > self.assertIn('Interrupted by user.\n', waiter_run.stderr_data) E AssertionError: u'Interrupted by user.\n' not found in u'From cffi callback <function extern_clone_val at 0x11098a938>:\nTraceback (most recent call last):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/native.py", line 427, in extern_clone_val\n @ffi.def_extern()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/base/exception_sink.py", line 351, in handle_signal_gracefully\n raise KeyboardInterrupt(\'User interrupted execution with control-c!\')\nKeyboardInterrupt: User interrupted execution with control-c!\ntimestamp: 2018-11-29T23:28:22.606384\nException caught: (pants.build_graph.address_lookup_error.AddressLookupError)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module>\n main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main\n PantsLoader.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run\n cls.load_and_execute(entrypoint)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute\n entrypoint_main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main\n PantsRunner(exiter, start_time=start_time).run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run\n return runner.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run\n self._run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run\n goal_runner_result = self._maybe_run_v1(run_tracker, reporting)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1\n return goal_runner_factory.create().run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create\n goals, context = self._setup_context()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context\n self._root_dir\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph\n for _ in graph.inject_roots_closure(target_roots):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure\n for address in self._inject_specs(target_roots.specs):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs\n subjects)\n File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__\n self.gen.throw(type, value, traceback)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context\n \'Build graph construction failed: {} {}\'.format(type(e).__name__, str(e))\n\nException message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer\n\n\n' .pants.d/pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py:151: AssertionError -------------- Captured stdout call -------------- logs/exceptions.84142.log +++ logs/exceptions.84142.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.84142.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.84142.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.84142.log >>> pid: 84142 logs/exceptions.84142.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.84142.log >>> main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.84142.log >>> PantsLoader.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.84142.log >>> cls.load_and_execute(entrypoint) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.84142.log >>> entrypoint_main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.84142.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.84142.log >>> return runner.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.84142.log >>> self._run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.84142.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.84142.log >>> return goal_runner_factory.create().run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.84142.log >>> goals, context = self._setup_context() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.84142.log >>> self._root_dir logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.84142.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.84142.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.84142.log >>> subjects) logs/exceptions.84142.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.84142.log >>> self.gen.throw(type, value, traceback) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.84142.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.84142.log >>> logs/exceptions.84142.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.84142.log >>> logs/exceptions.84142.log --- logs/exceptions.log +++ logs/exceptions.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.log >>> pid: 84142 logs/exceptions.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.log >>> main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.log >>> PantsLoader.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.log >>> cls.load_and_execute(entrypoint) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.log >>> entrypoint_main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.log >>> return runner.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.log >>> self._run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.log >>> return goal_runner_factory.create().run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.log >>> goals, context = self._setup_context() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.log >>> self._root_dir logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.log >>> subjects) logs/exceptions.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.log >>> self.gen.throw(type, value, traceback) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.log >>> logs/exceptions.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.log >>> logs/exceptions.log --- generated xml file: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest/tests.python.pants_test.base.exception_sink_integration/junitxml/TEST-tests.python.pants_test.base.exception_sink_integration.xml ============ slowest 3 test durations ============ 93.67s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt 6.08s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 5.55s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream 1 failed, 5 passed, 1 skipped in 118.85 seconds =
AssertionError
def _format_traceback(cls, traceback_lines, should_print_backtrace): if should_print_backtrace: traceback_string = "\n{}".format("".join(traceback_lines)) else: traceback_string = " {}".format(cls._traceback_omitted_default_text) return traceback_string
def _format_traceback(cls, tb, should_print_backtrace): if should_print_backtrace: traceback_string = "\n{}".format("".join(traceback.format_tb(tb))) else: traceback_string = " {}".format(cls._traceback_omitted_default_text) return traceback_string
https://github.com/pantsbuild/pants/issues/6847
23:26:42 01:10 [run] ============== test session starts =============== platform darwin -- Python 2.7.10, pytest-3.6.4, py-1.7.0, pluggy-0.7.1 -- /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python cachedir: .pants.d/.pytest_cache rootdir: /Users/travis/build/pantsbuild/pants/.pants.d, inifile: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest-prep/CPython-2.7.10/e241a5f8b7de6d34689cc9307d8d06eb155c7c78/pytest.ini plugins: timeout-1.2.1, cov-2.4.0 collecting ... collected 7 items tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_logs_on_terminate <- ../../../../../../System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/case.py SKIPPED [ 14%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 28%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_keyboardinterrupt_signals <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py FAILED [ 42%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_logs_unhandled_exception <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 57%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 71%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_exiter <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 85%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [100%] ==================== FAILURES ==================== ExceptionSinkIntegrationTest.test_keyboardinterrupt_signals self = <pants_test.base.test_exception_sink_integration.ExceptionSinkIntegrationTest testMethod=test_keyboardinterrupt_signals> def test_keyboardinterrupt_signals(self): for interrupt_signal in [signal.SIGINT, signal.SIGQUIT]: with self._send_signal_to_waiter_handle(interrupt_signal) as (workdir, waiter_run): > self.assertIn('Interrupted by user.\n', waiter_run.stderr_data) E AssertionError: u'Interrupted by user.\n' not found in u'From cffi callback <function extern_clone_val at 0x11098a938>:\nTraceback (most recent call last):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/native.py", line 427, in extern_clone_val\n @ffi.def_extern()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/base/exception_sink.py", line 351, in handle_signal_gracefully\n raise KeyboardInterrupt(\'User interrupted execution with control-c!\')\nKeyboardInterrupt: User interrupted execution with control-c!\ntimestamp: 2018-11-29T23:28:22.606384\nException caught: (pants.build_graph.address_lookup_error.AddressLookupError)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module>\n main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main\n PantsLoader.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run\n cls.load_and_execute(entrypoint)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute\n entrypoint_main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main\n PantsRunner(exiter, start_time=start_time).run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run\n return runner.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run\n self._run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run\n goal_runner_result = self._maybe_run_v1(run_tracker, reporting)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1\n return goal_runner_factory.create().run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create\n goals, context = self._setup_context()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context\n self._root_dir\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph\n for _ in graph.inject_roots_closure(target_roots):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure\n for address in self._inject_specs(target_roots.specs):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs\n subjects)\n File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__\n self.gen.throw(type, value, traceback)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context\n \'Build graph construction failed: {} {}\'.format(type(e).__name__, str(e))\n\nException message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer\n\n\n' .pants.d/pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py:151: AssertionError -------------- Captured stdout call -------------- logs/exceptions.84142.log +++ logs/exceptions.84142.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.84142.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.84142.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.84142.log >>> pid: 84142 logs/exceptions.84142.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.84142.log >>> main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.84142.log >>> PantsLoader.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.84142.log >>> cls.load_and_execute(entrypoint) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.84142.log >>> entrypoint_main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.84142.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.84142.log >>> return runner.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.84142.log >>> self._run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.84142.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.84142.log >>> return goal_runner_factory.create().run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.84142.log >>> goals, context = self._setup_context() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.84142.log >>> self._root_dir logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.84142.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.84142.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.84142.log >>> subjects) logs/exceptions.84142.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.84142.log >>> self.gen.throw(type, value, traceback) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.84142.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.84142.log >>> logs/exceptions.84142.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.84142.log >>> logs/exceptions.84142.log --- logs/exceptions.log +++ logs/exceptions.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.log >>> pid: 84142 logs/exceptions.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.log >>> main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.log >>> PantsLoader.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.log >>> cls.load_and_execute(entrypoint) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.log >>> entrypoint_main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.log >>> return runner.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.log >>> self._run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.log >>> return goal_runner_factory.create().run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.log >>> goals, context = self._setup_context() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.log >>> self._root_dir logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.log >>> subjects) logs/exceptions.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.log >>> self.gen.throw(type, value, traceback) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.log >>> logs/exceptions.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.log >>> logs/exceptions.log --- generated xml file: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest/tests.python.pants_test.base.exception_sink_integration/junitxml/TEST-tests.python.pants_test.base.exception_sink_integration.xml ============ slowest 3 test durations ============ 93.67s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt 6.08s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 5.55s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream 1 failed, 5 passed, 1 skipped in 118.85 seconds =
AssertionError
def _format_unhandled_exception_log(cls, exc, tb, add_newline, should_print_backtrace): exc_type = type(exc) exception_full_name = "{}.{}".format(exc_type.__module__, exc_type.__name__) exception_message = str(exc) if exc else "(no message)" maybe_newline = "\n" if add_newline else "" return cls._UNHANDLED_EXCEPTION_LOG_FORMAT.format( exception_type=exception_full_name, backtrace=cls._format_traceback( traceback_lines=traceback.format_tb(tb), should_print_backtrace=should_print_backtrace, ), exception_message=exception_message, maybe_newline=maybe_newline, )
def _format_unhandled_exception_log(cls, exc, tb, add_newline, should_print_backtrace): exc_type = type(exc) exception_full_name = "{}.{}".format(exc_type.__module__, exc_type.__name__) exception_message = str(exc) if exc else "(no message)" maybe_newline = "\n" if add_newline else "" return cls._UNHANDLED_EXCEPTION_LOG_FORMAT.format( exception_type=exception_full_name, backtrace=cls._format_traceback( tb, should_print_backtrace=should_print_backtrace ), exception_message=exception_message, maybe_newline=maybe_newline, )
https://github.com/pantsbuild/pants/issues/6847
23:26:42 01:10 [run] ============== test session starts =============== platform darwin -- Python 2.7.10, pytest-3.6.4, py-1.7.0, pluggy-0.7.1 -- /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python cachedir: .pants.d/.pytest_cache rootdir: /Users/travis/build/pantsbuild/pants/.pants.d, inifile: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest-prep/CPython-2.7.10/e241a5f8b7de6d34689cc9307d8d06eb155c7c78/pytest.ini plugins: timeout-1.2.1, cov-2.4.0 collecting ... collected 7 items tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_logs_on_terminate <- ../../../../../../System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/case.py SKIPPED [ 14%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 28%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_keyboardinterrupt_signals <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py FAILED [ 42%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_logs_unhandled_exception <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 57%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 71%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_exiter <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 85%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [100%] ==================== FAILURES ==================== ExceptionSinkIntegrationTest.test_keyboardinterrupt_signals self = <pants_test.base.test_exception_sink_integration.ExceptionSinkIntegrationTest testMethod=test_keyboardinterrupt_signals> def test_keyboardinterrupt_signals(self): for interrupt_signal in [signal.SIGINT, signal.SIGQUIT]: with self._send_signal_to_waiter_handle(interrupt_signal) as (workdir, waiter_run): > self.assertIn('Interrupted by user.\n', waiter_run.stderr_data) E AssertionError: u'Interrupted by user.\n' not found in u'From cffi callback <function extern_clone_val at 0x11098a938>:\nTraceback (most recent call last):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/native.py", line 427, in extern_clone_val\n @ffi.def_extern()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/base/exception_sink.py", line 351, in handle_signal_gracefully\n raise KeyboardInterrupt(\'User interrupted execution with control-c!\')\nKeyboardInterrupt: User interrupted execution with control-c!\ntimestamp: 2018-11-29T23:28:22.606384\nException caught: (pants.build_graph.address_lookup_error.AddressLookupError)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module>\n main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main\n PantsLoader.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run\n cls.load_and_execute(entrypoint)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute\n entrypoint_main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main\n PantsRunner(exiter, start_time=start_time).run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run\n return runner.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run\n self._run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run\n goal_runner_result = self._maybe_run_v1(run_tracker, reporting)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1\n return goal_runner_factory.create().run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create\n goals, context = self._setup_context()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context\n self._root_dir\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph\n for _ in graph.inject_roots_closure(target_roots):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure\n for address in self._inject_specs(target_roots.specs):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs\n subjects)\n File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__\n self.gen.throw(type, value, traceback)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context\n \'Build graph construction failed: {} {}\'.format(type(e).__name__, str(e))\n\nException message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer\n\n\n' .pants.d/pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py:151: AssertionError -------------- Captured stdout call -------------- logs/exceptions.84142.log +++ logs/exceptions.84142.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.84142.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.84142.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.84142.log >>> pid: 84142 logs/exceptions.84142.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.84142.log >>> main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.84142.log >>> PantsLoader.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.84142.log >>> cls.load_and_execute(entrypoint) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.84142.log >>> entrypoint_main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.84142.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.84142.log >>> return runner.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.84142.log >>> self._run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.84142.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.84142.log >>> return goal_runner_factory.create().run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.84142.log >>> goals, context = self._setup_context() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.84142.log >>> self._root_dir logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.84142.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.84142.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.84142.log >>> subjects) logs/exceptions.84142.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.84142.log >>> self.gen.throw(type, value, traceback) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.84142.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.84142.log >>> logs/exceptions.84142.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.84142.log >>> logs/exceptions.84142.log --- logs/exceptions.log +++ logs/exceptions.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.log >>> pid: 84142 logs/exceptions.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.log >>> main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.log >>> PantsLoader.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.log >>> cls.load_and_execute(entrypoint) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.log >>> entrypoint_main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.log >>> return runner.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.log >>> self._run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.log >>> return goal_runner_factory.create().run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.log >>> goals, context = self._setup_context() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.log >>> self._root_dir logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.log >>> subjects) logs/exceptions.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.log >>> self.gen.throw(type, value, traceback) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.log >>> logs/exceptions.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.log >>> logs/exceptions.log --- generated xml file: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest/tests.python.pants_test.base.exception_sink_integration/junitxml/TEST-tests.python.pants_test.base.exception_sink_integration.xml ============ slowest 3 test durations ============ 93.67s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt 6.08s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 5.55s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream 1 failed, 5 passed, 1 skipped in 118.85 seconds =
AssertionError
def _exit_with_failure(cls, terminal_msg): formatted_terminal_msg = cls._EXIT_FAILURE_TERMINAL_MESSAGE_FORMAT.format( timestamp=cls._iso_timestamp_for_now(), terminal_msg=terminal_msg or "<no exit reason provided>", ) # Exit with failure, printing a message to the terminal (or whatever the interactive stream is). cls._exiter.exit_and_fail( msg=formatted_terminal_msg, out=cls._interactive_output_stream )
def _exit_with_failure(cls, terminal_msg): formatted_terminal_msg = cls._EXIT_FAILURE_TERMINAL_MESSAGE_FORMAT.format( timestamp=cls._iso_timestamp_for_now(), terminal_msg=terminal_msg or "" ) # Exit with failure, printing a message to the terminal (or whatever the interactive stream is). cls._exiter.exit( result=cls.UNHANDLED_EXCEPTION_EXIT_CODE, msg=formatted_terminal_msg, out=cls._interactive_output_stream, )
https://github.com/pantsbuild/pants/issues/6847
23:26:42 01:10 [run] ============== test session starts =============== platform darwin -- Python 2.7.10, pytest-3.6.4, py-1.7.0, pluggy-0.7.1 -- /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python cachedir: .pants.d/.pytest_cache rootdir: /Users/travis/build/pantsbuild/pants/.pants.d, inifile: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest-prep/CPython-2.7.10/e241a5f8b7de6d34689cc9307d8d06eb155c7c78/pytest.ini plugins: timeout-1.2.1, cov-2.4.0 collecting ... collected 7 items tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_logs_on_terminate <- ../../../../../../System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/case.py SKIPPED [ 14%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 28%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_keyboardinterrupt_signals <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py FAILED [ 42%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_logs_unhandled_exception <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 57%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 71%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_exiter <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 85%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [100%] ==================== FAILURES ==================== ExceptionSinkIntegrationTest.test_keyboardinterrupt_signals self = <pants_test.base.test_exception_sink_integration.ExceptionSinkIntegrationTest testMethod=test_keyboardinterrupt_signals> def test_keyboardinterrupt_signals(self): for interrupt_signal in [signal.SIGINT, signal.SIGQUIT]: with self._send_signal_to_waiter_handle(interrupt_signal) as (workdir, waiter_run): > self.assertIn('Interrupted by user.\n', waiter_run.stderr_data) E AssertionError: u'Interrupted by user.\n' not found in u'From cffi callback <function extern_clone_val at 0x11098a938>:\nTraceback (most recent call last):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/native.py", line 427, in extern_clone_val\n @ffi.def_extern()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/base/exception_sink.py", line 351, in handle_signal_gracefully\n raise KeyboardInterrupt(\'User interrupted execution with control-c!\')\nKeyboardInterrupt: User interrupted execution with control-c!\ntimestamp: 2018-11-29T23:28:22.606384\nException caught: (pants.build_graph.address_lookup_error.AddressLookupError)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module>\n main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main\n PantsLoader.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run\n cls.load_and_execute(entrypoint)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute\n entrypoint_main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main\n PantsRunner(exiter, start_time=start_time).run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run\n return runner.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run\n self._run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run\n goal_runner_result = self._maybe_run_v1(run_tracker, reporting)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1\n return goal_runner_factory.create().run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create\n goals, context = self._setup_context()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context\n self._root_dir\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph\n for _ in graph.inject_roots_closure(target_roots):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure\n for address in self._inject_specs(target_roots.specs):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs\n subjects)\n File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__\n self.gen.throw(type, value, traceback)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context\n \'Build graph construction failed: {} {}\'.format(type(e).__name__, str(e))\n\nException message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer\n\n\n' .pants.d/pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py:151: AssertionError -------------- Captured stdout call -------------- logs/exceptions.84142.log +++ logs/exceptions.84142.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.84142.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.84142.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.84142.log >>> pid: 84142 logs/exceptions.84142.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.84142.log >>> main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.84142.log >>> PantsLoader.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.84142.log >>> cls.load_and_execute(entrypoint) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.84142.log >>> entrypoint_main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.84142.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.84142.log >>> return runner.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.84142.log >>> self._run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.84142.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.84142.log >>> return goal_runner_factory.create().run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.84142.log >>> goals, context = self._setup_context() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.84142.log >>> self._root_dir logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.84142.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.84142.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.84142.log >>> subjects) logs/exceptions.84142.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.84142.log >>> self.gen.throw(type, value, traceback) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.84142.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.84142.log >>> logs/exceptions.84142.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.84142.log >>> logs/exceptions.84142.log --- logs/exceptions.log +++ logs/exceptions.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.log >>> pid: 84142 logs/exceptions.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.log >>> main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.log >>> PantsLoader.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.log >>> cls.load_and_execute(entrypoint) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.log >>> entrypoint_main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.log >>> return runner.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.log >>> self._run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.log >>> return goal_runner_factory.create().run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.log >>> goals, context = self._setup_context() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.log >>> self._root_dir logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.log >>> subjects) logs/exceptions.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.log >>> self.gen.throw(type, value, traceback) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.log >>> logs/exceptions.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.log >>> logs/exceptions.log --- generated xml file: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest/tests.python.pants_test.base.exception_sink_integration/junitxml/TEST-tests.python.pants_test.base.exception_sink_integration.xml ============ slowest 3 test durations ============ 93.67s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt 6.08s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 5.55s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream 1 failed, 5 passed, 1 skipped in 118.85 seconds =
AssertionError
def _log_unhandled_exception_and_exit( cls, exc_class=None, exc=None, tb=None, add_newline=False ): """A sys.excepthook implementation which logs the error and exits with failure.""" exc_class = exc_class or sys.exc_info()[0] exc = exc or sys.exc_info()[1] tb = tb or sys.exc_info()[2] # This exception was raised by a signal handler with the intent to exit the program. if exc_class == SignalHandler.SignalHandledNonLocalExit: return cls._handle_signal_gracefully( exc.signum, exc.signame, exc.traceback_lines ) extra_err_msg = None try: # Always output the unhandled exception details into a log file, including the traceback. exception_log_entry = cls._format_unhandled_exception_log( exc, tb, add_newline, should_print_backtrace=True ) cls.log_exception(exception_log_entry) except Exception as e: extra_err_msg = "Additional error logging unhandled exception {}: {}".format( exc, e ) logger.error(extra_err_msg) # Generate an unhandled exception report fit to be printed to the terminal (respecting the # Exiter's should_print_backtrace field). stderr_printed_error = cls._format_unhandled_exception_log( exc, tb, add_newline, should_print_backtrace=cls._should_print_backtrace_to_terminal, ) if extra_err_msg: stderr_printed_error = "{}\n{}".format(stderr_printed_error, extra_err_msg) cls._exit_with_failure(stderr_printed_error)
def _log_unhandled_exception_and_exit( cls, exc_class=None, exc=None, tb=None, add_newline=False ): """A sys.excepthook implementation which logs the error and exits with failure.""" exc_class = exc_class or sys.exc_info()[0] exc = exc or sys.exc_info()[1] tb = tb or sys.exc_info()[2] extra_err_msg = None try: # Always output the unhandled exception details into a log file, including the traceback. exception_log_entry = cls._format_unhandled_exception_log( exc, tb, add_newline, should_print_backtrace=True ) cls.log_exception(exception_log_entry) except Exception as e: extra_err_msg = "Additional error logging unhandled exception {}: {}".format( exc, e ) logger.error(extra_err_msg) # Generate an unhandled exception report fit to be printed to the terminal (respecting the # Exiter's should_print_backtrace field). stderr_printed_error = cls._format_unhandled_exception_log( exc, tb, add_newline, should_print_backtrace=cls._should_print_backtrace_to_terminal, ) if extra_err_msg: stderr_printed_error = "{}\n{}".format(stderr_printed_error, extra_err_msg) cls._exit_with_failure(stderr_printed_error)
https://github.com/pantsbuild/pants/issues/6847
23:26:42 01:10 [run] ============== test session starts =============== platform darwin -- Python 2.7.10, pytest-3.6.4, py-1.7.0, pluggy-0.7.1 -- /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python cachedir: .pants.d/.pytest_cache rootdir: /Users/travis/build/pantsbuild/pants/.pants.d, inifile: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest-prep/CPython-2.7.10/e241a5f8b7de6d34689cc9307d8d06eb155c7c78/pytest.ini plugins: timeout-1.2.1, cov-2.4.0 collecting ... collected 7 items tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_logs_on_terminate <- ../../../../../../System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/case.py SKIPPED [ 14%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 28%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_keyboardinterrupt_signals <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py FAILED [ 42%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_logs_unhandled_exception <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 57%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 71%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_exiter <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 85%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [100%] ==================== FAILURES ==================== ExceptionSinkIntegrationTest.test_keyboardinterrupt_signals self = <pants_test.base.test_exception_sink_integration.ExceptionSinkIntegrationTest testMethod=test_keyboardinterrupt_signals> def test_keyboardinterrupt_signals(self): for interrupt_signal in [signal.SIGINT, signal.SIGQUIT]: with self._send_signal_to_waiter_handle(interrupt_signal) as (workdir, waiter_run): > self.assertIn('Interrupted by user.\n', waiter_run.stderr_data) E AssertionError: u'Interrupted by user.\n' not found in u'From cffi callback <function extern_clone_val at 0x11098a938>:\nTraceback (most recent call last):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/native.py", line 427, in extern_clone_val\n @ffi.def_extern()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/base/exception_sink.py", line 351, in handle_signal_gracefully\n raise KeyboardInterrupt(\'User interrupted execution with control-c!\')\nKeyboardInterrupt: User interrupted execution with control-c!\ntimestamp: 2018-11-29T23:28:22.606384\nException caught: (pants.build_graph.address_lookup_error.AddressLookupError)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module>\n main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main\n PantsLoader.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run\n cls.load_and_execute(entrypoint)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute\n entrypoint_main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main\n PantsRunner(exiter, start_time=start_time).run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run\n return runner.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run\n self._run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run\n goal_runner_result = self._maybe_run_v1(run_tracker, reporting)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1\n return goal_runner_factory.create().run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create\n goals, context = self._setup_context()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context\n self._root_dir\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph\n for _ in graph.inject_roots_closure(target_roots):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure\n for address in self._inject_specs(target_roots.specs):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs\n subjects)\n File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__\n self.gen.throw(type, value, traceback)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context\n \'Build graph construction failed: {} {}\'.format(type(e).__name__, str(e))\n\nException message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer\n\n\n' .pants.d/pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py:151: AssertionError -------------- Captured stdout call -------------- logs/exceptions.84142.log +++ logs/exceptions.84142.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.84142.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.84142.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.84142.log >>> pid: 84142 logs/exceptions.84142.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.84142.log >>> main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.84142.log >>> PantsLoader.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.84142.log >>> cls.load_and_execute(entrypoint) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.84142.log >>> entrypoint_main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.84142.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.84142.log >>> return runner.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.84142.log >>> self._run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.84142.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.84142.log >>> return goal_runner_factory.create().run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.84142.log >>> goals, context = self._setup_context() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.84142.log >>> self._root_dir logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.84142.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.84142.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.84142.log >>> subjects) logs/exceptions.84142.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.84142.log >>> self.gen.throw(type, value, traceback) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.84142.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.84142.log >>> logs/exceptions.84142.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.84142.log >>> logs/exceptions.84142.log --- logs/exceptions.log +++ logs/exceptions.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.log >>> pid: 84142 logs/exceptions.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.log >>> main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.log >>> PantsLoader.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.log >>> cls.load_and_execute(entrypoint) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.log >>> entrypoint_main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.log >>> return runner.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.log >>> self._run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.log >>> return goal_runner_factory.create().run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.log >>> goals, context = self._setup_context() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.log >>> self._root_dir logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.log >>> subjects) logs/exceptions.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.log >>> self.gen.throw(type, value, traceback) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.log >>> logs/exceptions.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.log >>> logs/exceptions.log --- generated xml file: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest/tests.python.pants_test.base.exception_sink_integration/junitxml/TEST-tests.python.pants_test.base.exception_sink_integration.xml ============ slowest 3 test durations ============ 93.67s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt 6.08s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 5.55s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream 1 failed, 5 passed, 1 skipped in 118.85 seconds =
AssertionError
def __init__(self, *args, **kwargs): """ :param int exit_code: an optional exit code (defaults to nonzero) :param list failed_targets: an optional list of failed targets (default=[]) """ self._exit_code = kwargs.pop("exit_code", PANTS_FAILED_EXIT_CODE) self._failed_targets = kwargs.pop("failed_targets", []) super(TaskError, self).__init__(*args, **kwargs)
def __init__(self, *args, **kwargs): """ :param int exit_code: an optional exit code (default=1) :param list failed_targets: an optional list of failed targets (default=[]) """ self._exit_code = kwargs.pop("exit_code", 1) self._failed_targets = kwargs.pop("failed_targets", []) super(TaskError, self).__init__(*args, **kwargs)
https://github.com/pantsbuild/pants/issues/6847
23:26:42 01:10 [run] ============== test session starts =============== platform darwin -- Python 2.7.10, pytest-3.6.4, py-1.7.0, pluggy-0.7.1 -- /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python cachedir: .pants.d/.pytest_cache rootdir: /Users/travis/build/pantsbuild/pants/.pants.d, inifile: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest-prep/CPython-2.7.10/e241a5f8b7de6d34689cc9307d8d06eb155c7c78/pytest.ini plugins: timeout-1.2.1, cov-2.4.0 collecting ... collected 7 items tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_logs_on_terminate <- ../../../../../../System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/case.py SKIPPED [ 14%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 28%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_keyboardinterrupt_signals <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py FAILED [ 42%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_logs_unhandled_exception <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 57%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 71%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_exiter <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 85%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [100%] ==================== FAILURES ==================== ExceptionSinkIntegrationTest.test_keyboardinterrupt_signals self = <pants_test.base.test_exception_sink_integration.ExceptionSinkIntegrationTest testMethod=test_keyboardinterrupt_signals> def test_keyboardinterrupt_signals(self): for interrupt_signal in [signal.SIGINT, signal.SIGQUIT]: with self._send_signal_to_waiter_handle(interrupt_signal) as (workdir, waiter_run): > self.assertIn('Interrupted by user.\n', waiter_run.stderr_data) E AssertionError: u'Interrupted by user.\n' not found in u'From cffi callback <function extern_clone_val at 0x11098a938>:\nTraceback (most recent call last):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/native.py", line 427, in extern_clone_val\n @ffi.def_extern()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/base/exception_sink.py", line 351, in handle_signal_gracefully\n raise KeyboardInterrupt(\'User interrupted execution with control-c!\')\nKeyboardInterrupt: User interrupted execution with control-c!\ntimestamp: 2018-11-29T23:28:22.606384\nException caught: (pants.build_graph.address_lookup_error.AddressLookupError)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module>\n main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main\n PantsLoader.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run\n cls.load_and_execute(entrypoint)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute\n entrypoint_main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main\n PantsRunner(exiter, start_time=start_time).run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run\n return runner.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run\n self._run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run\n goal_runner_result = self._maybe_run_v1(run_tracker, reporting)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1\n return goal_runner_factory.create().run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create\n goals, context = self._setup_context()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context\n self._root_dir\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph\n for _ in graph.inject_roots_closure(target_roots):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure\n for address in self._inject_specs(target_roots.specs):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs\n subjects)\n File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__\n self.gen.throw(type, value, traceback)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context\n \'Build graph construction failed: {} {}\'.format(type(e).__name__, str(e))\n\nException message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer\n\n\n' .pants.d/pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py:151: AssertionError -------------- Captured stdout call -------------- logs/exceptions.84142.log +++ logs/exceptions.84142.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.84142.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.84142.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.84142.log >>> pid: 84142 logs/exceptions.84142.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.84142.log >>> main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.84142.log >>> PantsLoader.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.84142.log >>> cls.load_and_execute(entrypoint) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.84142.log >>> entrypoint_main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.84142.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.84142.log >>> return runner.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.84142.log >>> self._run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.84142.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.84142.log >>> return goal_runner_factory.create().run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.84142.log >>> goals, context = self._setup_context() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.84142.log >>> self._root_dir logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.84142.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.84142.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.84142.log >>> subjects) logs/exceptions.84142.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.84142.log >>> self.gen.throw(type, value, traceback) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.84142.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.84142.log >>> logs/exceptions.84142.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.84142.log >>> logs/exceptions.84142.log --- logs/exceptions.log +++ logs/exceptions.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.log >>> pid: 84142 logs/exceptions.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.log >>> main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.log >>> PantsLoader.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.log >>> cls.load_and_execute(entrypoint) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.log >>> entrypoint_main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.log >>> return runner.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.log >>> self._run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.log >>> return goal_runner_factory.create().run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.log >>> goals, context = self._setup_context() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.log >>> self._root_dir logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.log >>> subjects) logs/exceptions.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.log >>> self.gen.throw(type, value, traceback) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.log >>> logs/exceptions.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.log >>> logs/exceptions.log --- generated xml file: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest/tests.python.pants_test.base.exception_sink_integration/junitxml/TEST-tests.python.pants_test.base.exception_sink_integration.xml ============ slowest 3 test durations ============ 93.67s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt 6.08s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 5.55s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream 1 failed, 5 passed, 1 skipped in 118.85 seconds =
AssertionError
def exit(self, result=PANTS_SUCCEEDED_EXIT_CODE, msg=None, out=None): """Exits the runtime. :param result: The exit status. Typically either PANTS_SUCCEEDED_EXIT_CODE or PANTS_FAILED_EXIT_CODE, but can be a string as well. (Optional) :param msg: A string message to print to stderr or another custom file desciptor before exiting. (Optional) :param out: The file descriptor to emit `msg` to. (Optional) """ if msg: out = out or sys.stderr if PY3 and hasattr(out, "buffer"): out = out.buffer msg = ensure_binary(msg) try: out.write(msg) out.write(b"\n") # TODO: Determine whether this call is a no-op because the stream gets flushed on exit, or # if we could lose what we just printed, e.g. if we get interrupted by a signal while # exiting and the stream is buffered like stdout. out.flush() except Exception as e: # If the file is already closed, or any other error occurs, just log it and continue to # exit. logger.exception(e) self._exit(result)
def exit(self, result=0, msg=None, out=None): """Exits the runtime. :param result: The exit status. Typically a 0 indicating success or a 1 indicating failure, but can be a string as well. (Optional) :param msg: A string message to print to stderr or another custom file desciptor before exiting. (Optional) :param out: The file descriptor to emit `msg` to. (Optional) """ if msg: out = out or sys.stderr if PY3 and hasattr(out, "buffer"): out = out.buffer msg = ensure_binary(msg) try: out.write(msg) out.write(b"\n") # TODO: Determine whether this call is a no-op because the stream gets flushed on exit, or # if we could lose what we just printed, e.g. if we get interrupted by a signal while # exiting and the stream is buffered like stdout. out.flush() except Exception as e: # If the file is already closed, or any other error occurs, just log it and continue to # exit. logger.exception(e) self._exit(result)
https://github.com/pantsbuild/pants/issues/6847
23:26:42 01:10 [run] ============== test session starts =============== platform darwin -- Python 2.7.10, pytest-3.6.4, py-1.7.0, pluggy-0.7.1 -- /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python cachedir: .pants.d/.pytest_cache rootdir: /Users/travis/build/pantsbuild/pants/.pants.d, inifile: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest-prep/CPython-2.7.10/e241a5f8b7de6d34689cc9307d8d06eb155c7c78/pytest.ini plugins: timeout-1.2.1, cov-2.4.0 collecting ... collected 7 items tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_logs_on_terminate <- ../../../../../../System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/case.py SKIPPED [ 14%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 28%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_keyboardinterrupt_signals <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py FAILED [ 42%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_logs_unhandled_exception <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 57%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 71%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_exiter <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 85%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [100%] ==================== FAILURES ==================== ExceptionSinkIntegrationTest.test_keyboardinterrupt_signals self = <pants_test.base.test_exception_sink_integration.ExceptionSinkIntegrationTest testMethod=test_keyboardinterrupt_signals> def test_keyboardinterrupt_signals(self): for interrupt_signal in [signal.SIGINT, signal.SIGQUIT]: with self._send_signal_to_waiter_handle(interrupt_signal) as (workdir, waiter_run): > self.assertIn('Interrupted by user.\n', waiter_run.stderr_data) E AssertionError: u'Interrupted by user.\n' not found in u'From cffi callback <function extern_clone_val at 0x11098a938>:\nTraceback (most recent call last):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/native.py", line 427, in extern_clone_val\n @ffi.def_extern()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/base/exception_sink.py", line 351, in handle_signal_gracefully\n raise KeyboardInterrupt(\'User interrupted execution with control-c!\')\nKeyboardInterrupt: User interrupted execution with control-c!\ntimestamp: 2018-11-29T23:28:22.606384\nException caught: (pants.build_graph.address_lookup_error.AddressLookupError)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module>\n main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main\n PantsLoader.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run\n cls.load_and_execute(entrypoint)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute\n entrypoint_main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main\n PantsRunner(exiter, start_time=start_time).run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run\n return runner.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run\n self._run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run\n goal_runner_result = self._maybe_run_v1(run_tracker, reporting)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1\n return goal_runner_factory.create().run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create\n goals, context = self._setup_context()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context\n self._root_dir\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph\n for _ in graph.inject_roots_closure(target_roots):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure\n for address in self._inject_specs(target_roots.specs):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs\n subjects)\n File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__\n self.gen.throw(type, value, traceback)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context\n \'Build graph construction failed: {} {}\'.format(type(e).__name__, str(e))\n\nException message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer\n\n\n' .pants.d/pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py:151: AssertionError -------------- Captured stdout call -------------- logs/exceptions.84142.log +++ logs/exceptions.84142.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.84142.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.84142.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.84142.log >>> pid: 84142 logs/exceptions.84142.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.84142.log >>> main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.84142.log >>> PantsLoader.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.84142.log >>> cls.load_and_execute(entrypoint) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.84142.log >>> entrypoint_main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.84142.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.84142.log >>> return runner.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.84142.log >>> self._run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.84142.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.84142.log >>> return goal_runner_factory.create().run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.84142.log >>> goals, context = self._setup_context() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.84142.log >>> self._root_dir logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.84142.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.84142.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.84142.log >>> subjects) logs/exceptions.84142.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.84142.log >>> self.gen.throw(type, value, traceback) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.84142.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.84142.log >>> logs/exceptions.84142.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.84142.log >>> logs/exceptions.84142.log --- logs/exceptions.log +++ logs/exceptions.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.log >>> pid: 84142 logs/exceptions.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.log >>> main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.log >>> PantsLoader.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.log >>> cls.load_and_execute(entrypoint) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.log >>> entrypoint_main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.log >>> return runner.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.log >>> self._run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.log >>> return goal_runner_factory.create().run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.log >>> goals, context = self._setup_context() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.log >>> self._root_dir logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.log >>> subjects) logs/exceptions.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.log >>> self.gen.throw(type, value, traceback) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.log >>> logs/exceptions.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.log >>> logs/exceptions.log --- generated xml file: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest/tests.python.pants_test.base.exception_sink_integration/junitxml/TEST-tests.python.pants_test.base.exception_sink_integration.xml ============ slowest 3 test durations ============ 93.67s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt 6.08s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 5.55s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream 1 failed, 5 passed, 1 skipped in 118.85 seconds =
AssertionError
def exit_and_fail(self, msg=None, out=None): """Exits the runtime with a nonzero exit code, indicating failure. :param msg: A string message to print to stderr or another custom file desciptor before exiting. (Optional) :param out: The file descriptor to emit `msg` to. (Optional) """ self.exit(result=PANTS_FAILED_EXIT_CODE, msg=msg, out=out)
def exit_and_fail(self, msg=None): """Exits the runtime with an exit code of 1, indicating failure. :param str msg: A string message to print to stderr before exiting. (Optional) """ self.exit(result=1, msg=msg)
https://github.com/pantsbuild/pants/issues/6847
23:26:42 01:10 [run] ============== test session starts =============== platform darwin -- Python 2.7.10, pytest-3.6.4, py-1.7.0, pluggy-0.7.1 -- /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python cachedir: .pants.d/.pytest_cache rootdir: /Users/travis/build/pantsbuild/pants/.pants.d, inifile: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest-prep/CPython-2.7.10/e241a5f8b7de6d34689cc9307d8d06eb155c7c78/pytest.ini plugins: timeout-1.2.1, cov-2.4.0 collecting ... collected 7 items tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_logs_on_terminate <- ../../../../../../System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/case.py SKIPPED [ 14%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 28%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_keyboardinterrupt_signals <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py FAILED [ 42%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_logs_unhandled_exception <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 57%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 71%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_exiter <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 85%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [100%] ==================== FAILURES ==================== ExceptionSinkIntegrationTest.test_keyboardinterrupt_signals self = <pants_test.base.test_exception_sink_integration.ExceptionSinkIntegrationTest testMethod=test_keyboardinterrupt_signals> def test_keyboardinterrupt_signals(self): for interrupt_signal in [signal.SIGINT, signal.SIGQUIT]: with self._send_signal_to_waiter_handle(interrupt_signal) as (workdir, waiter_run): > self.assertIn('Interrupted by user.\n', waiter_run.stderr_data) E AssertionError: u'Interrupted by user.\n' not found in u'From cffi callback <function extern_clone_val at 0x11098a938>:\nTraceback (most recent call last):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/native.py", line 427, in extern_clone_val\n @ffi.def_extern()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/base/exception_sink.py", line 351, in handle_signal_gracefully\n raise KeyboardInterrupt(\'User interrupted execution with control-c!\')\nKeyboardInterrupt: User interrupted execution with control-c!\ntimestamp: 2018-11-29T23:28:22.606384\nException caught: (pants.build_graph.address_lookup_error.AddressLookupError)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module>\n main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main\n PantsLoader.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run\n cls.load_and_execute(entrypoint)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute\n entrypoint_main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main\n PantsRunner(exiter, start_time=start_time).run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run\n return runner.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run\n self._run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run\n goal_runner_result = self._maybe_run_v1(run_tracker, reporting)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1\n return goal_runner_factory.create().run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create\n goals, context = self._setup_context()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context\n self._root_dir\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph\n for _ in graph.inject_roots_closure(target_roots):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure\n for address in self._inject_specs(target_roots.specs):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs\n subjects)\n File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__\n self.gen.throw(type, value, traceback)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context\n \'Build graph construction failed: {} {}\'.format(type(e).__name__, str(e))\n\nException message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer\n\n\n' .pants.d/pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py:151: AssertionError -------------- Captured stdout call -------------- logs/exceptions.84142.log +++ logs/exceptions.84142.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.84142.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.84142.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.84142.log >>> pid: 84142 logs/exceptions.84142.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.84142.log >>> main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.84142.log >>> PantsLoader.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.84142.log >>> cls.load_and_execute(entrypoint) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.84142.log >>> entrypoint_main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.84142.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.84142.log >>> return runner.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.84142.log >>> self._run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.84142.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.84142.log >>> return goal_runner_factory.create().run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.84142.log >>> goals, context = self._setup_context() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.84142.log >>> self._root_dir logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.84142.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.84142.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.84142.log >>> subjects) logs/exceptions.84142.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.84142.log >>> self.gen.throw(type, value, traceback) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.84142.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.84142.log >>> logs/exceptions.84142.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.84142.log >>> logs/exceptions.84142.log --- logs/exceptions.log +++ logs/exceptions.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.log >>> pid: 84142 logs/exceptions.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.log >>> main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.log >>> PantsLoader.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.log >>> cls.load_and_execute(entrypoint) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.log >>> entrypoint_main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.log >>> return runner.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.log >>> self._run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.log >>> return goal_runner_factory.create().run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.log >>> goals, context = self._setup_context() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.log >>> self._root_dir logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.log >>> subjects) logs/exceptions.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.log >>> self.gen.throw(type, value, traceback) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.log >>> logs/exceptions.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.log >>> logs/exceptions.log --- generated xml file: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest/tests.python.pants_test.base.exception_sink_integration/junitxml/TEST-tests.python.pants_test.base.exception_sink_integration.xml ============ slowest 3 test durations ============ 93.67s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt 6.08s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 5.55s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream 1 failed, 5 passed, 1 skipped in 118.85 seconds =
AssertionError
def post_fork_child(self): """Post-fork child process callback executed via ProcessManager.daemonize().""" # Set the Exiter exception hook post-fork so as not to affect the pantsd processes exception # hook with socket-specific behavior. Note that this intentionally points the faulthandler # trace stream to sys.stderr, which at this point is still a _LoggerStream object writing to # the `pantsd.log`. This ensures that in the event of e.g. a hung but detached pantsd-runner # process that the stacktrace output lands deterministically in a known place vs to a stray # terminal window. # TODO: test the above! ExceptionSink.reset_exiter(self._exiter) ExceptionSink.reset_interactive_output_stream( sys.stderr.buffer if PY3 else sys.stderr ) ExceptionSink.reset_signal_handler(DaemonSignalHandler()) # Ensure anything referencing sys.argv inherits the Pailgun'd args. sys.argv = self._args # Set context in the process title. set_process_title("pantsd-runner [{}]".format(" ".join(self._args))) # Broadcast our process group ID (in PID form - i.e. negated) to the remote client so # they can send signals (e.g. SIGINT) to all processes in the runners process group. NailgunProtocol.send_pid(self._socket, os.getpid()) NailgunProtocol.send_pgrp(self._socket, os.getpgrp() * -1) # Stop the services that were paused pre-fork. for service in self._services.services: service.terminate() # Invoke a Pants run with stdio redirected and a proxied environment. with ( self.nailgunned_stdio(self._socket, self._env) as finalizer, hermetic_environment_as(**self._env), ): try: # Setup the Exiter's finalizer. self._exiter.set_finalizer(finalizer) # Clean global state. clean_global_runtime_state(reset_subsystem=True) # Re-raise any deferred exceptions, if present. self._raise_deferred_exc() # Otherwise, conduct a normal run. runner = LocalPantsRunner.create( self._exiter, self._args, self._env, self._target_roots, self._graph_helper, self._options_bootstrapper, ) runner.set_start_time(self._maybe_get_client_start_time_from_env(self._env)) runner.run() except KeyboardInterrupt: self._exiter.exit_and_fail("Interrupted by user.\n") except GracefulTerminationException as e: ExceptionSink.log_exception( "Encountered graceful termination exception {}; exiting".format(e) ) self._exiter.exit(e.exit_code) except Exception: ExceptionSink._log_unhandled_exception_and_exit() else: self._exiter.exit(PANTS_SUCCEEDED_EXIT_CODE)
def post_fork_child(self): """Post-fork child process callback executed via ProcessManager.daemonize().""" # Set the Exiter exception hook post-fork so as not to affect the pantsd processes exception # hook with socket-specific behavior. Note that this intentionally points the faulthandler # trace stream to sys.stderr, which at this point is still a _LoggerStream object writing to # the `pantsd.log`. This ensures that in the event of e.g. a hung but detached pantsd-runner # process that the stacktrace output lands deterministically in a known place vs to a stray # terminal window. # TODO: test the above! ExceptionSink.reset_exiter(self._exiter) ExceptionSink.reset_interactive_output_stream( sys.stderr.buffer if PY3 else sys.stderr ) # Ensure anything referencing sys.argv inherits the Pailgun'd args. sys.argv = self._args # Set context in the process title. set_process_title("pantsd-runner [{}]".format(" ".join(self._args))) # Broadcast our process group ID (in PID form - i.e. negated) to the remote client so # they can send signals (e.g. SIGINT) to all processes in the runners process group. NailgunProtocol.send_pid(self._socket, os.getpid()) NailgunProtocol.send_pgrp(self._socket, os.getpgrp() * -1) # Stop the services that were paused pre-fork. for service in self._services.services: service.terminate() # Invoke a Pants run with stdio redirected and a proxied environment. with ( self.nailgunned_stdio(self._socket, self._env) as finalizer, hermetic_environment_as(**self._env), ): try: # Setup the Exiter's finalizer. self._exiter.set_finalizer(finalizer) # Clean global state. clean_global_runtime_state(reset_subsystem=True) # Re-raise any deferred exceptions, if present. self._raise_deferred_exc() # Otherwise, conduct a normal run. runner = LocalPantsRunner.create( self._exiter, self._args, self._env, self._target_roots, self._graph_helper, self._options_bootstrapper, ) runner.set_start_time(self._maybe_get_client_start_time_from_env(self._env)) runner.run() except KeyboardInterrupt: self._exiter.exit_and_fail("Interrupted by user.\n") except GracefulTerminationException as e: ExceptionSink.log_exception( "Encountered graceful termination exception {}; exiting".format(e) ) self._exiter.exit(e.exit_code) except Exception: ExceptionSink._log_unhandled_exception_and_exit() else: self._exiter.exit(0)
https://github.com/pantsbuild/pants/issues/6847
23:26:42 01:10 [run] ============== test session starts =============== platform darwin -- Python 2.7.10, pytest-3.6.4, py-1.7.0, pluggy-0.7.1 -- /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python cachedir: .pants.d/.pytest_cache rootdir: /Users/travis/build/pantsbuild/pants/.pants.d, inifile: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest-prep/CPython-2.7.10/e241a5f8b7de6d34689cc9307d8d06eb155c7c78/pytest.ini plugins: timeout-1.2.1, cov-2.4.0 collecting ... collected 7 items tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_logs_on_terminate <- ../../../../../../System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/case.py SKIPPED [ 14%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 28%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_keyboardinterrupt_signals <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py FAILED [ 42%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_logs_unhandled_exception <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 57%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 71%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_exiter <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 85%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [100%] ==================== FAILURES ==================== ExceptionSinkIntegrationTest.test_keyboardinterrupt_signals self = <pants_test.base.test_exception_sink_integration.ExceptionSinkIntegrationTest testMethod=test_keyboardinterrupt_signals> def test_keyboardinterrupt_signals(self): for interrupt_signal in [signal.SIGINT, signal.SIGQUIT]: with self._send_signal_to_waiter_handle(interrupt_signal) as (workdir, waiter_run): > self.assertIn('Interrupted by user.\n', waiter_run.stderr_data) E AssertionError: u'Interrupted by user.\n' not found in u'From cffi callback <function extern_clone_val at 0x11098a938>:\nTraceback (most recent call last):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/native.py", line 427, in extern_clone_val\n @ffi.def_extern()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/base/exception_sink.py", line 351, in handle_signal_gracefully\n raise KeyboardInterrupt(\'User interrupted execution with control-c!\')\nKeyboardInterrupt: User interrupted execution with control-c!\ntimestamp: 2018-11-29T23:28:22.606384\nException caught: (pants.build_graph.address_lookup_error.AddressLookupError)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module>\n main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main\n PantsLoader.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run\n cls.load_and_execute(entrypoint)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute\n entrypoint_main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main\n PantsRunner(exiter, start_time=start_time).run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run\n return runner.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run\n self._run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run\n goal_runner_result = self._maybe_run_v1(run_tracker, reporting)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1\n return goal_runner_factory.create().run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create\n goals, context = self._setup_context()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context\n self._root_dir\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph\n for _ in graph.inject_roots_closure(target_roots):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure\n for address in self._inject_specs(target_roots.specs):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs\n subjects)\n File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__\n self.gen.throw(type, value, traceback)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context\n \'Build graph construction failed: {} {}\'.format(type(e).__name__, str(e))\n\nException message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer\n\n\n' .pants.d/pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py:151: AssertionError -------------- Captured stdout call -------------- logs/exceptions.84142.log +++ logs/exceptions.84142.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.84142.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.84142.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.84142.log >>> pid: 84142 logs/exceptions.84142.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.84142.log >>> main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.84142.log >>> PantsLoader.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.84142.log >>> cls.load_and_execute(entrypoint) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.84142.log >>> entrypoint_main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.84142.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.84142.log >>> return runner.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.84142.log >>> self._run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.84142.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.84142.log >>> return goal_runner_factory.create().run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.84142.log >>> goals, context = self._setup_context() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.84142.log >>> self._root_dir logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.84142.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.84142.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.84142.log >>> subjects) logs/exceptions.84142.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.84142.log >>> self.gen.throw(type, value, traceback) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.84142.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.84142.log >>> logs/exceptions.84142.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.84142.log >>> logs/exceptions.84142.log --- logs/exceptions.log +++ logs/exceptions.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.log >>> pid: 84142 logs/exceptions.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.log >>> main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.log >>> PantsLoader.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.log >>> cls.load_and_execute(entrypoint) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.log >>> entrypoint_main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.log >>> return runner.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.log >>> self._run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.log >>> return goal_runner_factory.create().run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.log >>> goals, context = self._setup_context() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.log >>> self._root_dir logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.log >>> subjects) logs/exceptions.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.log >>> self.gen.throw(type, value, traceback) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.log >>> logs/exceptions.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.log >>> logs/exceptions.log --- generated xml file: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest/tests.python.pants_test.base.exception_sink_integration/junitxml/TEST-tests.python.pants_test.base.exception_sink_integration.xml ============ slowest 3 test durations ============ 93.67s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt 6.08s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 5.55s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream 1 failed, 5 passed, 1 skipped in 118.85 seconds =
AssertionError
def __init__( self, build_root, exiter, options, options_bootstrapper, build_config, target_roots, graph_session, is_daemon, profile_path, ): """ :param string build_root: The build root for this run. :param Exiter exiter: The Exiter instance to use for this run. :param Options options: The parsed options for this run. :param OptionsBootstrapper options_bootstrapper: The OptionsBootstrapper instance to use. :param BuildConfiguration build_config: The parsed build configuration for this run. :param TargetRoots target_roots: The `TargetRoots` for this run. :param LegacyGraphSession graph_session: A LegacyGraphSession instance for graph reuse. :param bool is_daemon: Whether or not this run was launched with a daemon graph helper. :param string profile_path: The profile path - if any (from from the `PANTS_PROFILE` env var). """ self._build_root = build_root self._exiter = exiter self._options = options self._options_bootstrapper = options_bootstrapper self._build_config = build_config self._target_roots = target_roots self._graph_session = graph_session self._is_daemon = is_daemon self._profile_path = profile_path self._run_start_time = None self._run_tracker = None self._reporting = None self._repro = None self._global_options = options.for_global_scope()
def __init__( self, build_root, exiter, options, options_bootstrapper, build_config, target_roots, graph_session, is_daemon, profile_path, ): """ :param string build_root: The build root for this run. :param Exiter exiter: The Exiter instance to use for this run. :param Options options: The parsed options for this run. :param OptionsBootstrapper options_bootstrapper: The OptionsBootstrapper instance to use. :param BuildConfiguration build_config: The parsed build configuration for this run. :param TargetRoots target_roots: The `TargetRoots` for this run. :param LegacyGraphSession graph_session: A LegacyGraphSession instance for graph reuse. :param bool is_daemon: Whether or not this run was launched with a daemon graph helper. :param string profile_path: The profile path - if any (from from the `PANTS_PROFILE` env var). """ self._build_root = build_root self._exiter = exiter self._options = options self._options_bootstrapper = options_bootstrapper self._build_config = build_config self._target_roots = target_roots self._graph_session = graph_session self._is_daemon = is_daemon self._profile_path = profile_path self._run_start_time = None self._global_options = options.for_global_scope()
https://github.com/pantsbuild/pants/issues/6847
23:26:42 01:10 [run] ============== test session starts =============== platform darwin -- Python 2.7.10, pytest-3.6.4, py-1.7.0, pluggy-0.7.1 -- /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python cachedir: .pants.d/.pytest_cache rootdir: /Users/travis/build/pantsbuild/pants/.pants.d, inifile: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest-prep/CPython-2.7.10/e241a5f8b7de6d34689cc9307d8d06eb155c7c78/pytest.ini plugins: timeout-1.2.1, cov-2.4.0 collecting ... collected 7 items tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_logs_on_terminate <- ../../../../../../System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/case.py SKIPPED [ 14%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 28%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_keyboardinterrupt_signals <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py FAILED [ 42%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_logs_unhandled_exception <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 57%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 71%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_exiter <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 85%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [100%] ==================== FAILURES ==================== ExceptionSinkIntegrationTest.test_keyboardinterrupt_signals self = <pants_test.base.test_exception_sink_integration.ExceptionSinkIntegrationTest testMethod=test_keyboardinterrupt_signals> def test_keyboardinterrupt_signals(self): for interrupt_signal in [signal.SIGINT, signal.SIGQUIT]: with self._send_signal_to_waiter_handle(interrupt_signal) as (workdir, waiter_run): > self.assertIn('Interrupted by user.\n', waiter_run.stderr_data) E AssertionError: u'Interrupted by user.\n' not found in u'From cffi callback <function extern_clone_val at 0x11098a938>:\nTraceback (most recent call last):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/native.py", line 427, in extern_clone_val\n @ffi.def_extern()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/base/exception_sink.py", line 351, in handle_signal_gracefully\n raise KeyboardInterrupt(\'User interrupted execution with control-c!\')\nKeyboardInterrupt: User interrupted execution with control-c!\ntimestamp: 2018-11-29T23:28:22.606384\nException caught: (pants.build_graph.address_lookup_error.AddressLookupError)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module>\n main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main\n PantsLoader.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run\n cls.load_and_execute(entrypoint)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute\n entrypoint_main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main\n PantsRunner(exiter, start_time=start_time).run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run\n return runner.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run\n self._run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run\n goal_runner_result = self._maybe_run_v1(run_tracker, reporting)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1\n return goal_runner_factory.create().run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create\n goals, context = self._setup_context()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context\n self._root_dir\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph\n for _ in graph.inject_roots_closure(target_roots):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure\n for address in self._inject_specs(target_roots.specs):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs\n subjects)\n File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__\n self.gen.throw(type, value, traceback)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context\n \'Build graph construction failed: {} {}\'.format(type(e).__name__, str(e))\n\nException message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer\n\n\n' .pants.d/pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py:151: AssertionError -------------- Captured stdout call -------------- logs/exceptions.84142.log +++ logs/exceptions.84142.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.84142.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.84142.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.84142.log >>> pid: 84142 logs/exceptions.84142.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.84142.log >>> main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.84142.log >>> PantsLoader.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.84142.log >>> cls.load_and_execute(entrypoint) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.84142.log >>> entrypoint_main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.84142.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.84142.log >>> return runner.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.84142.log >>> self._run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.84142.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.84142.log >>> return goal_runner_factory.create().run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.84142.log >>> goals, context = self._setup_context() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.84142.log >>> self._root_dir logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.84142.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.84142.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.84142.log >>> subjects) logs/exceptions.84142.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.84142.log >>> self.gen.throw(type, value, traceback) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.84142.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.84142.log >>> logs/exceptions.84142.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.84142.log >>> logs/exceptions.84142.log --- logs/exceptions.log +++ logs/exceptions.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.log >>> pid: 84142 logs/exceptions.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.log >>> main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.log >>> PantsLoader.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.log >>> cls.load_and_execute(entrypoint) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.log >>> entrypoint_main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.log >>> return runner.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.log >>> self._run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.log >>> return goal_runner_factory.create().run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.log >>> goals, context = self._setup_context() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.log >>> self._root_dir logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.log >>> subjects) logs/exceptions.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.log >>> self.gen.throw(type, value, traceback) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.log >>> logs/exceptions.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.log >>> logs/exceptions.log --- generated xml file: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest/tests.python.pants_test.base.exception_sink_integration/junitxml/TEST-tests.python.pants_test.base.exception_sink_integration.xml ============ slowest 3 test durations ============ 93.67s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt 6.08s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 5.55s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream 1 failed, 5 passed, 1 skipped in 118.85 seconds =
AssertionError
def set_start_time(self, start_time): # Launch RunTracker as early as possible (before .run() is called). self._run_tracker = RunTracker.global_instance() self._reporting = Reporting.global_instance() self._run_start_time = start_time self._reporting.initialize( self._run_tracker, self._options, start_time=self._run_start_time ) # Capture a repro of the 'before' state for this build, if needed. self._repro = Reproducer.global_instance().create_repro() if self._repro: self._repro.capture(self._run_tracker.run_info.get_as_dict()) # The __call__ method of the Exiter allows for the prototype pattern. self._exiter = LocalExiter(self._run_tracker, self._repro, exiter=self._exiter) ExceptionSink.reset_exiter(self._exiter)
def set_start_time(self, start_time): self._run_start_time = start_time
https://github.com/pantsbuild/pants/issues/6847
23:26:42 01:10 [run] ============== test session starts =============== platform darwin -- Python 2.7.10, pytest-3.6.4, py-1.7.0, pluggy-0.7.1 -- /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python cachedir: .pants.d/.pytest_cache rootdir: /Users/travis/build/pantsbuild/pants/.pants.d, inifile: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest-prep/CPython-2.7.10/e241a5f8b7de6d34689cc9307d8d06eb155c7c78/pytest.ini plugins: timeout-1.2.1, cov-2.4.0 collecting ... collected 7 items tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_logs_on_terminate <- ../../../../../../System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/case.py SKIPPED [ 14%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 28%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_keyboardinterrupt_signals <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py FAILED [ 42%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_logs_unhandled_exception <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 57%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 71%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_exiter <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 85%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [100%] ==================== FAILURES ==================== ExceptionSinkIntegrationTest.test_keyboardinterrupt_signals self = <pants_test.base.test_exception_sink_integration.ExceptionSinkIntegrationTest testMethod=test_keyboardinterrupt_signals> def test_keyboardinterrupt_signals(self): for interrupt_signal in [signal.SIGINT, signal.SIGQUIT]: with self._send_signal_to_waiter_handle(interrupt_signal) as (workdir, waiter_run): > self.assertIn('Interrupted by user.\n', waiter_run.stderr_data) E AssertionError: u'Interrupted by user.\n' not found in u'From cffi callback <function extern_clone_val at 0x11098a938>:\nTraceback (most recent call last):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/native.py", line 427, in extern_clone_val\n @ffi.def_extern()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/base/exception_sink.py", line 351, in handle_signal_gracefully\n raise KeyboardInterrupt(\'User interrupted execution with control-c!\')\nKeyboardInterrupt: User interrupted execution with control-c!\ntimestamp: 2018-11-29T23:28:22.606384\nException caught: (pants.build_graph.address_lookup_error.AddressLookupError)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module>\n main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main\n PantsLoader.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run\n cls.load_and_execute(entrypoint)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute\n entrypoint_main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main\n PantsRunner(exiter, start_time=start_time).run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run\n return runner.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run\n self._run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run\n goal_runner_result = self._maybe_run_v1(run_tracker, reporting)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1\n return goal_runner_factory.create().run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create\n goals, context = self._setup_context()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context\n self._root_dir\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph\n for _ in graph.inject_roots_closure(target_roots):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure\n for address in self._inject_specs(target_roots.specs):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs\n subjects)\n File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__\n self.gen.throw(type, value, traceback)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context\n \'Build graph construction failed: {} {}\'.format(type(e).__name__, str(e))\n\nException message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer\n\n\n' .pants.d/pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py:151: AssertionError -------------- Captured stdout call -------------- logs/exceptions.84142.log +++ logs/exceptions.84142.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.84142.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.84142.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.84142.log >>> pid: 84142 logs/exceptions.84142.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.84142.log >>> main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.84142.log >>> PantsLoader.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.84142.log >>> cls.load_and_execute(entrypoint) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.84142.log >>> entrypoint_main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.84142.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.84142.log >>> return runner.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.84142.log >>> self._run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.84142.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.84142.log >>> return goal_runner_factory.create().run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.84142.log >>> goals, context = self._setup_context() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.84142.log >>> self._root_dir logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.84142.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.84142.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.84142.log >>> subjects) logs/exceptions.84142.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.84142.log >>> self.gen.throw(type, value, traceback) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.84142.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.84142.log >>> logs/exceptions.84142.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.84142.log >>> logs/exceptions.84142.log --- logs/exceptions.log +++ logs/exceptions.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.log >>> pid: 84142 logs/exceptions.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.log >>> main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.log >>> PantsLoader.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.log >>> cls.load_and_execute(entrypoint) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.log >>> entrypoint_main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.log >>> return runner.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.log >>> self._run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.log >>> return goal_runner_factory.create().run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.log >>> goals, context = self._setup_context() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.log >>> self._root_dir logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.log >>> subjects) logs/exceptions.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.log >>> self.gen.throw(type, value, traceback) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.log >>> logs/exceptions.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.log >>> logs/exceptions.log --- generated xml file: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest/tests.python.pants_test.base.exception_sink_integration/junitxml/TEST-tests.python.pants_test.base.exception_sink_integration.xml ============ slowest 3 test durations ============ 93.67s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt 6.08s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 5.55s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream 1 failed, 5 passed, 1 skipped in 118.85 seconds =
AssertionError
def _maybe_run_v1(self): if not self._global_options.v1: return PANTS_SUCCEEDED_EXIT_CODE # Setup and run GoalRunner. goal_runner_factory = GoalRunner.Factory( self._build_root, self._options, self._build_config, self._run_tracker, self._reporting, self._graph_session, self._target_roots, self._exiter, ) return goal_runner_factory.create().run()
def _maybe_run_v1(self, run_tracker, reporting): if not self._global_options.v1: return 0 # Setup and run GoalRunner. goal_runner_factory = GoalRunner.Factory( self._build_root, self._options, self._build_config, run_tracker, reporting, self._graph_session, self._target_roots, self._exiter, ) return goal_runner_factory.create().run()
https://github.com/pantsbuild/pants/issues/6847
23:26:42 01:10 [run] ============== test session starts =============== platform darwin -- Python 2.7.10, pytest-3.6.4, py-1.7.0, pluggy-0.7.1 -- /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python cachedir: .pants.d/.pytest_cache rootdir: /Users/travis/build/pantsbuild/pants/.pants.d, inifile: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest-prep/CPython-2.7.10/e241a5f8b7de6d34689cc9307d8d06eb155c7c78/pytest.ini plugins: timeout-1.2.1, cov-2.4.0 collecting ... collected 7 items tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_logs_on_terminate <- ../../../../../../System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/case.py SKIPPED [ 14%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 28%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_keyboardinterrupt_signals <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py FAILED [ 42%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_logs_unhandled_exception <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 57%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 71%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_exiter <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 85%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [100%] ==================== FAILURES ==================== ExceptionSinkIntegrationTest.test_keyboardinterrupt_signals self = <pants_test.base.test_exception_sink_integration.ExceptionSinkIntegrationTest testMethod=test_keyboardinterrupt_signals> def test_keyboardinterrupt_signals(self): for interrupt_signal in [signal.SIGINT, signal.SIGQUIT]: with self._send_signal_to_waiter_handle(interrupt_signal) as (workdir, waiter_run): > self.assertIn('Interrupted by user.\n', waiter_run.stderr_data) E AssertionError: u'Interrupted by user.\n' not found in u'From cffi callback <function extern_clone_val at 0x11098a938>:\nTraceback (most recent call last):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/native.py", line 427, in extern_clone_val\n @ffi.def_extern()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/base/exception_sink.py", line 351, in handle_signal_gracefully\n raise KeyboardInterrupt(\'User interrupted execution with control-c!\')\nKeyboardInterrupt: User interrupted execution with control-c!\ntimestamp: 2018-11-29T23:28:22.606384\nException caught: (pants.build_graph.address_lookup_error.AddressLookupError)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module>\n main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main\n PantsLoader.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run\n cls.load_and_execute(entrypoint)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute\n entrypoint_main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main\n PantsRunner(exiter, start_time=start_time).run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run\n return runner.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run\n self._run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run\n goal_runner_result = self._maybe_run_v1(run_tracker, reporting)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1\n return goal_runner_factory.create().run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create\n goals, context = self._setup_context()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context\n self._root_dir\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph\n for _ in graph.inject_roots_closure(target_roots):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure\n for address in self._inject_specs(target_roots.specs):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs\n subjects)\n File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__\n self.gen.throw(type, value, traceback)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context\n \'Build graph construction failed: {} {}\'.format(type(e).__name__, str(e))\n\nException message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer\n\n\n' .pants.d/pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py:151: AssertionError -------------- Captured stdout call -------------- logs/exceptions.84142.log +++ logs/exceptions.84142.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.84142.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.84142.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.84142.log >>> pid: 84142 logs/exceptions.84142.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.84142.log >>> main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.84142.log >>> PantsLoader.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.84142.log >>> cls.load_and_execute(entrypoint) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.84142.log >>> entrypoint_main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.84142.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.84142.log >>> return runner.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.84142.log >>> self._run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.84142.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.84142.log >>> return goal_runner_factory.create().run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.84142.log >>> goals, context = self._setup_context() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.84142.log >>> self._root_dir logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.84142.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.84142.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.84142.log >>> subjects) logs/exceptions.84142.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.84142.log >>> self.gen.throw(type, value, traceback) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.84142.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.84142.log >>> logs/exceptions.84142.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.84142.log >>> logs/exceptions.84142.log --- logs/exceptions.log +++ logs/exceptions.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.log >>> pid: 84142 logs/exceptions.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.log >>> main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.log >>> PantsLoader.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.log >>> cls.load_and_execute(entrypoint) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.log >>> entrypoint_main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.log >>> return runner.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.log >>> self._run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.log >>> return goal_runner_factory.create().run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.log >>> goals, context = self._setup_context() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.log >>> self._root_dir logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.log >>> subjects) logs/exceptions.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.log >>> self.gen.throw(type, value, traceback) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.log >>> logs/exceptions.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.log >>> logs/exceptions.log --- generated xml file: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest/tests.python.pants_test.base.exception_sink_integration/junitxml/TEST-tests.python.pants_test.base.exception_sink_integration.xml ============ slowest 3 test durations ============ 93.67s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt 6.08s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 5.55s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream 1 failed, 5 passed, 1 skipped in 118.85 seconds =
AssertionError
def _maybe_run_v2(self): # N.B. For daemon runs, @console_rules are invoked pre-fork - # so this path only serves the non-daemon run mode. if self._is_daemon or not self._global_options.v2: return PANTS_SUCCEEDED_EXIT_CODE # If we're a pure --v2 run, validate goals - otherwise some goals specified # may be provided by the --v1 task paths. if not self._global_options.v1: self._graph_session.validate_goals(self._options.goals_and_possible_v2_goals) try: self._graph_session.run_console_rules( self._options_bootstrapper, self._options.goals_and_possible_v2_goals, self._target_roots, ) except GracefulTerminationException as e: logger.debug("Encountered graceful termination exception {}; exiting".format(e)) return e.exit_code except Exception as e: logger.warn( "Encountered unhandled exception {} during rule execution!".format(e) ) return PANTS_FAILED_EXIT_CODE else: return PANTS_SUCCEEDED_EXIT_CODE
def _maybe_run_v2(self): # N.B. For daemon runs, @console_rules are invoked pre-fork - # so this path only serves the non-daemon run mode. if self._is_daemon or not self._global_options.v2: return 0 # If we're a pure --v2 run, validate goals - otherwise some goals specified # may be provided by the --v1 task paths. if not self._global_options.v1: self._graph_session.validate_goals(self._options.goals_and_possible_v2_goals) try: self._graph_session.run_console_rules( self._options_bootstrapper, self._options.goals_and_possible_v2_goals, self._target_roots, ) except GracefulTerminationException as e: logger.debug("Encountered graceful termination exception {}; exiting".format(e)) return e.exit_code except Exception as e: logger.warn( "Encountered unhandled exception {} during rule execution!".format(e) ) return 1 else: return 0
https://github.com/pantsbuild/pants/issues/6847
23:26:42 01:10 [run] ============== test session starts =============== platform darwin -- Python 2.7.10, pytest-3.6.4, py-1.7.0, pluggy-0.7.1 -- /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python cachedir: .pants.d/.pytest_cache rootdir: /Users/travis/build/pantsbuild/pants/.pants.d, inifile: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest-prep/CPython-2.7.10/e241a5f8b7de6d34689cc9307d8d06eb155c7c78/pytest.ini plugins: timeout-1.2.1, cov-2.4.0 collecting ... collected 7 items tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_logs_on_terminate <- ../../../../../../System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/case.py SKIPPED [ 14%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 28%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_keyboardinterrupt_signals <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py FAILED [ 42%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_logs_unhandled_exception <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 57%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 71%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_exiter <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 85%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [100%] ==================== FAILURES ==================== ExceptionSinkIntegrationTest.test_keyboardinterrupt_signals self = <pants_test.base.test_exception_sink_integration.ExceptionSinkIntegrationTest testMethod=test_keyboardinterrupt_signals> def test_keyboardinterrupt_signals(self): for interrupt_signal in [signal.SIGINT, signal.SIGQUIT]: with self._send_signal_to_waiter_handle(interrupt_signal) as (workdir, waiter_run): > self.assertIn('Interrupted by user.\n', waiter_run.stderr_data) E AssertionError: u'Interrupted by user.\n' not found in u'From cffi callback <function extern_clone_val at 0x11098a938>:\nTraceback (most recent call last):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/native.py", line 427, in extern_clone_val\n @ffi.def_extern()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/base/exception_sink.py", line 351, in handle_signal_gracefully\n raise KeyboardInterrupt(\'User interrupted execution with control-c!\')\nKeyboardInterrupt: User interrupted execution with control-c!\ntimestamp: 2018-11-29T23:28:22.606384\nException caught: (pants.build_graph.address_lookup_error.AddressLookupError)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module>\n main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main\n PantsLoader.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run\n cls.load_and_execute(entrypoint)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute\n entrypoint_main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main\n PantsRunner(exiter, start_time=start_time).run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run\n return runner.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run\n self._run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run\n goal_runner_result = self._maybe_run_v1(run_tracker, reporting)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1\n return goal_runner_factory.create().run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create\n goals, context = self._setup_context()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context\n self._root_dir\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph\n for _ in graph.inject_roots_closure(target_roots):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure\n for address in self._inject_specs(target_roots.specs):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs\n subjects)\n File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__\n self.gen.throw(type, value, traceback)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context\n \'Build graph construction failed: {} {}\'.format(type(e).__name__, str(e))\n\nException message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer\n\n\n' .pants.d/pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py:151: AssertionError -------------- Captured stdout call -------------- logs/exceptions.84142.log +++ logs/exceptions.84142.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.84142.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.84142.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.84142.log >>> pid: 84142 logs/exceptions.84142.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.84142.log >>> main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.84142.log >>> PantsLoader.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.84142.log >>> cls.load_and_execute(entrypoint) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.84142.log >>> entrypoint_main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.84142.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.84142.log >>> return runner.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.84142.log >>> self._run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.84142.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.84142.log >>> return goal_runner_factory.create().run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.84142.log >>> goals, context = self._setup_context() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.84142.log >>> self._root_dir logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.84142.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.84142.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.84142.log >>> subjects) logs/exceptions.84142.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.84142.log >>> self.gen.throw(type, value, traceback) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.84142.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.84142.log >>> logs/exceptions.84142.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.84142.log >>> logs/exceptions.84142.log --- logs/exceptions.log +++ logs/exceptions.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.log >>> pid: 84142 logs/exceptions.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.log >>> main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.log >>> PantsLoader.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.log >>> cls.load_and_execute(entrypoint) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.log >>> entrypoint_main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.log >>> return runner.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.log >>> self._run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.log >>> return goal_runner_factory.create().run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.log >>> goals, context = self._setup_context() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.log >>> self._root_dir logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.log >>> subjects) logs/exceptions.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.log >>> self.gen.throw(type, value, traceback) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.log >>> logs/exceptions.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.log >>> logs/exceptions.log --- generated xml file: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest/tests.python.pants_test.base.exception_sink_integration/junitxml/TEST-tests.python.pants_test.base.exception_sink_integration.xml ============ slowest 3 test durations ============ 93.67s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt 6.08s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 5.55s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream 1 failed, 5 passed, 1 skipped in 118.85 seconds =
AssertionError
def _run(self): try: engine_result = self._maybe_run_v2() goal_runner_result = self._maybe_run_v1() finally: try: run_tracker_result = self._run_tracker.end() except ValueError as e: # Calling .end() sometimes writes to a closed file, so we return a dummy result here. logger.exception(e) run_tracker_result = PANTS_SUCCEEDED_EXIT_CODE final_exit_code = self._compute_final_exit_code( engine_result, goal_runner_result, run_tracker_result ) self._exiter.exit(final_exit_code)
def _run(self): # Launch RunTracker as early as possible (just after Subsystem options are initialized). run_tracker = RunTracker.global_instance() reporting = Reporting.global_instance() reporting.initialize(run_tracker, self._options, self._run_start_time) try: # Capture a repro of the 'before' state for this build, if needed. repro = Reproducer.global_instance().create_repro() if repro: repro.capture(run_tracker.run_info.get_as_dict()) engine_result = self._maybe_run_v2() goal_runner_result = self._maybe_run_v1(run_tracker, reporting) if repro: # TODO: Have Repro capture the 'after' state (as a diff) as well? repro.log_location_of_repro_file() finally: run_tracker_result = run_tracker.end() final_exit_code = self._compute_final_exit_code( engine_result, goal_runner_result, run_tracker_result ) self._exiter.exit(final_exit_code)
https://github.com/pantsbuild/pants/issues/6847
23:26:42 01:10 [run] ============== test session starts =============== platform darwin -- Python 2.7.10, pytest-3.6.4, py-1.7.0, pluggy-0.7.1 -- /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python cachedir: .pants.d/.pytest_cache rootdir: /Users/travis/build/pantsbuild/pants/.pants.d, inifile: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest-prep/CPython-2.7.10/e241a5f8b7de6d34689cc9307d8d06eb155c7c78/pytest.ini plugins: timeout-1.2.1, cov-2.4.0 collecting ... collected 7 items tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_logs_on_terminate <- ../../../../../../System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/case.py SKIPPED [ 14%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 28%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_keyboardinterrupt_signals <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py FAILED [ 42%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_logs_unhandled_exception <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 57%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 71%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_exiter <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 85%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [100%] ==================== FAILURES ==================== ExceptionSinkIntegrationTest.test_keyboardinterrupt_signals self = <pants_test.base.test_exception_sink_integration.ExceptionSinkIntegrationTest testMethod=test_keyboardinterrupt_signals> def test_keyboardinterrupt_signals(self): for interrupt_signal in [signal.SIGINT, signal.SIGQUIT]: with self._send_signal_to_waiter_handle(interrupt_signal) as (workdir, waiter_run): > self.assertIn('Interrupted by user.\n', waiter_run.stderr_data) E AssertionError: u'Interrupted by user.\n' not found in u'From cffi callback <function extern_clone_val at 0x11098a938>:\nTraceback (most recent call last):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/native.py", line 427, in extern_clone_val\n @ffi.def_extern()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/base/exception_sink.py", line 351, in handle_signal_gracefully\n raise KeyboardInterrupt(\'User interrupted execution with control-c!\')\nKeyboardInterrupt: User interrupted execution with control-c!\ntimestamp: 2018-11-29T23:28:22.606384\nException caught: (pants.build_graph.address_lookup_error.AddressLookupError)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module>\n main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main\n PantsLoader.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run\n cls.load_and_execute(entrypoint)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute\n entrypoint_main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main\n PantsRunner(exiter, start_time=start_time).run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run\n return runner.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run\n self._run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run\n goal_runner_result = self._maybe_run_v1(run_tracker, reporting)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1\n return goal_runner_factory.create().run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create\n goals, context = self._setup_context()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context\n self._root_dir\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph\n for _ in graph.inject_roots_closure(target_roots):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure\n for address in self._inject_specs(target_roots.specs):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs\n subjects)\n File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__\n self.gen.throw(type, value, traceback)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context\n \'Build graph construction failed: {} {}\'.format(type(e).__name__, str(e))\n\nException message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer\n\n\n' .pants.d/pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py:151: AssertionError -------------- Captured stdout call -------------- logs/exceptions.84142.log +++ logs/exceptions.84142.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.84142.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.84142.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.84142.log >>> pid: 84142 logs/exceptions.84142.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.84142.log >>> main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.84142.log >>> PantsLoader.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.84142.log >>> cls.load_and_execute(entrypoint) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.84142.log >>> entrypoint_main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.84142.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.84142.log >>> return runner.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.84142.log >>> self._run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.84142.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.84142.log >>> return goal_runner_factory.create().run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.84142.log >>> goals, context = self._setup_context() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.84142.log >>> self._root_dir logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.84142.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.84142.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.84142.log >>> subjects) logs/exceptions.84142.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.84142.log >>> self.gen.throw(type, value, traceback) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.84142.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.84142.log >>> logs/exceptions.84142.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.84142.log >>> logs/exceptions.84142.log --- logs/exceptions.log +++ logs/exceptions.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.log >>> pid: 84142 logs/exceptions.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.log >>> main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.log >>> PantsLoader.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.log >>> cls.load_and_execute(entrypoint) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.log >>> entrypoint_main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.log >>> return runner.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.log >>> self._run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.log >>> return goal_runner_factory.create().run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.log >>> goals, context = self._setup_context() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.log >>> self._root_dir logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.log >>> subjects) logs/exceptions.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.log >>> self.gen.throw(type, value, traceback) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.log >>> logs/exceptions.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.log >>> logs/exceptions.log --- generated xml file: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest/tests.python.pants_test.base.exception_sink_integration/junitxml/TEST-tests.python.pants_test.base.exception_sink_integration.xml ============ slowest 3 test durations ============ 93.67s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt 6.08s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 5.55s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream 1 failed, 5 passed, 1 skipped in 118.85 seconds =
AssertionError
def main(): start_time = time.time() exiter = Exiter() ExceptionSink.reset_exiter(exiter) with maybe_profiled(os.environ.get("PANTSC_PROFILE")): try: PantsRunner(exiter, start_time=start_time).run() except KeyboardInterrupt as e: exiter.exit_and_fail("Interrupted by user:\n{}".format(e))
def main(): start_time = time.time() exiter = Exiter() ExceptionSink.reset_exiter(exiter) with maybe_profiled(os.environ.get("PANTSC_PROFILE")): try: PantsRunner(exiter, start_time=start_time).run() except KeyboardInterrupt: exiter.exit_and_fail("Interrupted by user.")
https://github.com/pantsbuild/pants/issues/6847
23:26:42 01:10 [run] ============== test session starts =============== platform darwin -- Python 2.7.10, pytest-3.6.4, py-1.7.0, pluggy-0.7.1 -- /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python cachedir: .pants.d/.pytest_cache rootdir: /Users/travis/build/pantsbuild/pants/.pants.d, inifile: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest-prep/CPython-2.7.10/e241a5f8b7de6d34689cc9307d8d06eb155c7c78/pytest.ini plugins: timeout-1.2.1, cov-2.4.0 collecting ... collected 7 items tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_logs_on_terminate <- ../../../../../../System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/case.py SKIPPED [ 14%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 28%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_keyboardinterrupt_signals <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py FAILED [ 42%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_logs_unhandled_exception <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 57%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 71%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_exiter <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 85%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [100%] ==================== FAILURES ==================== ExceptionSinkIntegrationTest.test_keyboardinterrupt_signals self = <pants_test.base.test_exception_sink_integration.ExceptionSinkIntegrationTest testMethod=test_keyboardinterrupt_signals> def test_keyboardinterrupt_signals(self): for interrupt_signal in [signal.SIGINT, signal.SIGQUIT]: with self._send_signal_to_waiter_handle(interrupt_signal) as (workdir, waiter_run): > self.assertIn('Interrupted by user.\n', waiter_run.stderr_data) E AssertionError: u'Interrupted by user.\n' not found in u'From cffi callback <function extern_clone_val at 0x11098a938>:\nTraceback (most recent call last):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/native.py", line 427, in extern_clone_val\n @ffi.def_extern()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/base/exception_sink.py", line 351, in handle_signal_gracefully\n raise KeyboardInterrupt(\'User interrupted execution with control-c!\')\nKeyboardInterrupt: User interrupted execution with control-c!\ntimestamp: 2018-11-29T23:28:22.606384\nException caught: (pants.build_graph.address_lookup_error.AddressLookupError)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module>\n main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main\n PantsLoader.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run\n cls.load_and_execute(entrypoint)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute\n entrypoint_main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main\n PantsRunner(exiter, start_time=start_time).run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run\n return runner.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run\n self._run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run\n goal_runner_result = self._maybe_run_v1(run_tracker, reporting)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1\n return goal_runner_factory.create().run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create\n goals, context = self._setup_context()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context\n self._root_dir\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph\n for _ in graph.inject_roots_closure(target_roots):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure\n for address in self._inject_specs(target_roots.specs):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs\n subjects)\n File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__\n self.gen.throw(type, value, traceback)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context\n \'Build graph construction failed: {} {}\'.format(type(e).__name__, str(e))\n\nException message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer\n\n\n' .pants.d/pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py:151: AssertionError -------------- Captured stdout call -------------- logs/exceptions.84142.log +++ logs/exceptions.84142.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.84142.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.84142.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.84142.log >>> pid: 84142 logs/exceptions.84142.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.84142.log >>> main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.84142.log >>> PantsLoader.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.84142.log >>> cls.load_and_execute(entrypoint) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.84142.log >>> entrypoint_main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.84142.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.84142.log >>> return runner.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.84142.log >>> self._run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.84142.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.84142.log >>> return goal_runner_factory.create().run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.84142.log >>> goals, context = self._setup_context() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.84142.log >>> self._root_dir logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.84142.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.84142.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.84142.log >>> subjects) logs/exceptions.84142.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.84142.log >>> self.gen.throw(type, value, traceback) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.84142.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.84142.log >>> logs/exceptions.84142.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.84142.log >>> logs/exceptions.84142.log --- logs/exceptions.log +++ logs/exceptions.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.log >>> pid: 84142 logs/exceptions.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.log >>> main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.log >>> PantsLoader.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.log >>> cls.load_and_execute(entrypoint) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.log >>> entrypoint_main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.log >>> return runner.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.log >>> self._run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.log >>> return goal_runner_factory.create().run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.log >>> goals, context = self._setup_context() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.log >>> self._root_dir logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.log >>> subjects) logs/exceptions.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.log >>> self.gen.throw(type, value, traceback) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.log >>> logs/exceptions.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.log >>> logs/exceptions.log --- generated xml file: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest/tests.python.pants_test.base.exception_sink_integration/junitxml/TEST-tests.python.pants_test.base.exception_sink_integration.xml ============ slowest 3 test durations ============ 93.67s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt 6.08s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 5.55s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream 1 failed, 5 passed, 1 skipped in 118.85 seconds =
AssertionError
def _trapped_signals(self, client): """A contextmanager that handles SIGINT (control-c) and SIGQUIT (control-\\) remotely.""" signal_handler = PailgunClientSignalHandler( client, timeout=self._bootstrap_options.for_global_scope().pantsd_pailgun_quit_timeout, ) with ExceptionSink.trapped_signals(signal_handler): yield
def _trapped_signals(self, client): """A contextmanager that overrides the SIGINT (control-c) and SIGQUIT (control-\\) handlers and handles them remotely.""" def handle_control_c(signum, frame): client.maybe_send_signal(signum, include_pgrp=True) existing_sigint_handler = signal.signal(signal.SIGINT, handle_control_c) # N.B. SIGQUIT will abruptly kill the pantsd-runner, which will shut down the other end # of the Pailgun connection - so we send a gentler SIGINT here instead. existing_sigquit_handler = signal.signal(signal.SIGQUIT, handle_control_c) # Retry interrupted system calls. signal.siginterrupt(signal.SIGINT, False) signal.siginterrupt(signal.SIGQUIT, False) try: yield finally: signal.signal(signal.SIGINT, existing_sigint_handler) signal.signal(signal.SIGQUIT, existing_sigquit_handler)
https://github.com/pantsbuild/pants/issues/6847
23:26:42 01:10 [run] ============== test session starts =============== platform darwin -- Python 2.7.10, pytest-3.6.4, py-1.7.0, pluggy-0.7.1 -- /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python cachedir: .pants.d/.pytest_cache rootdir: /Users/travis/build/pantsbuild/pants/.pants.d, inifile: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest-prep/CPython-2.7.10/e241a5f8b7de6d34689cc9307d8d06eb155c7c78/pytest.ini plugins: timeout-1.2.1, cov-2.4.0 collecting ... collected 7 items tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_logs_on_terminate <- ../../../../../../System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/case.py SKIPPED [ 14%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 28%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_keyboardinterrupt_signals <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py FAILED [ 42%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_logs_unhandled_exception <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 57%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 71%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_exiter <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 85%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [100%] ==================== FAILURES ==================== ExceptionSinkIntegrationTest.test_keyboardinterrupt_signals self = <pants_test.base.test_exception_sink_integration.ExceptionSinkIntegrationTest testMethod=test_keyboardinterrupt_signals> def test_keyboardinterrupt_signals(self): for interrupt_signal in [signal.SIGINT, signal.SIGQUIT]: with self._send_signal_to_waiter_handle(interrupt_signal) as (workdir, waiter_run): > self.assertIn('Interrupted by user.\n', waiter_run.stderr_data) E AssertionError: u'Interrupted by user.\n' not found in u'From cffi callback <function extern_clone_val at 0x11098a938>:\nTraceback (most recent call last):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/native.py", line 427, in extern_clone_val\n @ffi.def_extern()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/base/exception_sink.py", line 351, in handle_signal_gracefully\n raise KeyboardInterrupt(\'User interrupted execution with control-c!\')\nKeyboardInterrupt: User interrupted execution with control-c!\ntimestamp: 2018-11-29T23:28:22.606384\nException caught: (pants.build_graph.address_lookup_error.AddressLookupError)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module>\n main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main\n PantsLoader.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run\n cls.load_and_execute(entrypoint)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute\n entrypoint_main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main\n PantsRunner(exiter, start_time=start_time).run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run\n return runner.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run\n self._run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run\n goal_runner_result = self._maybe_run_v1(run_tracker, reporting)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1\n return goal_runner_factory.create().run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create\n goals, context = self._setup_context()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context\n self._root_dir\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph\n for _ in graph.inject_roots_closure(target_roots):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure\n for address in self._inject_specs(target_roots.specs):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs\n subjects)\n File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__\n self.gen.throw(type, value, traceback)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context\n \'Build graph construction failed: {} {}\'.format(type(e).__name__, str(e))\n\nException message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer\n\n\n' .pants.d/pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py:151: AssertionError -------------- Captured stdout call -------------- logs/exceptions.84142.log +++ logs/exceptions.84142.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.84142.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.84142.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.84142.log >>> pid: 84142 logs/exceptions.84142.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.84142.log >>> main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.84142.log >>> PantsLoader.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.84142.log >>> cls.load_and_execute(entrypoint) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.84142.log >>> entrypoint_main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.84142.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.84142.log >>> return runner.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.84142.log >>> self._run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.84142.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.84142.log >>> return goal_runner_factory.create().run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.84142.log >>> goals, context = self._setup_context() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.84142.log >>> self._root_dir logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.84142.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.84142.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.84142.log >>> subjects) logs/exceptions.84142.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.84142.log >>> self.gen.throw(type, value, traceback) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.84142.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.84142.log >>> logs/exceptions.84142.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.84142.log >>> logs/exceptions.84142.log --- logs/exceptions.log +++ logs/exceptions.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.log >>> pid: 84142 logs/exceptions.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.log >>> main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.log >>> PantsLoader.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.log >>> cls.load_and_execute(entrypoint) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.log >>> entrypoint_main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.log >>> return runner.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.log >>> self._run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.log >>> return goal_runner_factory.create().run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.log >>> goals, context = self._setup_context() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.log >>> self._root_dir logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.log >>> subjects) logs/exceptions.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.log >>> self.gen.throw(type, value, traceback) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.log >>> logs/exceptions.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.log >>> logs/exceptions.log --- generated xml file: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest/tests.python.pants_test.base.exception_sink_integration/junitxml/TEST-tests.python.pants_test.base.exception_sink_integration.xml ============ slowest 3 test durations ============ 93.67s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt 6.08s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 5.55s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream 1 failed, 5 passed, 1 skipped in 118.85 seconds =
AssertionError
def _run_pants_with_retry(self, pantsd_handle, retries=3): """Runs pants remotely with retry and recovery for nascent executions. :param PantsDaemon.Handle pantsd_handle: A Handle for the daemon to connect to. """ attempt = 1 while 1: logger.debug( "connecting to pantsd on port {} (attempt {}/{})".format( pantsd_handle.port, attempt, retries ) ) try: return self._connect_and_execute(pantsd_handle) except self.RECOVERABLE_EXCEPTIONS as e: if attempt > retries: raise self.Fallback(e) self._backoff(attempt) logger.warn( "pantsd was unresponsive on port {}, retrying ({}/{})".format( pantsd_handle.port, attempt, retries ) ) # One possible cause of the daemon being non-responsive during an attempt might be if a # another lifecycle operation is happening concurrently (incl teardown). To account for # this, we won't begin attempting restarts until at least 1 second has passed (1 attempt). if attempt > 1: pantsd_handle = self._restart_pantsd() attempt += 1 except NailgunClient.NailgunError as e: # Ensure a newline. logger.fatal("") logger.fatal("lost active connection to pantsd!") raise_with_traceback(self._extract_remote_exception(pantsd_handle.pid, e))
def _run_pants_with_retry(self, pantsd_handle, retries=3): """Runs pants remotely with retry and recovery for nascent executions. :param PantsDaemon.Handle pantsd_handle: A Handle for the daemon to connect to. """ attempt = 1 while 1: logger.debug( "connecting to pantsd on port {} (attempt {}/{})".format( pantsd_handle.port, attempt, retries ) ) try: return self._connect_and_execute(pantsd_handle.port) except self.RECOVERABLE_EXCEPTIONS as e: if attempt > retries: raise self.Fallback(e) self._backoff(attempt) logger.warn( "pantsd was unresponsive on port {}, retrying ({}/{})".format( pantsd_handle.port, attempt, retries ) ) # One possible cause of the daemon being non-responsive during an attempt might be if a # another lifecycle operation is happening concurrently (incl teardown). To account for # this, we won't begin attempting restarts until at least 1 second has passed (1 attempt). if attempt > 1: pantsd_handle = self._restart_pantsd() attempt += 1 except NailgunClient.NailgunError as e: # Ensure a newline. logger.fatal("") logger.fatal("lost active connection to pantsd!") raise_with_traceback(self._extract_remote_exception(pantsd_handle.pid, e))
https://github.com/pantsbuild/pants/issues/6847
23:26:42 01:10 [run] ============== test session starts =============== platform darwin -- Python 2.7.10, pytest-3.6.4, py-1.7.0, pluggy-0.7.1 -- /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python cachedir: .pants.d/.pytest_cache rootdir: /Users/travis/build/pantsbuild/pants/.pants.d, inifile: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest-prep/CPython-2.7.10/e241a5f8b7de6d34689cc9307d8d06eb155c7c78/pytest.ini plugins: timeout-1.2.1, cov-2.4.0 collecting ... collected 7 items tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_logs_on_terminate <- ../../../../../../System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/case.py SKIPPED [ 14%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 28%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_keyboardinterrupt_signals <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py FAILED [ 42%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_logs_unhandled_exception <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 57%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 71%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_exiter <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 85%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [100%] ==================== FAILURES ==================== ExceptionSinkIntegrationTest.test_keyboardinterrupt_signals self = <pants_test.base.test_exception_sink_integration.ExceptionSinkIntegrationTest testMethod=test_keyboardinterrupt_signals> def test_keyboardinterrupt_signals(self): for interrupt_signal in [signal.SIGINT, signal.SIGQUIT]: with self._send_signal_to_waiter_handle(interrupt_signal) as (workdir, waiter_run): > self.assertIn('Interrupted by user.\n', waiter_run.stderr_data) E AssertionError: u'Interrupted by user.\n' not found in u'From cffi callback <function extern_clone_val at 0x11098a938>:\nTraceback (most recent call last):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/native.py", line 427, in extern_clone_val\n @ffi.def_extern()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/base/exception_sink.py", line 351, in handle_signal_gracefully\n raise KeyboardInterrupt(\'User interrupted execution with control-c!\')\nKeyboardInterrupt: User interrupted execution with control-c!\ntimestamp: 2018-11-29T23:28:22.606384\nException caught: (pants.build_graph.address_lookup_error.AddressLookupError)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module>\n main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main\n PantsLoader.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run\n cls.load_and_execute(entrypoint)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute\n entrypoint_main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main\n PantsRunner(exiter, start_time=start_time).run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run\n return runner.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run\n self._run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run\n goal_runner_result = self._maybe_run_v1(run_tracker, reporting)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1\n return goal_runner_factory.create().run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create\n goals, context = self._setup_context()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context\n self._root_dir\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph\n for _ in graph.inject_roots_closure(target_roots):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure\n for address in self._inject_specs(target_roots.specs):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs\n subjects)\n File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__\n self.gen.throw(type, value, traceback)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context\n \'Build graph construction failed: {} {}\'.format(type(e).__name__, str(e))\n\nException message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer\n\n\n' .pants.d/pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py:151: AssertionError -------------- Captured stdout call -------------- logs/exceptions.84142.log +++ logs/exceptions.84142.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.84142.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.84142.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.84142.log >>> pid: 84142 logs/exceptions.84142.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.84142.log >>> main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.84142.log >>> PantsLoader.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.84142.log >>> cls.load_and_execute(entrypoint) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.84142.log >>> entrypoint_main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.84142.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.84142.log >>> return runner.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.84142.log >>> self._run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.84142.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.84142.log >>> return goal_runner_factory.create().run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.84142.log >>> goals, context = self._setup_context() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.84142.log >>> self._root_dir logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.84142.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.84142.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.84142.log >>> subjects) logs/exceptions.84142.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.84142.log >>> self.gen.throw(type, value, traceback) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.84142.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.84142.log >>> logs/exceptions.84142.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.84142.log >>> logs/exceptions.84142.log --- logs/exceptions.log +++ logs/exceptions.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.log >>> pid: 84142 logs/exceptions.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.log >>> main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.log >>> PantsLoader.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.log >>> cls.load_and_execute(entrypoint) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.log >>> entrypoint_main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.log >>> return runner.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.log >>> self._run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.log >>> return goal_runner_factory.create().run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.log >>> goals, context = self._setup_context() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.log >>> self._root_dir logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.log >>> subjects) logs/exceptions.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.log >>> self.gen.throw(type, value, traceback) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.log >>> logs/exceptions.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.log >>> logs/exceptions.log --- generated xml file: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest/tests.python.pants_test.base.exception_sink_integration/junitxml/TEST-tests.python.pants_test.base.exception_sink_integration.xml ============ slowest 3 test durations ============ 93.67s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt 6.08s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 5.55s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream 1 failed, 5 passed, 1 skipped in 118.85 seconds =
AssertionError
def _connect_and_execute(self, pantsd_handle): port = pantsd_handle.port # Merge the nailgun TTY capability environment variables with the passed environment dict. ng_env = NailgunProtocol.isatty_to_env(self._stdin, self._stdout, self._stderr) modified_env = combined_dict(self._env, ng_env) modified_env["PANTSD_RUNTRACKER_CLIENT_START_TIME"] = str(self._start_time) assert isinstance(port, int), "port {} is not an integer!".format(port) # Instantiate a NailgunClient. client = NailgunClient( port=port, ins=self._stdin, out=self._stdout, err=self._stderr, exit_on_broken_pipe=True, metadata_base_dir=pantsd_handle.metadata_base_dir, ) with self._trapped_signals(client), STTYSettings.preserved(): # Execute the command on the pailgun. result = client.execute(self.PANTS_COMMAND, *self._args, **modified_env) # Exit. self._exiter.exit(result)
def _connect_and_execute(self, port): # Merge the nailgun TTY capability environment variables with the passed environment dict. ng_env = NailgunProtocol.isatty_to_env(self._stdin, self._stdout, self._stderr) modified_env = combined_dict(self._env, ng_env) modified_env["PANTSD_RUNTRACKER_CLIENT_START_TIME"] = str(self._start_time) assert isinstance(port, int), "port {} is not an integer!".format(port) # Instantiate a NailgunClient. client = NailgunClient( port=port, ins=self._stdin, out=self._stdout, err=self._stderr, exit_on_broken_pipe=True, expects_pid=True, ) with self._trapped_signals(client), STTYSettings.preserved(): # Execute the command on the pailgun. result = client.execute(self.PANTS_COMMAND, *self._args, **modified_env) # Exit. self._exiter.exit(result)
https://github.com/pantsbuild/pants/issues/6847
23:26:42 01:10 [run] ============== test session starts =============== platform darwin -- Python 2.7.10, pytest-3.6.4, py-1.7.0, pluggy-0.7.1 -- /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python cachedir: .pants.d/.pytest_cache rootdir: /Users/travis/build/pantsbuild/pants/.pants.d, inifile: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest-prep/CPython-2.7.10/e241a5f8b7de6d34689cc9307d8d06eb155c7c78/pytest.ini plugins: timeout-1.2.1, cov-2.4.0 collecting ... collected 7 items tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_logs_on_terminate <- ../../../../../../System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/case.py SKIPPED [ 14%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 28%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_keyboardinterrupt_signals <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py FAILED [ 42%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_logs_unhandled_exception <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 57%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 71%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_exiter <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 85%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [100%] ==================== FAILURES ==================== ExceptionSinkIntegrationTest.test_keyboardinterrupt_signals self = <pants_test.base.test_exception_sink_integration.ExceptionSinkIntegrationTest testMethod=test_keyboardinterrupt_signals> def test_keyboardinterrupt_signals(self): for interrupt_signal in [signal.SIGINT, signal.SIGQUIT]: with self._send_signal_to_waiter_handle(interrupt_signal) as (workdir, waiter_run): > self.assertIn('Interrupted by user.\n', waiter_run.stderr_data) E AssertionError: u'Interrupted by user.\n' not found in u'From cffi callback <function extern_clone_val at 0x11098a938>:\nTraceback (most recent call last):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/native.py", line 427, in extern_clone_val\n @ffi.def_extern()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/base/exception_sink.py", line 351, in handle_signal_gracefully\n raise KeyboardInterrupt(\'User interrupted execution with control-c!\')\nKeyboardInterrupt: User interrupted execution with control-c!\ntimestamp: 2018-11-29T23:28:22.606384\nException caught: (pants.build_graph.address_lookup_error.AddressLookupError)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module>\n main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main\n PantsLoader.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run\n cls.load_and_execute(entrypoint)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute\n entrypoint_main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main\n PantsRunner(exiter, start_time=start_time).run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run\n return runner.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run\n self._run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run\n goal_runner_result = self._maybe_run_v1(run_tracker, reporting)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1\n return goal_runner_factory.create().run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create\n goals, context = self._setup_context()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context\n self._root_dir\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph\n for _ in graph.inject_roots_closure(target_roots):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure\n for address in self._inject_specs(target_roots.specs):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs\n subjects)\n File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__\n self.gen.throw(type, value, traceback)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context\n \'Build graph construction failed: {} {}\'.format(type(e).__name__, str(e))\n\nException message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer\n\n\n' .pants.d/pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py:151: AssertionError -------------- Captured stdout call -------------- logs/exceptions.84142.log +++ logs/exceptions.84142.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.84142.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.84142.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.84142.log >>> pid: 84142 logs/exceptions.84142.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.84142.log >>> main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.84142.log >>> PantsLoader.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.84142.log >>> cls.load_and_execute(entrypoint) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.84142.log >>> entrypoint_main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.84142.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.84142.log >>> return runner.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.84142.log >>> self._run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.84142.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.84142.log >>> return goal_runner_factory.create().run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.84142.log >>> goals, context = self._setup_context() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.84142.log >>> self._root_dir logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.84142.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.84142.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.84142.log >>> subjects) logs/exceptions.84142.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.84142.log >>> self.gen.throw(type, value, traceback) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.84142.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.84142.log >>> logs/exceptions.84142.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.84142.log >>> logs/exceptions.84142.log --- logs/exceptions.log +++ logs/exceptions.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.log >>> pid: 84142 logs/exceptions.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.log >>> main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.log >>> PantsLoader.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.log >>> cls.load_and_execute(entrypoint) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.log >>> entrypoint_main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.log >>> return runner.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.log >>> self._run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.log >>> return goal_runner_factory.create().run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.log >>> goals, context = self._setup_context() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.log >>> self._root_dir logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.log >>> subjects) logs/exceptions.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.log >>> self.gen.throw(type, value, traceback) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.log >>> logs/exceptions.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.log >>> logs/exceptions.log --- generated xml file: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest/tests.python.pants_test.base.exception_sink_integration/junitxml/TEST-tests.python.pants_test.base.exception_sink_integration.xml ============ slowest 3 test durations ============ 93.67s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt 6.08s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 5.55s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream 1 failed, 5 passed, 1 skipped in 118.85 seconds =
AssertionError
def __init__(self, *args, **kwargs): """ :API: public """ super(RunTracker, self).__init__(*args, **kwargs) self._run_timestamp = time.time() self._cmd_line = " ".join(["pants"] + sys.argv[1:]) self._sorted_goal_infos = tuple() # Initialized in `initialize()`. self.run_info_dir = None self.run_info = None self.cumulative_timings = None self.self_timings = None self.artifact_cache_stats = None self.pantsd_stats = None # Initialized in `start()`. self.report = None self._main_root_workunit = None self._all_options = None # A lock to ensure that adding to stats at the end of a workunit # operates thread-safely. self._stats_lock = threading.Lock() # Log of success/failure/aborted for each workunit. self.outcomes = {} # Number of threads for foreground work. self._num_foreground_workers = self.get_options().num_foreground_workers # Number of threads for background work. self._num_background_workers = self.get_options().num_background_workers # self._threadlocal.current_workunit contains the current workunit for the calling thread. # Note that multiple threads may share a name (e.g., all the threads in a pool). self._threadlocal = threading.local() # A logger facade that logs into this RunTracker. self._logger = RunTrackerLogger(self) # For background work. Created lazily if needed. self._background_worker_pool = None self._background_root_workunit = None # Trigger subproc pool init while our memory image is still clean (see SubprocPool docstring). SubprocPool.set_num_processes(self._num_foreground_workers) SubprocPool.foreground() self._aborted = False # Data will be organized first by target and then scope. # Eg: # { # 'target/address:name': { # 'running_scope': { # 'run_duration': 356.09 # }, # 'GLOBAL': { # 'target_type': 'pants.test' # } # } # } self._target_to_data = {} self._end_memoized_result = None
def __init__(self, *args, **kwargs): """ :API: public """ super(RunTracker, self).__init__(*args, **kwargs) self._run_timestamp = time.time() self._cmd_line = " ".join(["pants"] + sys.argv[1:]) self._sorted_goal_infos = tuple() # Initialized in `initialize()`. self.run_info_dir = None self.run_info = None self.cumulative_timings = None self.self_timings = None self.artifact_cache_stats = None self.pantsd_stats = None # Initialized in `start()`. self.report = None self._main_root_workunit = None self._all_options = None # A lock to ensure that adding to stats at the end of a workunit # operates thread-safely. self._stats_lock = threading.Lock() # Log of success/failure/aborted for each workunit. self.outcomes = {} # Number of threads for foreground work. self._num_foreground_workers = self.get_options().num_foreground_workers # Number of threads for background work. self._num_background_workers = self.get_options().num_background_workers # self._threadlocal.current_workunit contains the current workunit for the calling thread. # Note that multiple threads may share a name (e.g., all the threads in a pool). self._threadlocal = threading.local() # A logger facade that logs into this RunTracker. self._logger = RunTrackerLogger(self) # For background work. Created lazily if needed. self._background_worker_pool = None self._background_root_workunit = None # Trigger subproc pool init while our memory image is still clean (see SubprocPool docstring). SubprocPool.set_num_processes(self._num_foreground_workers) SubprocPool.foreground() self._aborted = False # Data will be organized first by target and then scope. # Eg: # { # 'target/address:name': { # 'running_scope': { # 'run_duration': 356.09 # }, # 'GLOBAL': { # 'target_type': 'pants.test' # } # } # } self._target_to_data = {}
https://github.com/pantsbuild/pants/issues/6847
23:26:42 01:10 [run] ============== test session starts =============== platform darwin -- Python 2.7.10, pytest-3.6.4, py-1.7.0, pluggy-0.7.1 -- /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python cachedir: .pants.d/.pytest_cache rootdir: /Users/travis/build/pantsbuild/pants/.pants.d, inifile: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest-prep/CPython-2.7.10/e241a5f8b7de6d34689cc9307d8d06eb155c7c78/pytest.ini plugins: timeout-1.2.1, cov-2.4.0 collecting ... collected 7 items tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_logs_on_terminate <- ../../../../../../System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/case.py SKIPPED [ 14%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 28%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_keyboardinterrupt_signals <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py FAILED [ 42%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_logs_unhandled_exception <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 57%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 71%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_exiter <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 85%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [100%] ==================== FAILURES ==================== ExceptionSinkIntegrationTest.test_keyboardinterrupt_signals self = <pants_test.base.test_exception_sink_integration.ExceptionSinkIntegrationTest testMethod=test_keyboardinterrupt_signals> def test_keyboardinterrupt_signals(self): for interrupt_signal in [signal.SIGINT, signal.SIGQUIT]: with self._send_signal_to_waiter_handle(interrupt_signal) as (workdir, waiter_run): > self.assertIn('Interrupted by user.\n', waiter_run.stderr_data) E AssertionError: u'Interrupted by user.\n' not found in u'From cffi callback <function extern_clone_val at 0x11098a938>:\nTraceback (most recent call last):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/native.py", line 427, in extern_clone_val\n @ffi.def_extern()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/base/exception_sink.py", line 351, in handle_signal_gracefully\n raise KeyboardInterrupt(\'User interrupted execution with control-c!\')\nKeyboardInterrupt: User interrupted execution with control-c!\ntimestamp: 2018-11-29T23:28:22.606384\nException caught: (pants.build_graph.address_lookup_error.AddressLookupError)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module>\n main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main\n PantsLoader.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run\n cls.load_and_execute(entrypoint)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute\n entrypoint_main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main\n PantsRunner(exiter, start_time=start_time).run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run\n return runner.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run\n self._run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run\n goal_runner_result = self._maybe_run_v1(run_tracker, reporting)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1\n return goal_runner_factory.create().run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create\n goals, context = self._setup_context()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context\n self._root_dir\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph\n for _ in graph.inject_roots_closure(target_roots):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure\n for address in self._inject_specs(target_roots.specs):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs\n subjects)\n File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__\n self.gen.throw(type, value, traceback)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context\n \'Build graph construction failed: {} {}\'.format(type(e).__name__, str(e))\n\nException message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer\n\n\n' .pants.d/pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py:151: AssertionError -------------- Captured stdout call -------------- logs/exceptions.84142.log +++ logs/exceptions.84142.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.84142.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.84142.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.84142.log >>> pid: 84142 logs/exceptions.84142.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.84142.log >>> main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.84142.log >>> PantsLoader.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.84142.log >>> cls.load_and_execute(entrypoint) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.84142.log >>> entrypoint_main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.84142.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.84142.log >>> return runner.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.84142.log >>> self._run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.84142.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.84142.log >>> return goal_runner_factory.create().run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.84142.log >>> goals, context = self._setup_context() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.84142.log >>> self._root_dir logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.84142.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.84142.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.84142.log >>> subjects) logs/exceptions.84142.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.84142.log >>> self.gen.throw(type, value, traceback) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.84142.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.84142.log >>> logs/exceptions.84142.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.84142.log >>> logs/exceptions.84142.log --- logs/exceptions.log +++ logs/exceptions.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.log >>> pid: 84142 logs/exceptions.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.log >>> main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.log >>> PantsLoader.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.log >>> cls.load_and_execute(entrypoint) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.log >>> entrypoint_main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.log >>> return runner.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.log >>> self._run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.log >>> return goal_runner_factory.create().run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.log >>> goals, context = self._setup_context() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.log >>> self._root_dir logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.log >>> subjects) logs/exceptions.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.log >>> self.gen.throw(type, value, traceback) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.log >>> logs/exceptions.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.log >>> logs/exceptions.log --- generated xml file: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest/tests.python.pants_test.base.exception_sink_integration/junitxml/TEST-tests.python.pants_test.base.exception_sink_integration.xml ============ slowest 3 test durations ============ 93.67s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt 6.08s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 5.55s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream 1 failed, 5 passed, 1 skipped in 118.85 seconds =
AssertionError
def end(self): """This pants run is over, so stop tracking it. Note: If end() has been called once, subsequent calls are no-ops. :return: PANTS_SUCCEEDED_EXIT_CODE or PANTS_FAILED_EXIT_CODE """ if self._end_memoized_result is not None: return self._end_memoized_result if self._background_worker_pool: if self._aborted: self.log(Report.INFO, "Aborting background workers.") self._background_worker_pool.abort() else: self.log(Report.INFO, "Waiting for background workers to finish.") self._background_worker_pool.shutdown() self.end_workunit(self._background_root_workunit) self.shutdown_worker_pool() # Run a dummy work unit to write out one last timestamp. with self.new_workunit("complete"): pass self.end_workunit(self._main_root_workunit) outcome = self._main_root_workunit.outcome() if self._background_root_workunit: outcome = min(outcome, self._background_root_workunit.outcome()) outcome_str = WorkUnit.outcome_string(outcome) log_level = RunTracker._log_levels[outcome] self.log(log_level, outcome_str) if self.run_info.get_info("outcome") is None: # If the goal is clean-all then the run info dir no longer exists, so ignore that error. self.run_info.add_info("outcome", outcome_str, ignore_errors=True) if self._target_to_data: self.run_info.add_info("target_data", self._target_to_data) self.report.close() self.store_stats() run_failed = outcome in [WorkUnit.FAILURE, WorkUnit.ABORTED] result = PANTS_FAILED_EXIT_CODE if run_failed else PANTS_SUCCEEDED_EXIT_CODE self._end_memoized_result = result return self._end_memoized_result
def end(self): """This pants run is over, so stop tracking it. Note: If end() has been called once, subsequent calls are no-ops. :return: 0 for success, 1 for failure. """ if self._background_worker_pool: if self._aborted: self.log(Report.INFO, "Aborting background workers.") self._background_worker_pool.abort() else: self.log(Report.INFO, "Waiting for background workers to finish.") self._background_worker_pool.shutdown() self.end_workunit(self._background_root_workunit) self.shutdown_worker_pool() # Run a dummy work unit to write out one last timestamp. with self.new_workunit("complete"): pass self.end_workunit(self._main_root_workunit) outcome = self._main_root_workunit.outcome() if self._background_root_workunit: outcome = min(outcome, self._background_root_workunit.outcome()) outcome_str = WorkUnit.outcome_string(outcome) log_level = RunTracker._log_levels[outcome] self.log(log_level, outcome_str) if self.run_info.get_info("outcome") is None: # If the goal is clean-all then the run info dir no longer exists, so ignore that error. self.run_info.add_info("outcome", outcome_str, ignore_errors=True) if self._target_to_data: self.run_info.add_info("target_data", self._target_to_data) self.report.close() self.store_stats() return 1 if outcome in [WorkUnit.FAILURE, WorkUnit.ABORTED] else 0
https://github.com/pantsbuild/pants/issues/6847
23:26:42 01:10 [run] ============== test session starts =============== platform darwin -- Python 2.7.10, pytest-3.6.4, py-1.7.0, pluggy-0.7.1 -- /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python cachedir: .pants.d/.pytest_cache rootdir: /Users/travis/build/pantsbuild/pants/.pants.d, inifile: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest-prep/CPython-2.7.10/e241a5f8b7de6d34689cc9307d8d06eb155c7c78/pytest.ini plugins: timeout-1.2.1, cov-2.4.0 collecting ... collected 7 items tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_logs_on_terminate <- ../../../../../../System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/case.py SKIPPED [ 14%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 28%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_keyboardinterrupt_signals <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py FAILED [ 42%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_logs_unhandled_exception <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 57%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 71%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_exiter <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 85%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [100%] ==================== FAILURES ==================== ExceptionSinkIntegrationTest.test_keyboardinterrupt_signals self = <pants_test.base.test_exception_sink_integration.ExceptionSinkIntegrationTest testMethod=test_keyboardinterrupt_signals> def test_keyboardinterrupt_signals(self): for interrupt_signal in [signal.SIGINT, signal.SIGQUIT]: with self._send_signal_to_waiter_handle(interrupt_signal) as (workdir, waiter_run): > self.assertIn('Interrupted by user.\n', waiter_run.stderr_data) E AssertionError: u'Interrupted by user.\n' not found in u'From cffi callback <function extern_clone_val at 0x11098a938>:\nTraceback (most recent call last):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/native.py", line 427, in extern_clone_val\n @ffi.def_extern()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/base/exception_sink.py", line 351, in handle_signal_gracefully\n raise KeyboardInterrupt(\'User interrupted execution with control-c!\')\nKeyboardInterrupt: User interrupted execution with control-c!\ntimestamp: 2018-11-29T23:28:22.606384\nException caught: (pants.build_graph.address_lookup_error.AddressLookupError)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module>\n main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main\n PantsLoader.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run\n cls.load_and_execute(entrypoint)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute\n entrypoint_main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main\n PantsRunner(exiter, start_time=start_time).run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run\n return runner.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run\n self._run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run\n goal_runner_result = self._maybe_run_v1(run_tracker, reporting)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1\n return goal_runner_factory.create().run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create\n goals, context = self._setup_context()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context\n self._root_dir\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph\n for _ in graph.inject_roots_closure(target_roots):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure\n for address in self._inject_specs(target_roots.specs):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs\n subjects)\n File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__\n self.gen.throw(type, value, traceback)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context\n \'Build graph construction failed: {} {}\'.format(type(e).__name__, str(e))\n\nException message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer\n\n\n' .pants.d/pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py:151: AssertionError -------------- Captured stdout call -------------- logs/exceptions.84142.log +++ logs/exceptions.84142.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.84142.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.84142.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.84142.log >>> pid: 84142 logs/exceptions.84142.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.84142.log >>> main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.84142.log >>> PantsLoader.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.84142.log >>> cls.load_and_execute(entrypoint) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.84142.log >>> entrypoint_main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.84142.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.84142.log >>> return runner.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.84142.log >>> self._run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.84142.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.84142.log >>> return goal_runner_factory.create().run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.84142.log >>> goals, context = self._setup_context() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.84142.log >>> self._root_dir logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.84142.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.84142.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.84142.log >>> subjects) logs/exceptions.84142.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.84142.log >>> self.gen.throw(type, value, traceback) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.84142.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.84142.log >>> logs/exceptions.84142.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.84142.log >>> logs/exceptions.84142.log --- logs/exceptions.log +++ logs/exceptions.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.log >>> pid: 84142 logs/exceptions.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.log >>> main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.log >>> PantsLoader.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.log >>> cls.load_and_execute(entrypoint) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.log >>> entrypoint_main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.log >>> return runner.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.log >>> self._run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.log >>> return goal_runner_factory.create().run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.log >>> goals, context = self._setup_context() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.log >>> self._root_dir logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.log >>> subjects) logs/exceptions.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.log >>> self.gen.throw(type, value, traceback) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.log >>> logs/exceptions.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.log >>> logs/exceptions.log --- generated xml file: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest/tests.python.pants_test.base.exception_sink_integration/junitxml/TEST-tests.python.pants_test.base.exception_sink_integration.xml ============ slowest 3 test durations ============ 93.67s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt 6.08s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 5.55s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream 1 failed, 5 passed, 1 skipped in 118.85 seconds =
AssertionError
def __init__( self, sock, in_file, out_file, err_file, exit_on_broken_pipe=False, remote_pid_callback=None, remote_pgrp_callback=None, ): """ :param bool exit_on_broken_pipe: whether or not to exit when `Broken Pipe` errors are encountered :param remote_pid_callback: Callback to run when a pid chunk is received from a remote client. :param remote_pgrp_callback: Callback to run when a pgrp (process group) chunk is received from a remote client. """ self._sock = sock self._input_writer = ( None if not in_file else NailgunStreamWriter( (in_file.fileno(),), self._sock, (ChunkType.STDIN,), ChunkType.STDIN_EOF ) ) self._stdout = out_file self._stderr = err_file self._exit_on_broken_pipe = exit_on_broken_pipe self.remote_pid = None self.remote_process_cmdline = None self.remote_pgrp = None self._remote_pid_callback = remote_pid_callback self._remote_pgrp_callback = remote_pgrp_callback # NB: These variables are set in a signal handler to implement graceful shutdown. self._exit_timeout_start_time = None self._exit_timeout = None self._exit_reason = None
def __init__( self, sock, in_file, out_file, err_file, exit_on_broken_pipe=False, remote_pid_callback=None, remote_pgrp_callback=None, ): """ :param bool exit_on_broken_pipe: whether or not to exit when `Broken Pipe` errors are encountered :param remote_pid_callback: Callback to run when a pid chunk is received from a remote client. :param remote_pgrp_callback: Callback to run when a pgrp (process group) chunk is received from a remote client. """ self._sock = sock self._input_writer = ( None if not in_file else NailgunStreamWriter( (in_file.fileno(),), self._sock, (ChunkType.STDIN,), ChunkType.STDIN_EOF ) ) self._stdout = out_file self._stderr = err_file self._exit_on_broken_pipe = exit_on_broken_pipe self.remote_pid = None self.remote_pgrp = None self._remote_pid_callback = remote_pid_callback self._remote_pgrp_callback = remote_pgrp_callback
https://github.com/pantsbuild/pants/issues/6847
23:26:42 01:10 [run] ============== test session starts =============== platform darwin -- Python 2.7.10, pytest-3.6.4, py-1.7.0, pluggy-0.7.1 -- /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python cachedir: .pants.d/.pytest_cache rootdir: /Users/travis/build/pantsbuild/pants/.pants.d, inifile: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest-prep/CPython-2.7.10/e241a5f8b7de6d34689cc9307d8d06eb155c7c78/pytest.ini plugins: timeout-1.2.1, cov-2.4.0 collecting ... collected 7 items tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_logs_on_terminate <- ../../../../../../System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/case.py SKIPPED [ 14%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 28%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_keyboardinterrupt_signals <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py FAILED [ 42%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_logs_unhandled_exception <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 57%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 71%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_exiter <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 85%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [100%] ==================== FAILURES ==================== ExceptionSinkIntegrationTest.test_keyboardinterrupt_signals self = <pants_test.base.test_exception_sink_integration.ExceptionSinkIntegrationTest testMethod=test_keyboardinterrupt_signals> def test_keyboardinterrupt_signals(self): for interrupt_signal in [signal.SIGINT, signal.SIGQUIT]: with self._send_signal_to_waiter_handle(interrupt_signal) as (workdir, waiter_run): > self.assertIn('Interrupted by user.\n', waiter_run.stderr_data) E AssertionError: u'Interrupted by user.\n' not found in u'From cffi callback <function extern_clone_val at 0x11098a938>:\nTraceback (most recent call last):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/native.py", line 427, in extern_clone_val\n @ffi.def_extern()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/base/exception_sink.py", line 351, in handle_signal_gracefully\n raise KeyboardInterrupt(\'User interrupted execution with control-c!\')\nKeyboardInterrupt: User interrupted execution with control-c!\ntimestamp: 2018-11-29T23:28:22.606384\nException caught: (pants.build_graph.address_lookup_error.AddressLookupError)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module>\n main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main\n PantsLoader.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run\n cls.load_and_execute(entrypoint)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute\n entrypoint_main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main\n PantsRunner(exiter, start_time=start_time).run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run\n return runner.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run\n self._run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run\n goal_runner_result = self._maybe_run_v1(run_tracker, reporting)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1\n return goal_runner_factory.create().run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create\n goals, context = self._setup_context()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context\n self._root_dir\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph\n for _ in graph.inject_roots_closure(target_roots):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure\n for address in self._inject_specs(target_roots.specs):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs\n subjects)\n File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__\n self.gen.throw(type, value, traceback)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context\n \'Build graph construction failed: {} {}\'.format(type(e).__name__, str(e))\n\nException message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer\n\n\n' .pants.d/pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py:151: AssertionError -------------- Captured stdout call -------------- logs/exceptions.84142.log +++ logs/exceptions.84142.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.84142.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.84142.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.84142.log >>> pid: 84142 logs/exceptions.84142.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.84142.log >>> main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.84142.log >>> PantsLoader.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.84142.log >>> cls.load_and_execute(entrypoint) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.84142.log >>> entrypoint_main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.84142.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.84142.log >>> return runner.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.84142.log >>> self._run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.84142.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.84142.log >>> return goal_runner_factory.create().run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.84142.log >>> goals, context = self._setup_context() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.84142.log >>> self._root_dir logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.84142.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.84142.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.84142.log >>> subjects) logs/exceptions.84142.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.84142.log >>> self.gen.throw(type, value, traceback) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.84142.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.84142.log >>> logs/exceptions.84142.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.84142.log >>> logs/exceptions.84142.log --- logs/exceptions.log +++ logs/exceptions.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.log >>> pid: 84142 logs/exceptions.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.log >>> main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.log >>> PantsLoader.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.log >>> cls.load_and_execute(entrypoint) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.log >>> entrypoint_main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.log >>> return runner.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.log >>> self._run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.log >>> return goal_runner_factory.create().run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.log >>> goals, context = self._setup_context() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.log >>> self._root_dir logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.log >>> subjects) logs/exceptions.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.log >>> self.gen.throw(type, value, traceback) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.log >>> logs/exceptions.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.log >>> logs/exceptions.log --- generated xml file: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest/tests.python.pants_test.base.exception_sink_integration/junitxml/TEST-tests.python.pants_test.base.exception_sink_integration.xml ============ slowest 3 test durations ============ 93.67s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt 6.08s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 5.55s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream 1 failed, 5 passed, 1 skipped in 118.85 seconds =
AssertionError
def _process_session(self): """Process the outputs of the nailgun session. :raises: :class:`NailgunProtocol.ProcessStreamTimeout` if a timeout set from a signal handler with .set_exit_timeout() completes. :raises: :class:`Exception` if the session completes before the timeout, the `reason` argument to .set_exit_timeout() will be raised.""" try: for chunk_type, payload in self.iter_chunks( self._sock, return_bytes=True, timeout_object=self ): # TODO(#6579): assert that we have at this point received all the chunk types in # ChunkType.REQUEST_TYPES, then require PID and PGRP (exactly once?), and then allow any of # ChunkType.EXECUTION_TYPES. if chunk_type == ChunkType.STDOUT: self._write_flush(self._stdout, payload) elif chunk_type == ChunkType.STDERR: self._write_flush(self._stderr, payload) elif chunk_type == ChunkType.EXIT: self._write_flush(self._stdout) self._write_flush(self._stderr) return int(payload) elif chunk_type == ChunkType.PID: self.remote_pid = int(payload) self.remote_process_cmdline = psutil.Process(self.remote_pid).cmdline() if self._remote_pid_callback: self._remote_pid_callback(self.remote_pid) elif chunk_type == ChunkType.PGRP: self.remote_pgrp = int(payload) if self._remote_pgrp_callback: self._remote_pgrp_callback(self.remote_pgrp) elif chunk_type == ChunkType.START_READING_INPUT: self._maybe_start_input_writer() else: raise self.ProtocolError( "received unexpected chunk {} -> {}".format(chunk_type, payload) ) except NailgunProtocol.ProcessStreamTimeout as e: assert self.remote_pid is not None # NB: We overwrite the process title in the pantsd-runner process, which causes it to have an # argv with lots of empty spaces for some reason. We filter those out and pretty-print the # rest here. filtered_remote_cmdline = safe_shlex_join( arg for arg in self.remote_process_cmdline if arg != "" ) logger.warning( 'timed out when attempting to gracefully shut down the remote client executing "{}". ' "sending SIGKILL to the remote client at pid: {}. message: {}".format( filtered_remote_cmdline, self.remote_pid, e ) ) finally: # Bad chunk types received from the server can throw NailgunProtocol.ProtocolError in # NailgunProtocol.iter_chunks(). This ensures the NailgunStreamWriter is always stopped. self._maybe_stop_input_writer() # If an asynchronous error was set at any point (such as in a signal handler), we want to make # sure we clean up the remote process before exiting with error. if self._exit_reason: if self.remote_pgrp: safe_kill(self.remote_pgrp, signal.SIGKILL) if self.remote_pid: safe_kill(self.remote_pid, signal.SIGKILL) raise self._exit_reason
def _process_session(self): """Process the outputs of the nailgun session.""" try: for chunk_type, payload in self.iter_chunks(self._sock, return_bytes=True): # TODO(#6579): assert that we have at this point received all the chunk types in # ChunkType.REQUEST_TYPES, then require PID and PGRP (exactly once?), and then allow any of # ChunkType.EXECUTION_TYPES. if chunk_type == ChunkType.STDOUT: self._write_flush(self._stdout, payload) elif chunk_type == ChunkType.STDERR: self._write_flush(self._stderr, payload) elif chunk_type == ChunkType.EXIT: self._write_flush(self._stdout) self._write_flush(self._stderr) return int(payload) elif chunk_type == ChunkType.PID: self.remote_pid = int(payload) if self._remote_pid_callback: self._remote_pid_callback(self.remote_pid) elif chunk_type == ChunkType.PGRP: self.remote_pgrp = int(payload) if self._remote_pgrp_callback: self._remote_pgrp_callback(self.remote_pgrp) elif chunk_type == ChunkType.START_READING_INPUT: self._maybe_start_input_writer() else: raise self.ProtocolError( "received unexpected chunk {} -> {}".format(chunk_type, payload) ) finally: # Bad chunk types received from the server can throw NailgunProtocol.ProtocolError in # NailgunProtocol.iter_chunks(). This ensures the NailgunStreamWriter is always stopped. self._maybe_stop_input_writer()
https://github.com/pantsbuild/pants/issues/6847
23:26:42 01:10 [run] ============== test session starts =============== platform darwin -- Python 2.7.10, pytest-3.6.4, py-1.7.0, pluggy-0.7.1 -- /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python cachedir: .pants.d/.pytest_cache rootdir: /Users/travis/build/pantsbuild/pants/.pants.d, inifile: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest-prep/CPython-2.7.10/e241a5f8b7de6d34689cc9307d8d06eb155c7c78/pytest.ini plugins: timeout-1.2.1, cov-2.4.0 collecting ... collected 7 items tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_logs_on_terminate <- ../../../../../../System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/case.py SKIPPED [ 14%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 28%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_keyboardinterrupt_signals <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py FAILED [ 42%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_logs_unhandled_exception <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 57%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 71%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_exiter <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 85%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [100%] ==================== FAILURES ==================== ExceptionSinkIntegrationTest.test_keyboardinterrupt_signals self = <pants_test.base.test_exception_sink_integration.ExceptionSinkIntegrationTest testMethod=test_keyboardinterrupt_signals> def test_keyboardinterrupt_signals(self): for interrupt_signal in [signal.SIGINT, signal.SIGQUIT]: with self._send_signal_to_waiter_handle(interrupt_signal) as (workdir, waiter_run): > self.assertIn('Interrupted by user.\n', waiter_run.stderr_data) E AssertionError: u'Interrupted by user.\n' not found in u'From cffi callback <function extern_clone_val at 0x11098a938>:\nTraceback (most recent call last):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/native.py", line 427, in extern_clone_val\n @ffi.def_extern()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/base/exception_sink.py", line 351, in handle_signal_gracefully\n raise KeyboardInterrupt(\'User interrupted execution with control-c!\')\nKeyboardInterrupt: User interrupted execution with control-c!\ntimestamp: 2018-11-29T23:28:22.606384\nException caught: (pants.build_graph.address_lookup_error.AddressLookupError)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module>\n main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main\n PantsLoader.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run\n cls.load_and_execute(entrypoint)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute\n entrypoint_main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main\n PantsRunner(exiter, start_time=start_time).run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run\n return runner.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run\n self._run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run\n goal_runner_result = self._maybe_run_v1(run_tracker, reporting)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1\n return goal_runner_factory.create().run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create\n goals, context = self._setup_context()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context\n self._root_dir\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph\n for _ in graph.inject_roots_closure(target_roots):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure\n for address in self._inject_specs(target_roots.specs):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs\n subjects)\n File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__\n self.gen.throw(type, value, traceback)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context\n \'Build graph construction failed: {} {}\'.format(type(e).__name__, str(e))\n\nException message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer\n\n\n' .pants.d/pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py:151: AssertionError -------------- Captured stdout call -------------- logs/exceptions.84142.log +++ logs/exceptions.84142.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.84142.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.84142.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.84142.log >>> pid: 84142 logs/exceptions.84142.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.84142.log >>> main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.84142.log >>> PantsLoader.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.84142.log >>> cls.load_and_execute(entrypoint) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.84142.log >>> entrypoint_main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.84142.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.84142.log >>> return runner.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.84142.log >>> self._run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.84142.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.84142.log >>> return goal_runner_factory.create().run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.84142.log >>> goals, context = self._setup_context() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.84142.log >>> self._root_dir logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.84142.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.84142.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.84142.log >>> subjects) logs/exceptions.84142.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.84142.log >>> self.gen.throw(type, value, traceback) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.84142.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.84142.log >>> logs/exceptions.84142.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.84142.log >>> logs/exceptions.84142.log --- logs/exceptions.log +++ logs/exceptions.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.log >>> pid: 84142 logs/exceptions.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.log >>> main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.log >>> PantsLoader.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.log >>> cls.load_and_execute(entrypoint) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.log >>> entrypoint_main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.log >>> return runner.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.log >>> self._run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.log >>> return goal_runner_factory.create().run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.log >>> goals, context = self._setup_context() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.log >>> self._root_dir logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.log >>> subjects) logs/exceptions.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.log >>> self.gen.throw(type, value, traceback) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.log >>> logs/exceptions.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.log >>> logs/exceptions.log --- generated xml file: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest/tests.python.pants_test.base.exception_sink_integration/junitxml/TEST-tests.python.pants_test.base.exception_sink_integration.xml ============ slowest 3 test durations ============ 93.67s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt 6.08s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 5.55s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream 1 failed, 5 passed, 1 skipped in 118.85 seconds =
AssertionError
def _receive_remote_pid(self, pid): self._current_remote_pid = pid self._maybe_write_pid_file()
def _receive_remote_pid(self, pid): self._current_remote_pid = pid
https://github.com/pantsbuild/pants/issues/6847
23:26:42 01:10 [run] ============== test session starts =============== platform darwin -- Python 2.7.10, pytest-3.6.4, py-1.7.0, pluggy-0.7.1 -- /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python cachedir: .pants.d/.pytest_cache rootdir: /Users/travis/build/pantsbuild/pants/.pants.d, inifile: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest-prep/CPython-2.7.10/e241a5f8b7de6d34689cc9307d8d06eb155c7c78/pytest.ini plugins: timeout-1.2.1, cov-2.4.0 collecting ... collected 7 items tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_logs_on_terminate <- ../../../../../../System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/case.py SKIPPED [ 14%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 28%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_keyboardinterrupt_signals <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py FAILED [ 42%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_logs_unhandled_exception <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 57%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 71%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_exiter <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 85%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [100%] ==================== FAILURES ==================== ExceptionSinkIntegrationTest.test_keyboardinterrupt_signals self = <pants_test.base.test_exception_sink_integration.ExceptionSinkIntegrationTest testMethod=test_keyboardinterrupt_signals> def test_keyboardinterrupt_signals(self): for interrupt_signal in [signal.SIGINT, signal.SIGQUIT]: with self._send_signal_to_waiter_handle(interrupt_signal) as (workdir, waiter_run): > self.assertIn('Interrupted by user.\n', waiter_run.stderr_data) E AssertionError: u'Interrupted by user.\n' not found in u'From cffi callback <function extern_clone_val at 0x11098a938>:\nTraceback (most recent call last):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/native.py", line 427, in extern_clone_val\n @ffi.def_extern()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/base/exception_sink.py", line 351, in handle_signal_gracefully\n raise KeyboardInterrupt(\'User interrupted execution with control-c!\')\nKeyboardInterrupt: User interrupted execution with control-c!\ntimestamp: 2018-11-29T23:28:22.606384\nException caught: (pants.build_graph.address_lookup_error.AddressLookupError)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module>\n main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main\n PantsLoader.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run\n cls.load_and_execute(entrypoint)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute\n entrypoint_main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main\n PantsRunner(exiter, start_time=start_time).run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run\n return runner.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run\n self._run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run\n goal_runner_result = self._maybe_run_v1(run_tracker, reporting)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1\n return goal_runner_factory.create().run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create\n goals, context = self._setup_context()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context\n self._root_dir\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph\n for _ in graph.inject_roots_closure(target_roots):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure\n for address in self._inject_specs(target_roots.specs):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs\n subjects)\n File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__\n self.gen.throw(type, value, traceback)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context\n \'Build graph construction failed: {} {}\'.format(type(e).__name__, str(e))\n\nException message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer\n\n\n' .pants.d/pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py:151: AssertionError -------------- Captured stdout call -------------- logs/exceptions.84142.log +++ logs/exceptions.84142.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.84142.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.84142.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.84142.log >>> pid: 84142 logs/exceptions.84142.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.84142.log >>> main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.84142.log >>> PantsLoader.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.84142.log >>> cls.load_and_execute(entrypoint) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.84142.log >>> entrypoint_main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.84142.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.84142.log >>> return runner.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.84142.log >>> self._run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.84142.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.84142.log >>> return goal_runner_factory.create().run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.84142.log >>> goals, context = self._setup_context() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.84142.log >>> self._root_dir logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.84142.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.84142.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.84142.log >>> subjects) logs/exceptions.84142.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.84142.log >>> self.gen.throw(type, value, traceback) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.84142.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.84142.log >>> logs/exceptions.84142.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.84142.log >>> logs/exceptions.84142.log --- logs/exceptions.log +++ logs/exceptions.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.log >>> pid: 84142 logs/exceptions.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.log >>> main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.log >>> PantsLoader.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.log >>> cls.load_and_execute(entrypoint) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.log >>> entrypoint_main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.log >>> return runner.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.log >>> self._run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.log >>> return goal_runner_factory.create().run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.log >>> goals, context = self._setup_context() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.log >>> self._root_dir logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.log >>> subjects) logs/exceptions.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.log >>> self.gen.throw(type, value, traceback) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.log >>> logs/exceptions.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.log >>> logs/exceptions.log --- generated xml file: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest/tests.python.pants_test.base.exception_sink_integration/junitxml/TEST-tests.python.pants_test.base.exception_sink_integration.xml ============ slowest 3 test durations ============ 93.67s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt 6.08s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 5.55s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream 1 failed, 5 passed, 1 skipped in 118.85 seconds =
AssertionError
def _receive_remote_pgrp(self, pgrp): self._current_remote_pgrp = pgrp self._maybe_write_pid_file()
def _receive_remote_pgrp(self, pgrp): self._current_remote_pgrp = pgrp
https://github.com/pantsbuild/pants/issues/6847
23:26:42 01:10 [run] ============== test session starts =============== platform darwin -- Python 2.7.10, pytest-3.6.4, py-1.7.0, pluggy-0.7.1 -- /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python cachedir: .pants.d/.pytest_cache rootdir: /Users/travis/build/pantsbuild/pants/.pants.d, inifile: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest-prep/CPython-2.7.10/e241a5f8b7de6d34689cc9307d8d06eb155c7c78/pytest.ini plugins: timeout-1.2.1, cov-2.4.0 collecting ... collected 7 items tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_logs_on_terminate <- ../../../../../../System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/case.py SKIPPED [ 14%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 28%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_keyboardinterrupt_signals <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py FAILED [ 42%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_logs_unhandled_exception <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 57%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 71%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_exiter <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 85%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [100%] ==================== FAILURES ==================== ExceptionSinkIntegrationTest.test_keyboardinterrupt_signals self = <pants_test.base.test_exception_sink_integration.ExceptionSinkIntegrationTest testMethod=test_keyboardinterrupt_signals> def test_keyboardinterrupt_signals(self): for interrupt_signal in [signal.SIGINT, signal.SIGQUIT]: with self._send_signal_to_waiter_handle(interrupt_signal) as (workdir, waiter_run): > self.assertIn('Interrupted by user.\n', waiter_run.stderr_data) E AssertionError: u'Interrupted by user.\n' not found in u'From cffi callback <function extern_clone_val at 0x11098a938>:\nTraceback (most recent call last):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/native.py", line 427, in extern_clone_val\n @ffi.def_extern()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/base/exception_sink.py", line 351, in handle_signal_gracefully\n raise KeyboardInterrupt(\'User interrupted execution with control-c!\')\nKeyboardInterrupt: User interrupted execution with control-c!\ntimestamp: 2018-11-29T23:28:22.606384\nException caught: (pants.build_graph.address_lookup_error.AddressLookupError)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module>\n main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main\n PantsLoader.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run\n cls.load_and_execute(entrypoint)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute\n entrypoint_main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main\n PantsRunner(exiter, start_time=start_time).run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run\n return runner.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run\n self._run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run\n goal_runner_result = self._maybe_run_v1(run_tracker, reporting)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1\n return goal_runner_factory.create().run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create\n goals, context = self._setup_context()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context\n self._root_dir\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph\n for _ in graph.inject_roots_closure(target_roots):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure\n for address in self._inject_specs(target_roots.specs):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs\n subjects)\n File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__\n self.gen.throw(type, value, traceback)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context\n \'Build graph construction failed: {} {}\'.format(type(e).__name__, str(e))\n\nException message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer\n\n\n' .pants.d/pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py:151: AssertionError -------------- Captured stdout call -------------- logs/exceptions.84142.log +++ logs/exceptions.84142.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.84142.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.84142.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.84142.log >>> pid: 84142 logs/exceptions.84142.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.84142.log >>> main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.84142.log >>> PantsLoader.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.84142.log >>> cls.load_and_execute(entrypoint) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.84142.log >>> entrypoint_main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.84142.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.84142.log >>> return runner.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.84142.log >>> self._run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.84142.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.84142.log >>> return goal_runner_factory.create().run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.84142.log >>> goals, context = self._setup_context() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.84142.log >>> self._root_dir logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.84142.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.84142.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.84142.log >>> subjects) logs/exceptions.84142.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.84142.log >>> self.gen.throw(type, value, traceback) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.84142.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.84142.log >>> logs/exceptions.84142.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.84142.log >>> logs/exceptions.84142.log --- logs/exceptions.log +++ logs/exceptions.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.log >>> pid: 84142 logs/exceptions.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.log >>> main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.log >>> PantsLoader.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.log >>> cls.load_and_execute(entrypoint) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.log >>> entrypoint_main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.log >>> return runner.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.log >>> self._run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.log >>> return goal_runner_factory.create().run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.log >>> goals, context = self._setup_context() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.log >>> self._root_dir logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.log >>> subjects) logs/exceptions.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.log >>> self.gen.throw(type, value, traceback) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.log >>> logs/exceptions.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.log >>> logs/exceptions.log --- generated xml file: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest/tests.python.pants_test.base.exception_sink_integration/junitxml/TEST-tests.python.pants_test.base.exception_sink_integration.xml ============ slowest 3 test durations ============ 93.67s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt 6.08s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 5.55s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream 1 failed, 5 passed, 1 skipped in 118.85 seconds =
AssertionError
def iter_chunks(cls, sock, return_bytes=False, timeout_object=None): """Generates chunks from a connected socket until an Exit chunk is sent or a timeout occurs. :param sock: the socket to read from. :param bool return_bytes: If False, decode the payload into a utf-8 string. :param cls.TimeoutProvider timeout_object: If provided, will be checked every iteration for a possible timeout. :raises: :class:`cls.ProcessStreamTimeout` """ assert timeout_object is None or isinstance(timeout_object, cls.TimeoutProvider) orig_timeout_time = None timeout_interval = None while 1: if orig_timeout_time is not None: remaining_time = time.time() - (orig_timeout_time + timeout_interval) if remaining_time > 0: original_timestamp = datetime.datetime.fromtimestamp( orig_timeout_time ).isoformat() raise cls.ProcessStreamTimeout( "iterating over bytes from nailgun timed out with timeout interval {} starting at {}, " "overtime seconds: {}".format( timeout_interval, original_timestamp, remaining_time ) ) elif timeout_object is not None: opts = timeout_object.maybe_timeout_options() if opts: orig_timeout_time = opts.start_time timeout_interval = opts.interval continue remaining_time = None else: remaining_time = None with cls._set_socket_timeout(sock, timeout=remaining_time): chunk_type, payload = cls.read_chunk(sock, return_bytes) yield chunk_type, payload if chunk_type == ChunkType.EXIT: break
def iter_chunks(cls, sock, return_bytes=False): """Generates chunks from a connected socket until an Exit chunk is sent.""" while 1: chunk_type, payload = cls.read_chunk(sock, return_bytes) yield chunk_type, payload if chunk_type == ChunkType.EXIT: break
https://github.com/pantsbuild/pants/issues/6847
23:26:42 01:10 [run] ============== test session starts =============== platform darwin -- Python 2.7.10, pytest-3.6.4, py-1.7.0, pluggy-0.7.1 -- /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python cachedir: .pants.d/.pytest_cache rootdir: /Users/travis/build/pantsbuild/pants/.pants.d, inifile: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest-prep/CPython-2.7.10/e241a5f8b7de6d34689cc9307d8d06eb155c7c78/pytest.ini plugins: timeout-1.2.1, cov-2.4.0 collecting ... collected 7 items tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_logs_on_terminate <- ../../../../../../System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/case.py SKIPPED [ 14%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 28%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_keyboardinterrupt_signals <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py FAILED [ 42%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_logs_unhandled_exception <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 57%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 71%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_exiter <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 85%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [100%] ==================== FAILURES ==================== ExceptionSinkIntegrationTest.test_keyboardinterrupt_signals self = <pants_test.base.test_exception_sink_integration.ExceptionSinkIntegrationTest testMethod=test_keyboardinterrupt_signals> def test_keyboardinterrupt_signals(self): for interrupt_signal in [signal.SIGINT, signal.SIGQUIT]: with self._send_signal_to_waiter_handle(interrupt_signal) as (workdir, waiter_run): > self.assertIn('Interrupted by user.\n', waiter_run.stderr_data) E AssertionError: u'Interrupted by user.\n' not found in u'From cffi callback <function extern_clone_val at 0x11098a938>:\nTraceback (most recent call last):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/native.py", line 427, in extern_clone_val\n @ffi.def_extern()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/base/exception_sink.py", line 351, in handle_signal_gracefully\n raise KeyboardInterrupt(\'User interrupted execution with control-c!\')\nKeyboardInterrupt: User interrupted execution with control-c!\ntimestamp: 2018-11-29T23:28:22.606384\nException caught: (pants.build_graph.address_lookup_error.AddressLookupError)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module>\n main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main\n PantsLoader.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run\n cls.load_and_execute(entrypoint)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute\n entrypoint_main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main\n PantsRunner(exiter, start_time=start_time).run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run\n return runner.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run\n self._run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run\n goal_runner_result = self._maybe_run_v1(run_tracker, reporting)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1\n return goal_runner_factory.create().run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create\n goals, context = self._setup_context()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context\n self._root_dir\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph\n for _ in graph.inject_roots_closure(target_roots):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure\n for address in self._inject_specs(target_roots.specs):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs\n subjects)\n File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__\n self.gen.throw(type, value, traceback)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context\n \'Build graph construction failed: {} {}\'.format(type(e).__name__, str(e))\n\nException message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer\n\n\n' .pants.d/pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py:151: AssertionError -------------- Captured stdout call -------------- logs/exceptions.84142.log +++ logs/exceptions.84142.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.84142.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.84142.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.84142.log >>> pid: 84142 logs/exceptions.84142.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.84142.log >>> main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.84142.log >>> PantsLoader.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.84142.log >>> cls.load_and_execute(entrypoint) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.84142.log >>> entrypoint_main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.84142.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.84142.log >>> return runner.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.84142.log >>> self._run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.84142.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.84142.log >>> return goal_runner_factory.create().run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.84142.log >>> goals, context = self._setup_context() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.84142.log >>> self._root_dir logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.84142.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.84142.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.84142.log >>> subjects) logs/exceptions.84142.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.84142.log >>> self.gen.throw(type, value, traceback) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.84142.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.84142.log >>> logs/exceptions.84142.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.84142.log >>> logs/exceptions.84142.log --- logs/exceptions.log +++ logs/exceptions.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.log >>> pid: 84142 logs/exceptions.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.log >>> main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.log >>> PantsLoader.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.log >>> cls.load_and_execute(entrypoint) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.log >>> entrypoint_main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.log >>> return runner.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.log >>> self._run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.log >>> return goal_runner_factory.create().run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.log >>> goals, context = self._setup_context() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.log >>> self._root_dir logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.log >>> subjects) logs/exceptions.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.log >>> self.gen.throw(type, value, traceback) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.log >>> logs/exceptions.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.log >>> logs/exceptions.log --- generated xml file: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest/tests.python.pants_test.base.exception_sink_integration/junitxml/TEST-tests.python.pants_test.base.exception_sink_integration.xml ============ slowest 3 test durations ============ 93.67s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt 6.08s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 5.55s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream 1 failed, 5 passed, 1 skipped in 118.85 seconds =
AssertionError
def register_bootstrap_options(cls, register): """Register bootstrap options. "Bootstrap options" are a small set of options whose values are useful when registering other options. Therefore we must bootstrap them early, before other options are registered, let alone parsed. Bootstrap option values can be interpolated into the config file, and can be referenced programatically in registration code, e.g., as register.bootstrap.pants_workdir. Note that regular code can also access these options as normal global-scope options. Their status as "bootstrap options" is only pertinent during option registration. """ buildroot = get_buildroot() default_distdir_name = "dist" default_distdir = os.path.join(buildroot, default_distdir_name) default_rel_distdir = "/{}/".format(default_distdir_name) register( "-l", "--level", choices=["trace", "debug", "info", "warn"], default="info", recursive=True, help="Set the logging level.", ) register( "-q", "--quiet", type=bool, recursive=True, daemon=False, help="Squelches most console output. NOTE: Some tasks default to behaving quietly: " "inverting this option supports making them noisier than they would be otherwise.", ) # Not really needed in bootstrap options, but putting it here means it displays right # after -l and -q in help output, which is conveniently contextual. register( "--colors", type=bool, default=sys.stdout.isatty(), recursive=True, daemon=False, help="Set whether log messages are displayed in color.", ) register( "--pants-version", advanced=True, default=pants_version(), help="Use this pants version. Note Pants code only uses this to verify that you are " "using the requested version, as Pants cannot dynamically change the version it " "is using once the program is already running. This option is useful to set in " "your pants.ini, however, and then you can grep the value to select which " "version to use for setup scripts (e.g. `./pants`), runner scripts, IDE plugins, " "etc. For example, the setup script we distribute at https://www.pantsbuild.org/install.html#recommended-installation " "uses this value to determine which Python version to run with. You may find the " "version of the pants instance you are running using -v, -V, or --version.", ) register( "--pants-runtime-python-version", advanced=True, help="Use this Python version to run Pants. The option expects the major and minor " "version, e.g. 2.7 or 3.6. Note Pants code only uses this to verify that you are " "using the requested interpreter, as Pants cannot dynamically change the " "interpreter it is using once the program is already running. This option is " "useful to set in your pants.ini, however, and then you can grep the value to " "select which interpreter to use for setup scripts (e.g. `./pants`), runner " "scripts, IDE plugins, etc. For example, the setup script we distribute at " "https://www.pantsbuild.org/install.html#recommended-installation uses this " "value to determine which Python version to run with. Also note this does not mean " "your own code must use this Python version. See " "https://www.pantsbuild.org/python_readme.html#configure-the-python-version " "for how to configure your code's compatibility.", ) register("--plugins", advanced=True, type=list, help="Load these plugins.") register( "--plugin-cache-dir", advanced=True, default=os.path.join(get_pants_cachedir(), "plugins"), help="Cache resolved plugin requirements here.", ) register( "--backend-packages", advanced=True, type=list, default=[ "pants.backend.graph_info", "pants.backend.python", "pants.backend.jvm", "pants.backend.native", # TODO: Move into the graph_info backend. "pants.rules.core", "pants.backend.codegen.antlr.java", "pants.backend.codegen.antlr.python", "pants.backend.codegen.jaxb", "pants.backend.codegen.protobuf.java", "pants.backend.codegen.ragel.java", "pants.backend.codegen.thrift.java", "pants.backend.codegen.thrift.python", "pants.backend.codegen.grpcio.python", "pants.backend.codegen.wire.java", "pants.backend.project_info", ], help="Load backends from these packages that are already on the path. " "Add contrib and custom backends to this list.", ) register( "--pants-bootstrapdir", advanced=True, metavar="<dir>", default=get_pants_cachedir(), help="Use this dir for global cache.", ) register( "--pants-configdir", advanced=True, metavar="<dir>", default=get_pants_configdir(), help="Use this dir for global config files.", ) register( "--pants-workdir", advanced=True, metavar="<dir>", default=os.path.join(buildroot, ".pants.d"), help="Write intermediate output files to this dir.", ) register( "--pants-supportdir", advanced=True, metavar="<dir>", default=os.path.join(buildroot, "build-support"), help="Use support files from this dir.", ) register( "--pants-distdir", advanced=True, metavar="<dir>", default=default_distdir, help="Write end-product artifacts to this dir. If you modify this path, you " "should also update --build-ignore and --pants-ignore to include the " "custom dist dir path as well.", ) register( "--pants-subprocessdir", advanced=True, default=os.path.join(buildroot, ".pids"), help="The directory to use for tracking subprocess metadata, if any. This should " "live outside of the dir used by `--pants-workdir` to allow for tracking " "subprocesses that outlive the workdir data (e.g. `./pants server`).", ) register( "--pants-config-files", advanced=True, type=list, daemon=False, default=[get_default_pants_config_file()], help="Paths to Pants config files.", ) # TODO: Deprecate the --pantsrc/--pantsrc-files options? This would require being able # to set extra config file locations in an initial bootstrap config file. register( "--pantsrc", advanced=True, type=bool, default=True, help="Use pantsrc files." ) register( "--pantsrc-files", advanced=True, type=list, metavar="<path>", daemon=False, default=["/etc/pantsrc", "~/.pants.rc"], help="Override config with values from these files. " "Later files override earlier ones.", ) register( "--pythonpath", advanced=True, type=list, help="Add these directories to PYTHONPATH to search for plugins.", ) register( "--target-spec-file", type=list, dest="target_spec_files", daemon=False, help="Read additional specs from this file, one per line", ) register( "--verify-config", type=bool, default=True, daemon=False, advanced=True, help="Verify that all config file values correspond to known options.", ) register( "--build-ignore", advanced=True, type=list, fromfile=True, default=[ ".*/", default_rel_distdir, "bower_components/", "node_modules/", "*.egg-info/", ], help="Paths to ignore when identifying BUILD files. " "This does not affect any other filesystem operations. " "Patterns use the gitignore pattern syntax (https://git-scm.com/docs/gitignore).", ) register( "--pants-ignore", advanced=True, type=list, fromfile=True, default=[".*/", default_rel_distdir], help="Paths to ignore for all filesystem operations performed by pants " "(e.g. BUILD file scanning, glob matching, etc). " "Patterns use the gitignore syntax (https://git-scm.com/docs/gitignore).", ) register( "--glob-expansion-failure", advanced=True, default=GlobMatchErrorBehavior.warn, type=GlobMatchErrorBehavior, help="Raise an exception if any targets declaring source files " "fail to match any glob provided in the 'sources' argument.", ) register( "--exclude-target-regexp", advanced=True, type=list, default=[], daemon=False, metavar="<regexp>", help="Exclude target roots that match these regexes.", ) register( "--subproject-roots", type=list, advanced=True, fromfile=True, default=[], help="Paths that correspond with build roots for any subproject that this " "project depends on.", ) register( "--owner-of", type=list, default=[], daemon=False, fromfile=True, metavar="<path>", help="Select the targets that own these files. " "This is the third target calculation strategy along with the --changed-* " "options and specifying the targets directly. These three types of target " "selection are mutually exclusive.", ) # These logging options are registered in the bootstrap phase so that plugins can log during # registration and not so that their values can be interpolated in configs. register( "-d", "--logdir", advanced=True, metavar="<dir>", help="Write logs to files under this directory.", ) # This facilitates bootstrap-time configuration of pantsd usage such that we can # determine whether or not to use the Pailgun client to invoke a given pants run # without resorting to heavier options parsing. register( "--enable-pantsd", advanced=True, type=bool, default=False, help="Enables use of the pants daemon (and implicitly, the v2 engine). (Beta)", ) # Shutdown pantsd after the current run. # This needs to be accessed at the same time as enable_pantsd, # so we register it at bootstrap time. register( "--shutdown-pantsd-after-run", advanced=True, type=bool, default=False, help="Create a new pantsd server, and use it, and shut it down immediately after. " "If pantsd is already running, it will shut it down and spawn a new instance (Beta)", ) # These facilitate configuring the native engine. register( "--native-engine-visualize-to", advanced=True, default=None, type=dir_option, daemon=False, help="A directory to write execution and rule graphs to as `dot` files. The contents " "of the directory will be overwritten if any filenames collide.", ) register( "--print-exception-stacktrace", advanced=True, type=bool, help="Print to console the full exception stack trace if encountered.", ) # BinaryUtil options. register( "--binaries-baseurls", type=list, advanced=True, default=["https://binaries.pantsbuild.org"], help="List of URLs from which binary tools are downloaded. URLs are " "searched in order until the requested path is found.", ) register( "--binaries-fetch-timeout-secs", type=int, default=30, advanced=True, daemon=False, help="Timeout in seconds for URL reads when fetching binary tools from the " "repos specified by --baseurls.", ) register( "--binaries-path-by-id", type=dict, advanced=True, help=( "Maps output of uname for a machine to a binary search path: " "(sysname, id) -> (os, arch), e.g. {('darwin', '15'): ('mac', '10.11'), " "('linux', 'arm32'): ('linux', 'arm32')}." ), ) register( "--allow-external-binary-tool-downloads", type=bool, default=True, advanced=True, help="If False, require BinaryTool subclasses to download their contents from urls " "generated from --binaries-baseurls, even if the tool has an external url " "generator. This can be necessary if using Pants in an environment which cannot " "contact the wider Internet.", ) # Pants Daemon options. register( "--pantsd-pailgun-host", advanced=True, default="127.0.0.1", help="The host to bind the pants nailgun server to.", ) register( "--pantsd-pailgun-port", advanced=True, type=int, default=0, help="The port to bind the pants nailgun server to. Defaults to a random port.", ) register( "--pantsd-pailgun-quit-timeout", advanced=True, type=float, default=1.0, help="The length of time (in seconds) to wait for further output after sending a " "signal to the remote pantsd-runner process before killing it.", ) register( "--pantsd-log-dir", advanced=True, default=None, help="The directory to log pantsd output to.", ) register( "--pantsd-invalidation-globs", advanced=True, type=list, fromfile=True, default=[], help="Filesystem events matching any of these globs will trigger a daemon restart.", ) # Watchman options. register( "--watchman-version", advanced=True, default="4.9.0-pants1", help="Watchman version.", ) register( "--watchman-supportdir", advanced=True, default="bin/watchman", help="Find watchman binaries under this dir. Used as part of the path to lookup " "the binary with --binaries-baseurls and --pants-bootstrapdir.", ) register( "--watchman-startup-timeout", type=float, advanced=True, default=30.0, help="The watchman socket timeout (in seconds) for the initial `watch-project` command. " "This may need to be set higher for larger repos due to watchman startup cost.", ) register( "--watchman-socket-timeout", type=float, advanced=True, default=0.1, help="The watchman client socket timeout in seconds. Setting this to too high a " "value can negatively impact the latency of runs forked by pantsd.", ) register( "--watchman-socket-path", type=str, advanced=True, default=None, help="The path to the watchman UNIX socket. This can be overridden if the default " "absolute path length exceeds the maximum allowed by the OS.", ) # This option changes the parser behavior in a fundamental way (which currently invalidates # all caches), and needs to be parsed out early, so we make it a bootstrap option. register( "--build-file-imports", choices=["allow", "warn", "error"], default="warn", advanced=True, help="Whether to allow import statements in BUILD files", ) register( "--local-store-dir", advanced=True, help="Directory to use for engine's local file store.", # This default is also hard-coded into the engine's rust code in # fs::Store::default_path default=os.path.expanduser("~/.cache/pants/lmdb_store"), ) register( "--remote-store-server", advanced=True, type=list, default=[], help="host:port of grpc server to use as remote execution file store.", ) register( "--remote-store-thread-count", type=int, advanced=True, default=DEFAULT_EXECUTION_OPTIONS.remote_store_thread_count, help="Thread count to use for the pool that interacts with the remote file store.", ) register( "--remote-execution-server", advanced=True, help="host:port of grpc server to use as remote execution scheduler.", ) register( "--remote-store-chunk-bytes", type=int, advanced=True, default=DEFAULT_EXECUTION_OPTIONS.remote_store_chunk_bytes, help="Size in bytes of chunks transferred to/from the remote file store.", ) register( "--remote-store-chunk-upload-timeout-seconds", type=int, advanced=True, default=DEFAULT_EXECUTION_OPTIONS.remote_store_chunk_upload_timeout_seconds, help="Timeout (in seconds) for uploads of individual chunks to the remote file store.", ) register( "--remote-store-rpc-retries", type=int, advanced=True, default=DEFAULT_EXECUTION_OPTIONS.remote_store_rpc_retries, help="Number of times to retry any RPC to the remote store before giving up.", ) register( "--remote-execution-process-cache-namespace", advanced=True, help="The cache namespace for remote process execution. " "Bump this to invalidate every artifact's remote execution. " "This is the remote execution equivalent of the legacy cache-key-gen-version " "flag.", ) register( "--remote-instance-name", advanced=True, help="Name of the remote execution instance to use. Used for routing within " "--remote-execution-server and --remote-store-server.", ) register( "--remote-ca-certs-path", advanced=True, help="Path to a PEM file containing CA certificates used for verifying secure " "connections to --remote-execution-server and --remote-store-server. " "If not specified, TLS will not be used.", ) register( "--remote-oauth-bearer-token-path", advanced=True, help="Path to a file containing an oauth token to use for grpc connections to " "--remote-execution-server and --remote-store-server. If not specified, no " "authorization will be performed.", ) # This should eventually deprecate the RunTracker worker count, which is used for legacy cache # lookups via CacheSetup in TaskBase. register( "--process-execution-parallelism", type=int, default=multiprocessing.cpu_count(), advanced=True, help="Number of concurrent processes that may be executed either locally and remotely.", ) register( "--process-execution-cleanup-local-dirs", type=bool, default=True, advanced=True, help="Whether or not to cleanup directories used for local process execution " "(primarily useful for e.g. debugging).", )
def register_bootstrap_options(cls, register): """Register bootstrap options. "Bootstrap options" are a small set of options whose values are useful when registering other options. Therefore we must bootstrap them early, before other options are registered, let alone parsed. Bootstrap option values can be interpolated into the config file, and can be referenced programatically in registration code, e.g., as register.bootstrap.pants_workdir. Note that regular code can also access these options as normal global-scope options. Their status as "bootstrap options" is only pertinent during option registration. """ buildroot = get_buildroot() default_distdir_name = "dist" default_distdir = os.path.join(buildroot, default_distdir_name) default_rel_distdir = "/{}/".format(default_distdir_name) register( "-l", "--level", choices=["trace", "debug", "info", "warn"], default="info", recursive=True, help="Set the logging level.", ) register( "-q", "--quiet", type=bool, recursive=True, daemon=False, help="Squelches most console output. NOTE: Some tasks default to behaving quietly: " "inverting this option supports making them noisier than they would be otherwise.", ) # Not really needed in bootstrap options, but putting it here means it displays right # after -l and -q in help output, which is conveniently contextual. register( "--colors", type=bool, default=sys.stdout.isatty(), recursive=True, daemon=False, help="Set whether log messages are displayed in color.", ) register( "--pants-version", advanced=True, default=pants_version(), help="Use this pants version. Note Pants code only uses this to verify that you are " "using the requested version, as Pants cannot dynamically change the version it " "is using once the program is already running. This option is useful to set in " "your pants.ini, however, and then you can grep the value to select which " "version to use for setup scripts (e.g. `./pants`), runner scripts, IDE plugins, " "etc. For example, the setup script we distribute at https://www.pantsbuild.org/install.html#recommended-installation " "uses this value to determine which Python version to run with. You may find the " "version of the pants instance you are running using -v, -V, or --version.", ) register( "--pants-runtime-python-version", advanced=True, help="Use this Python version to run Pants. The option expects the major and minor " "version, e.g. 2.7 or 3.6. Note Pants code only uses this to verify that you are " "using the requested interpreter, as Pants cannot dynamically change the " "interpreter it is using once the program is already running. This option is " "useful to set in your pants.ini, however, and then you can grep the value to " "select which interpreter to use for setup scripts (e.g. `./pants`), runner " "scripts, IDE plugins, etc. For example, the setup script we distribute at " "https://www.pantsbuild.org/install.html#recommended-installation uses this " "value to determine which Python version to run with. Also note this does not mean " "your own code must use this Python version. See " "https://www.pantsbuild.org/python_readme.html#configure-the-python-version " "for how to configure your code's compatibility.", ) register("--plugins", advanced=True, type=list, help="Load these plugins.") register( "--plugin-cache-dir", advanced=True, default=os.path.join(get_pants_cachedir(), "plugins"), help="Cache resolved plugin requirements here.", ) register( "--backend-packages", advanced=True, type=list, default=[ "pants.backend.graph_info", "pants.backend.python", "pants.backend.jvm", "pants.backend.native", # TODO: Move into the graph_info backend. "pants.rules.core", "pants.backend.codegen.antlr.java", "pants.backend.codegen.antlr.python", "pants.backend.codegen.jaxb", "pants.backend.codegen.protobuf.java", "pants.backend.codegen.ragel.java", "pants.backend.codegen.thrift.java", "pants.backend.codegen.thrift.python", "pants.backend.codegen.grpcio.python", "pants.backend.codegen.wire.java", "pants.backend.project_info", ], help="Load backends from these packages that are already on the path. " "Add contrib and custom backends to this list.", ) register( "--pants-bootstrapdir", advanced=True, metavar="<dir>", default=get_pants_cachedir(), help="Use this dir for global cache.", ) register( "--pants-configdir", advanced=True, metavar="<dir>", default=get_pants_configdir(), help="Use this dir for global config files.", ) register( "--pants-workdir", advanced=True, metavar="<dir>", default=os.path.join(buildroot, ".pants.d"), help="Write intermediate output files to this dir.", ) register( "--pants-supportdir", advanced=True, metavar="<dir>", default=os.path.join(buildroot, "build-support"), help="Use support files from this dir.", ) register( "--pants-distdir", advanced=True, metavar="<dir>", default=default_distdir, help="Write end-product artifacts to this dir. If you modify this path, you " "should also update --build-ignore and --pants-ignore to include the " "custom dist dir path as well.", ) register( "--pants-subprocessdir", advanced=True, default=os.path.join(buildroot, ".pids"), help="The directory to use for tracking subprocess metadata, if any. This should " "live outside of the dir used by `--pants-workdir` to allow for tracking " "subprocesses that outlive the workdir data (e.g. `./pants server`).", ) register( "--pants-config-files", advanced=True, type=list, daemon=False, default=[get_default_pants_config_file()], help="Paths to Pants config files.", ) # TODO: Deprecate the --pantsrc/--pantsrc-files options? This would require being able # to set extra config file locations in an initial bootstrap config file. register( "--pantsrc", advanced=True, type=bool, default=True, help="Use pantsrc files." ) register( "--pantsrc-files", advanced=True, type=list, metavar="<path>", daemon=False, default=["/etc/pantsrc", "~/.pants.rc"], help="Override config with values from these files. " "Later files override earlier ones.", ) register( "--pythonpath", advanced=True, type=list, help="Add these directories to PYTHONPATH to search for plugins.", ) register( "--target-spec-file", type=list, dest="target_spec_files", daemon=False, help="Read additional specs from this file, one per line", ) register( "--verify-config", type=bool, default=True, daemon=False, advanced=True, help="Verify that all config file values correspond to known options.", ) register( "--build-ignore", advanced=True, type=list, fromfile=True, default=[ ".*/", default_rel_distdir, "bower_components/", "node_modules/", "*.egg-info/", ], help="Paths to ignore when identifying BUILD files. " "This does not affect any other filesystem operations. " "Patterns use the gitignore pattern syntax (https://git-scm.com/docs/gitignore).", ) register( "--pants-ignore", advanced=True, type=list, fromfile=True, default=[".*/", default_rel_distdir], help="Paths to ignore for all filesystem operations performed by pants " "(e.g. BUILD file scanning, glob matching, etc). " "Patterns use the gitignore syntax (https://git-scm.com/docs/gitignore).", ) register( "--glob-expansion-failure", advanced=True, default=GlobMatchErrorBehavior.warn, type=GlobMatchErrorBehavior, help="Raise an exception if any targets declaring source files " "fail to match any glob provided in the 'sources' argument.", ) register( "--exclude-target-regexp", advanced=True, type=list, default=[], daemon=False, metavar="<regexp>", help="Exclude target roots that match these regexes.", ) register( "--subproject-roots", type=list, advanced=True, fromfile=True, default=[], help="Paths that correspond with build roots for any subproject that this " "project depends on.", ) register( "--owner-of", type=list, default=[], daemon=False, fromfile=True, metavar="<path>", help="Select the targets that own these files. " "This is the third target calculation strategy along with the --changed-* " "options and specifying the targets directly. These three types of target " "selection are mutually exclusive.", ) # These logging options are registered in the bootstrap phase so that plugins can log during # registration and not so that their values can be interpolated in configs. register( "-d", "--logdir", advanced=True, metavar="<dir>", help="Write logs to files under this directory.", ) # This facilitates bootstrap-time configuration of pantsd usage such that we can # determine whether or not to use the Pailgun client to invoke a given pants run # without resorting to heavier options parsing. register( "--enable-pantsd", advanced=True, type=bool, default=False, help="Enables use of the pants daemon (and implicitly, the v2 engine). (Beta)", ) # Shutdown pantsd after the current run. # This needs to be accessed at the same time as enable_pantsd, # so we register it at bootstrap time. register( "--shutdown-pantsd-after-run", advanced=True, type=bool, default=False, help="Create a new pantsd server, and use it, and shut it down immediately after. " "If pantsd is already running, it will shut it down and spawn a new instance (Beta)", ) # These facilitate configuring the native engine. register( "--native-engine-visualize-to", advanced=True, default=None, type=dir_option, daemon=False, help="A directory to write execution and rule graphs to as `dot` files. The contents " "of the directory will be overwritten if any filenames collide.", ) register( "--print-exception-stacktrace", advanced=True, type=bool, help="Print to console the full exception stack trace if encountered.", ) # BinaryUtil options. register( "--binaries-baseurls", type=list, advanced=True, default=["https://binaries.pantsbuild.org"], help="List of URLs from which binary tools are downloaded. URLs are " "searched in order until the requested path is found.", ) register( "--binaries-fetch-timeout-secs", type=int, default=30, advanced=True, daemon=False, help="Timeout in seconds for URL reads when fetching binary tools from the " "repos specified by --baseurls.", ) register( "--binaries-path-by-id", type=dict, advanced=True, help=( "Maps output of uname for a machine to a binary search path: " "(sysname, id) -> (os, arch), e.g. {('darwin', '15'): ('mac', '10.11'), " "('linux', 'arm32'): ('linux', 'arm32')}." ), ) register( "--allow-external-binary-tool-downloads", type=bool, default=True, advanced=True, help="If False, require BinaryTool subclasses to download their contents from urls " "generated from --binaries-baseurls, even if the tool has an external url " "generator. This can be necessary if using Pants in an environment which cannot " "contact the wider Internet.", ) # Pants Daemon options. register( "--pantsd-pailgun-host", advanced=True, default="127.0.0.1", help="The host to bind the pants nailgun server to.", ) register( "--pantsd-pailgun-port", advanced=True, type=int, default=0, help="The port to bind the pants nailgun server to. Defaults to a random port.", ) register( "--pantsd-log-dir", advanced=True, default=None, help="The directory to log pantsd output to.", ) register( "--pantsd-invalidation-globs", advanced=True, type=list, fromfile=True, default=[], help="Filesystem events matching any of these globs will trigger a daemon restart.", ) # Watchman options. register( "--watchman-version", advanced=True, default="4.9.0-pants1", help="Watchman version.", ) register( "--watchman-supportdir", advanced=True, default="bin/watchman", help="Find watchman binaries under this dir. Used as part of the path to lookup " "the binary with --binaries-baseurls and --pants-bootstrapdir.", ) register( "--watchman-startup-timeout", type=float, advanced=True, default=30.0, help="The watchman socket timeout (in seconds) for the initial `watch-project` command. " "This may need to be set higher for larger repos due to watchman startup cost.", ) register( "--watchman-socket-timeout", type=float, advanced=True, default=0.1, help="The watchman client socket timeout in seconds. Setting this to too high a " "value can negatively impact the latency of runs forked by pantsd.", ) register( "--watchman-socket-path", type=str, advanced=True, default=None, help="The path to the watchman UNIX socket. This can be overridden if the default " "absolute path length exceeds the maximum allowed by the OS.", ) # This option changes the parser behavior in a fundamental way (which currently invalidates # all caches), and needs to be parsed out early, so we make it a bootstrap option. register( "--build-file-imports", choices=["allow", "warn", "error"], default="warn", advanced=True, help="Whether to allow import statements in BUILD files", ) register( "--local-store-dir", advanced=True, help="Directory to use for engine's local file store.", # This default is also hard-coded into the engine's rust code in # fs::Store::default_path default=os.path.expanduser("~/.cache/pants/lmdb_store"), ) register( "--remote-store-server", advanced=True, type=list, default=[], help="host:port of grpc server to use as remote execution file store.", ) register( "--remote-store-thread-count", type=int, advanced=True, default=DEFAULT_EXECUTION_OPTIONS.remote_store_thread_count, help="Thread count to use for the pool that interacts with the remote file store.", ) register( "--remote-execution-server", advanced=True, help="host:port of grpc server to use as remote execution scheduler.", ) register( "--remote-store-chunk-bytes", type=int, advanced=True, default=DEFAULT_EXECUTION_OPTIONS.remote_store_chunk_bytes, help="Size in bytes of chunks transferred to/from the remote file store.", ) register( "--remote-store-chunk-upload-timeout-seconds", type=int, advanced=True, default=DEFAULT_EXECUTION_OPTIONS.remote_store_chunk_upload_timeout_seconds, help="Timeout (in seconds) for uploads of individual chunks to the remote file store.", ) register( "--remote-store-rpc-retries", type=int, advanced=True, default=DEFAULT_EXECUTION_OPTIONS.remote_store_rpc_retries, help="Number of times to retry any RPC to the remote store before giving up.", ) register( "--remote-execution-process-cache-namespace", advanced=True, help="The cache namespace for remote process execution. " "Bump this to invalidate every artifact's remote execution. " "This is the remote execution equivalent of the legacy cache-key-gen-version " "flag.", ) register( "--remote-instance-name", advanced=True, help="Name of the remote execution instance to use. Used for routing within " "--remote-execution-server and --remote-store-server.", ) register( "--remote-ca-certs-path", advanced=True, help="Path to a PEM file containing CA certificates used for verifying secure " "connections to --remote-execution-server and --remote-store-server. " "If not specified, TLS will not be used.", ) register( "--remote-oauth-bearer-token-path", advanced=True, help="Path to a file containing an oauth token to use for grpc connections to " "--remote-execution-server and --remote-store-server. If not specified, no " "authorization will be performed.", ) # This should eventually deprecate the RunTracker worker count, which is used for legacy cache # lookups via CacheSetup in TaskBase. register( "--process-execution-parallelism", type=int, default=multiprocessing.cpu_count(), advanced=True, help="Number of concurrent processes that may be executed either locally and remotely.", ) register( "--process-execution-cleanup-local-dirs", type=bool, default=True, advanced=True, help="Whether or not to cleanup directories used for local process execution " "(primarily useful for e.g. debugging).", )
https://github.com/pantsbuild/pants/issues/6847
23:26:42 01:10 [run] ============== test session starts =============== platform darwin -- Python 2.7.10, pytest-3.6.4, py-1.7.0, pluggy-0.7.1 -- /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python cachedir: .pants.d/.pytest_cache rootdir: /Users/travis/build/pantsbuild/pants/.pants.d, inifile: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest-prep/CPython-2.7.10/e241a5f8b7de6d34689cc9307d8d06eb155c7c78/pytest.ini plugins: timeout-1.2.1, cov-2.4.0 collecting ... collected 7 items tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_logs_on_terminate <- ../../../../../../System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/case.py SKIPPED [ 14%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 28%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_keyboardinterrupt_signals <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py FAILED [ 42%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_logs_unhandled_exception <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 57%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 71%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_exiter <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 85%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [100%] ==================== FAILURES ==================== ExceptionSinkIntegrationTest.test_keyboardinterrupt_signals self = <pants_test.base.test_exception_sink_integration.ExceptionSinkIntegrationTest testMethod=test_keyboardinterrupt_signals> def test_keyboardinterrupt_signals(self): for interrupt_signal in [signal.SIGINT, signal.SIGQUIT]: with self._send_signal_to_waiter_handle(interrupt_signal) as (workdir, waiter_run): > self.assertIn('Interrupted by user.\n', waiter_run.stderr_data) E AssertionError: u'Interrupted by user.\n' not found in u'From cffi callback <function extern_clone_val at 0x11098a938>:\nTraceback (most recent call last):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/native.py", line 427, in extern_clone_val\n @ffi.def_extern()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/base/exception_sink.py", line 351, in handle_signal_gracefully\n raise KeyboardInterrupt(\'User interrupted execution with control-c!\')\nKeyboardInterrupt: User interrupted execution with control-c!\ntimestamp: 2018-11-29T23:28:22.606384\nException caught: (pants.build_graph.address_lookup_error.AddressLookupError)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module>\n main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main\n PantsLoader.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run\n cls.load_and_execute(entrypoint)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute\n entrypoint_main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main\n PantsRunner(exiter, start_time=start_time).run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run\n return runner.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run\n self._run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run\n goal_runner_result = self._maybe_run_v1(run_tracker, reporting)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1\n return goal_runner_factory.create().run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create\n goals, context = self._setup_context()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context\n self._root_dir\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph\n for _ in graph.inject_roots_closure(target_roots):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure\n for address in self._inject_specs(target_roots.specs):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs\n subjects)\n File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__\n self.gen.throw(type, value, traceback)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context\n \'Build graph construction failed: {} {}\'.format(type(e).__name__, str(e))\n\nException message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer\n\n\n' .pants.d/pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py:151: AssertionError -------------- Captured stdout call -------------- logs/exceptions.84142.log +++ logs/exceptions.84142.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.84142.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.84142.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.84142.log >>> pid: 84142 logs/exceptions.84142.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.84142.log >>> main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.84142.log >>> PantsLoader.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.84142.log >>> cls.load_and_execute(entrypoint) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.84142.log >>> entrypoint_main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.84142.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.84142.log >>> return runner.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.84142.log >>> self._run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.84142.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.84142.log >>> return goal_runner_factory.create().run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.84142.log >>> goals, context = self._setup_context() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.84142.log >>> self._root_dir logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.84142.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.84142.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.84142.log >>> subjects) logs/exceptions.84142.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.84142.log >>> self.gen.throw(type, value, traceback) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.84142.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.84142.log >>> logs/exceptions.84142.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.84142.log >>> logs/exceptions.84142.log --- logs/exceptions.log +++ logs/exceptions.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.log >>> pid: 84142 logs/exceptions.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.log >>> main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.log >>> PantsLoader.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.log >>> cls.load_and_execute(entrypoint) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.log >>> entrypoint_main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.log >>> return runner.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.log >>> self._run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.log >>> return goal_runner_factory.create().run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.log >>> goals, context = self._setup_context() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.log >>> self._root_dir logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.log >>> subjects) logs/exceptions.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.log >>> self.gen.throw(type, value, traceback) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.log >>> logs/exceptions.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.log >>> logs/exceptions.log --- generated xml file: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest/tests.python.pants_test.base.exception_sink_integration/junitxml/TEST-tests.python.pants_test.base.exception_sink_integration.xml ============ slowest 3 test durations ============ 93.67s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt 6.08s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 5.55s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream 1 failed, 5 passed, 1 skipped in 118.85 seconds =
AssertionError
def write(self, msg): msg = ensure_text(msg) for line in msg.rstrip().splitlines(): # The log only accepts text, and will raise a decoding error if the default encoding is ascii # if provided a bytes input for unicode text. line = ensure_text(line) self._logger.log(self._log_level, line.rstrip())
def write(self, msg): msg = ensure_text(msg) for line in msg.rstrip().splitlines(): self._logger.log(self._log_level, line.rstrip())
https://github.com/pantsbuild/pants/issues/6847
23:26:42 01:10 [run] ============== test session starts =============== platform darwin -- Python 2.7.10, pytest-3.6.4, py-1.7.0, pluggy-0.7.1 -- /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python cachedir: .pants.d/.pytest_cache rootdir: /Users/travis/build/pantsbuild/pants/.pants.d, inifile: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest-prep/CPython-2.7.10/e241a5f8b7de6d34689cc9307d8d06eb155c7c78/pytest.ini plugins: timeout-1.2.1, cov-2.4.0 collecting ... collected 7 items tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_logs_on_terminate <- ../../../../../../System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/case.py SKIPPED [ 14%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 28%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_keyboardinterrupt_signals <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py FAILED [ 42%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_logs_unhandled_exception <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 57%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 71%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_exiter <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 85%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [100%] ==================== FAILURES ==================== ExceptionSinkIntegrationTest.test_keyboardinterrupt_signals self = <pants_test.base.test_exception_sink_integration.ExceptionSinkIntegrationTest testMethod=test_keyboardinterrupt_signals> def test_keyboardinterrupt_signals(self): for interrupt_signal in [signal.SIGINT, signal.SIGQUIT]: with self._send_signal_to_waiter_handle(interrupt_signal) as (workdir, waiter_run): > self.assertIn('Interrupted by user.\n', waiter_run.stderr_data) E AssertionError: u'Interrupted by user.\n' not found in u'From cffi callback <function extern_clone_val at 0x11098a938>:\nTraceback (most recent call last):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/native.py", line 427, in extern_clone_val\n @ffi.def_extern()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/base/exception_sink.py", line 351, in handle_signal_gracefully\n raise KeyboardInterrupt(\'User interrupted execution with control-c!\')\nKeyboardInterrupt: User interrupted execution with control-c!\ntimestamp: 2018-11-29T23:28:22.606384\nException caught: (pants.build_graph.address_lookup_error.AddressLookupError)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module>\n main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main\n PantsLoader.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run\n cls.load_and_execute(entrypoint)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute\n entrypoint_main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main\n PantsRunner(exiter, start_time=start_time).run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run\n return runner.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run\n self._run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run\n goal_runner_result = self._maybe_run_v1(run_tracker, reporting)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1\n return goal_runner_factory.create().run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create\n goals, context = self._setup_context()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context\n self._root_dir\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph\n for _ in graph.inject_roots_closure(target_roots):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure\n for address in self._inject_specs(target_roots.specs):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs\n subjects)\n File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__\n self.gen.throw(type, value, traceback)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context\n \'Build graph construction failed: {} {}\'.format(type(e).__name__, str(e))\n\nException message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer\n\n\n' .pants.d/pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py:151: AssertionError -------------- Captured stdout call -------------- logs/exceptions.84142.log +++ logs/exceptions.84142.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.84142.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.84142.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.84142.log >>> pid: 84142 logs/exceptions.84142.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.84142.log >>> main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.84142.log >>> PantsLoader.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.84142.log >>> cls.load_and_execute(entrypoint) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.84142.log >>> entrypoint_main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.84142.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.84142.log >>> return runner.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.84142.log >>> self._run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.84142.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.84142.log >>> return goal_runner_factory.create().run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.84142.log >>> goals, context = self._setup_context() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.84142.log >>> self._root_dir logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.84142.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.84142.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.84142.log >>> subjects) logs/exceptions.84142.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.84142.log >>> self.gen.throw(type, value, traceback) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.84142.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.84142.log >>> logs/exceptions.84142.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.84142.log >>> logs/exceptions.84142.log --- logs/exceptions.log +++ logs/exceptions.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.log >>> pid: 84142 logs/exceptions.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.log >>> main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.log >>> PantsLoader.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.log >>> cls.load_and_execute(entrypoint) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.log >>> entrypoint_main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.log >>> return runner.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.log >>> self._run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.log >>> return goal_runner_factory.create().run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.log >>> goals, context = self._setup_context() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.log >>> self._root_dir logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.log >>> subjects) logs/exceptions.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.log >>> self.gen.throw(type, value, traceback) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.log >>> logs/exceptions.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.log >>> logs/exceptions.log --- generated xml file: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest/tests.python.pants_test.base.exception_sink_integration/junitxml/TEST-tests.python.pants_test.base.exception_sink_integration.xml ============ slowest 3 test durations ============ 93.67s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt 6.08s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 5.55s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream 1 failed, 5 passed, 1 skipped in 118.85 seconds =
AssertionError
def maybe_launch(cls, options_bootstrapper): """Creates and launches a daemon instance if one does not already exist. :param OptionsBootstrapper options_bootstrapper: The bootstrap options. :returns: A Handle for the running pantsd instance. :rtype: PantsDaemon.Handle """ stub_pantsd = cls.create(options_bootstrapper, full_init=False) with stub_pantsd._services.lifecycle_lock: if stub_pantsd.needs_restart(stub_pantsd.options_fingerprint): # Once we determine we actually need to launch, recreate with full initialization. pantsd = cls.create(options_bootstrapper) return pantsd.launch() else: # We're already launched. return PantsDaemon.Handle( stub_pantsd.await_pid(10), stub_pantsd.read_named_socket("pailgun", int), text_type(stub_pantsd._metadata_base_dir), )
def maybe_launch(cls, options_bootstrapper): """Creates and launches a daemon instance if one does not already exist. :param OptionsBootstrapper options_bootstrapper: The bootstrap options. :returns: A Handle for the running pantsd instance. :rtype: PantsDaemon.Handle """ stub_pantsd = cls.create(options_bootstrapper, full_init=False) with stub_pantsd._services.lifecycle_lock: if stub_pantsd.needs_restart(stub_pantsd.options_fingerprint): # Once we determine we actually need to launch, recreate with full initialization. pantsd = cls.create(options_bootstrapper) return pantsd.launch() else: # We're already launched. return PantsDaemon.Handle( stub_pantsd.await_pid(10), stub_pantsd.read_named_socket("pailgun", int) )
https://github.com/pantsbuild/pants/issues/6847
23:26:42 01:10 [run] ============== test session starts =============== platform darwin -- Python 2.7.10, pytest-3.6.4, py-1.7.0, pluggy-0.7.1 -- /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python cachedir: .pants.d/.pytest_cache rootdir: /Users/travis/build/pantsbuild/pants/.pants.d, inifile: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest-prep/CPython-2.7.10/e241a5f8b7de6d34689cc9307d8d06eb155c7c78/pytest.ini plugins: timeout-1.2.1, cov-2.4.0 collecting ... collected 7 items tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_logs_on_terminate <- ../../../../../../System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/case.py SKIPPED [ 14%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 28%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_keyboardinterrupt_signals <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py FAILED [ 42%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_logs_unhandled_exception <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 57%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 71%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_exiter <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 85%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [100%] ==================== FAILURES ==================== ExceptionSinkIntegrationTest.test_keyboardinterrupt_signals self = <pants_test.base.test_exception_sink_integration.ExceptionSinkIntegrationTest testMethod=test_keyboardinterrupt_signals> def test_keyboardinterrupt_signals(self): for interrupt_signal in [signal.SIGINT, signal.SIGQUIT]: with self._send_signal_to_waiter_handle(interrupt_signal) as (workdir, waiter_run): > self.assertIn('Interrupted by user.\n', waiter_run.stderr_data) E AssertionError: u'Interrupted by user.\n' not found in u'From cffi callback <function extern_clone_val at 0x11098a938>:\nTraceback (most recent call last):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/native.py", line 427, in extern_clone_val\n @ffi.def_extern()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/base/exception_sink.py", line 351, in handle_signal_gracefully\n raise KeyboardInterrupt(\'User interrupted execution with control-c!\')\nKeyboardInterrupt: User interrupted execution with control-c!\ntimestamp: 2018-11-29T23:28:22.606384\nException caught: (pants.build_graph.address_lookup_error.AddressLookupError)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module>\n main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main\n PantsLoader.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run\n cls.load_and_execute(entrypoint)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute\n entrypoint_main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main\n PantsRunner(exiter, start_time=start_time).run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run\n return runner.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run\n self._run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run\n goal_runner_result = self._maybe_run_v1(run_tracker, reporting)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1\n return goal_runner_factory.create().run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create\n goals, context = self._setup_context()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context\n self._root_dir\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph\n for _ in graph.inject_roots_closure(target_roots):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure\n for address in self._inject_specs(target_roots.specs):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs\n subjects)\n File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__\n self.gen.throw(type, value, traceback)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context\n \'Build graph construction failed: {} {}\'.format(type(e).__name__, str(e))\n\nException message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer\n\n\n' .pants.d/pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py:151: AssertionError -------------- Captured stdout call -------------- logs/exceptions.84142.log +++ logs/exceptions.84142.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.84142.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.84142.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.84142.log >>> pid: 84142 logs/exceptions.84142.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.84142.log >>> main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.84142.log >>> PantsLoader.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.84142.log >>> cls.load_and_execute(entrypoint) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.84142.log >>> entrypoint_main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.84142.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.84142.log >>> return runner.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.84142.log >>> self._run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.84142.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.84142.log >>> return goal_runner_factory.create().run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.84142.log >>> goals, context = self._setup_context() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.84142.log >>> self._root_dir logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.84142.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.84142.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.84142.log >>> subjects) logs/exceptions.84142.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.84142.log >>> self.gen.throw(type, value, traceback) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.84142.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.84142.log >>> logs/exceptions.84142.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.84142.log >>> logs/exceptions.84142.log --- logs/exceptions.log +++ logs/exceptions.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.log >>> pid: 84142 logs/exceptions.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.log >>> main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.log >>> PantsLoader.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.log >>> cls.load_and_execute(entrypoint) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.log >>> entrypoint_main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.log >>> return runner.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.log >>> self._run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.log >>> return goal_runner_factory.create().run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.log >>> goals, context = self._setup_context() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.log >>> self._root_dir logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.log >>> subjects) logs/exceptions.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.log >>> self.gen.throw(type, value, traceback) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.log >>> logs/exceptions.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.log >>> logs/exceptions.log --- generated xml file: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest/tests.python.pants_test.base.exception_sink_integration/junitxml/TEST-tests.python.pants_test.base.exception_sink_integration.xml ============ slowest 3 test durations ============ 93.67s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt 6.08s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 5.55s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream 1 failed, 5 passed, 1 skipped in 118.85 seconds =
AssertionError
def launch(self): """Launches pantsd in a subprocess. N.B. This should always be called under care of the `lifecycle_lock`. :returns: A Handle for the pantsd instance. :rtype: PantsDaemon.Handle """ self.terminate(include_watchman=False) self.watchman_launcher.maybe_launch() self._logger.debug("launching pantsd") self.daemon_spawn() # Wait up to 60 seconds for pantsd to write its pidfile. pantsd_pid = self.await_pid(60) listening_port = self.read_named_socket("pailgun", int) self._logger.debug( "pantsd is running at pid {}, pailgun port is {}".format( self.pid, listening_port ) ) return self.Handle(pantsd_pid, listening_port, text_type(self._metadata_base_dir))
def launch(self): """Launches pantsd in a subprocess. N.B. This should always be called under care of the `lifecycle_lock`. :returns: A Handle for the pantsd instance. :rtype: PantsDaemon.Handle """ self.terminate(include_watchman=False) self.watchman_launcher.maybe_launch() self._logger.debug("launching pantsd") self.daemon_spawn() # Wait up to 60 seconds for pantsd to write its pidfile. pantsd_pid = self.await_pid(60) listening_port = self.read_named_socket("pailgun", int) self._logger.debug( "pantsd is running at pid {}, pailgun port is {}".format( self.pid, listening_port ) ) return self.Handle(pantsd_pid, listening_port)
https://github.com/pantsbuild/pants/issues/6847
23:26:42 01:10 [run] ============== test session starts =============== platform darwin -- Python 2.7.10, pytest-3.6.4, py-1.7.0, pluggy-0.7.1 -- /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python cachedir: .pants.d/.pytest_cache rootdir: /Users/travis/build/pantsbuild/pants/.pants.d, inifile: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest-prep/CPython-2.7.10/e241a5f8b7de6d34689cc9307d8d06eb155c7c78/pytest.ini plugins: timeout-1.2.1, cov-2.4.0 collecting ... collected 7 items tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_logs_on_terminate <- ../../../../../../System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/case.py SKIPPED [ 14%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 28%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_keyboardinterrupt_signals <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py FAILED [ 42%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_logs_unhandled_exception <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 57%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 71%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_exiter <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 85%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [100%] ==================== FAILURES ==================== ExceptionSinkIntegrationTest.test_keyboardinterrupt_signals self = <pants_test.base.test_exception_sink_integration.ExceptionSinkIntegrationTest testMethod=test_keyboardinterrupt_signals> def test_keyboardinterrupt_signals(self): for interrupt_signal in [signal.SIGINT, signal.SIGQUIT]: with self._send_signal_to_waiter_handle(interrupt_signal) as (workdir, waiter_run): > self.assertIn('Interrupted by user.\n', waiter_run.stderr_data) E AssertionError: u'Interrupted by user.\n' not found in u'From cffi callback <function extern_clone_val at 0x11098a938>:\nTraceback (most recent call last):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/native.py", line 427, in extern_clone_val\n @ffi.def_extern()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/base/exception_sink.py", line 351, in handle_signal_gracefully\n raise KeyboardInterrupt(\'User interrupted execution with control-c!\')\nKeyboardInterrupt: User interrupted execution with control-c!\ntimestamp: 2018-11-29T23:28:22.606384\nException caught: (pants.build_graph.address_lookup_error.AddressLookupError)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module>\n main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main\n PantsLoader.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run\n cls.load_and_execute(entrypoint)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute\n entrypoint_main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main\n PantsRunner(exiter, start_time=start_time).run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run\n return runner.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run\n self._run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run\n goal_runner_result = self._maybe_run_v1(run_tracker, reporting)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1\n return goal_runner_factory.create().run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create\n goals, context = self._setup_context()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context\n self._root_dir\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph\n for _ in graph.inject_roots_closure(target_roots):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure\n for address in self._inject_specs(target_roots.specs):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs\n subjects)\n File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__\n self.gen.throw(type, value, traceback)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context\n \'Build graph construction failed: {} {}\'.format(type(e).__name__, str(e))\n\nException message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer\n\n\n' .pants.d/pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py:151: AssertionError -------------- Captured stdout call -------------- logs/exceptions.84142.log +++ logs/exceptions.84142.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.84142.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.84142.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.84142.log >>> pid: 84142 logs/exceptions.84142.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.84142.log >>> main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.84142.log >>> PantsLoader.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.84142.log >>> cls.load_and_execute(entrypoint) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.84142.log >>> entrypoint_main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.84142.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.84142.log >>> return runner.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.84142.log >>> self._run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.84142.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.84142.log >>> return goal_runner_factory.create().run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.84142.log >>> goals, context = self._setup_context() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.84142.log >>> self._root_dir logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.84142.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.84142.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.84142.log >>> subjects) logs/exceptions.84142.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.84142.log >>> self.gen.throw(type, value, traceback) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.84142.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.84142.log >>> logs/exceptions.84142.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.84142.log >>> logs/exceptions.84142.log --- logs/exceptions.log +++ logs/exceptions.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.log >>> pid: 84142 logs/exceptions.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.log >>> main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.log >>> PantsLoader.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.log >>> cls.load_and_execute(entrypoint) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.log >>> entrypoint_main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.log >>> return runner.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.log >>> self._run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.log >>> return goal_runner_factory.create().run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.log >>> goals, context = self._setup_context() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.log >>> self._root_dir logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.log >>> subjects) logs/exceptions.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.log >>> self.gen.throw(type, value, traceback) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.log >>> logs/exceptions.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.log >>> logs/exceptions.log --- generated xml file: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest/tests.python.pants_test.base.exception_sink_integration/junitxml/TEST-tests.python.pants_test.base.exception_sink_integration.xml ============ slowest 3 test durations ============ 93.67s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt 6.08s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 5.55s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream 1 failed, 5 passed, 1 skipped in 118.85 seconds =
AssertionError
def __init__(self, message="", exit_code=PANTS_FAILED_EXIT_CODE): """ :param int exit_code: an optional exit code (defaults to PANTS_FAILED_EXIT_CODE) """ super(GracefulTerminationException, self).__init__(message) if exit_code == PANTS_SUCCEEDED_EXIT_CODE: raise ValueError( "Cannot create GracefulTerminationException with a successful exit code of {}".format( PANTS_SUCCEEDED_EXIT_CODE ) ) self._exit_code = exit_code
def __init__(self, message="", exit_code=1): """ :param int exit_code: an optional exit code (default=1) """ super(GracefulTerminationException, self).__init__(message) if exit_code == 0: raise ValueError( "Cannot create GracefulTerminationException with exit code of 0" ) self._exit_code = exit_code
https://github.com/pantsbuild/pants/issues/6847
23:26:42 01:10 [run] ============== test session starts =============== platform darwin -- Python 2.7.10, pytest-3.6.4, py-1.7.0, pluggy-0.7.1 -- /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python cachedir: .pants.d/.pytest_cache rootdir: /Users/travis/build/pantsbuild/pants/.pants.d, inifile: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest-prep/CPython-2.7.10/e241a5f8b7de6d34689cc9307d8d06eb155c7c78/pytest.ini plugins: timeout-1.2.1, cov-2.4.0 collecting ... collected 7 items tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_logs_on_terminate <- ../../../../../../System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/case.py SKIPPED [ 14%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 28%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_keyboardinterrupt_signals <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py FAILED [ 42%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_logs_unhandled_exception <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 57%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 71%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_exiter <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [ 85%] tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream <- pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py PASSED [100%] ==================== FAILURES ==================== ExceptionSinkIntegrationTest.test_keyboardinterrupt_signals self = <pants_test.base.test_exception_sink_integration.ExceptionSinkIntegrationTest testMethod=test_keyboardinterrupt_signals> def test_keyboardinterrupt_signals(self): for interrupt_signal in [signal.SIGINT, signal.SIGQUIT]: with self._send_signal_to_waiter_handle(interrupt_signal) as (workdir, waiter_run): > self.assertIn('Interrupted by user.\n', waiter_run.stderr_data) E AssertionError: u'Interrupted by user.\n' not found in u'From cffi callback <function extern_clone_val at 0x11098a938>:\nTraceback (most recent call last):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/native.py", line 427, in extern_clone_val\n @ffi.def_extern()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/base/exception_sink.py", line 351, in handle_signal_gracefully\n raise KeyboardInterrupt(\'User interrupted execution with control-c!\')\nKeyboardInterrupt: User interrupted execution with control-c!\ntimestamp: 2018-11-29T23:28:22.606384\nException caught: (pants.build_graph.address_lookup_error.AddressLookupError)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module>\n main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main\n PantsLoader.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run\n cls.load_and_execute(entrypoint)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute\n entrypoint_main()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main\n PantsRunner(exiter, start_time=start_time).run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run\n return runner.run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run\n self._run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run\n goal_runner_result = self._maybe_run_v1(run_tracker, reporting)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1\n return goal_runner_factory.create().run()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create\n goals, context = self._setup_context()\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context\n self._root_dir\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph\n for _ in graph.inject_roots_closure(target_roots):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure\n for address in self._inject_specs(target_roots.specs):\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs\n subjects)\n File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__\n self.gen.throw(type, value, traceback)\n File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context\n \'Build graph construction failed: {} {}\'.format(type(e).__name__, str(e))\n\nException message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer\n\n\n' .pants.d/pyprep/sources/4d9f3a72ced4c3b5cabbfead9552e9e3e78a30ca/pants_test/base/test_exception_sink_integration.py:151: AssertionError -------------- Captured stdout call -------------- logs/exceptions.84142.log +++ logs/exceptions.84142.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.84142.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.84142.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.84142.log >>> pid: 84142 logs/exceptions.84142.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.84142.log >>> main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.84142.log >>> PantsLoader.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.84142.log >>> cls.load_and_execute(entrypoint) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.84142.log >>> entrypoint_main() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.84142.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.84142.log >>> return runner.run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.84142.log >>> self._run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.84142.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.84142.log >>> return goal_runner_factory.create().run() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.84142.log >>> goals, context = self._setup_context() logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.84142.log >>> self._root_dir logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.84142.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.84142.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.84142.log >>> subjects) logs/exceptions.84142.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.84142.log >>> self.gen.throw(type, value, traceback) logs/exceptions.84142.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.84142.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.84142.log >>> logs/exceptions.84142.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.84142.log >>> logs/exceptions.84142.log --- logs/exceptions.log +++ logs/exceptions.log >>> timestamp: 2018-11-29T23:28:22.605908 logs/exceptions.log >>> process title: python /Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py --no-pantsrc --pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d --kill-nailguns --print-exception-stacktrace=True --no-enable-pantsd run testprojects/src/python/coordinated_runs:waiter -- /var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file logs/exceptions.log >>> sys.argv: ['/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py', '--no-pantsrc', '--pants-workdir=/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/.pants.d', '--kill-nailguns', '--print-exception-stacktrace=True', '--no-enable-pantsd', 'run', 'testprojects/src/python/coordinated_runs:waiter', '--', '/var/folders/bb/n7t3rs157850byt_jfdcq9k80000gn/T/tmpxqSksJ/some_file'] logs/exceptions.log >>> pid: 84142 logs/exceptions.log >>> Exception caught: (pants.build_graph.address_lookup_error.AddressLookupError) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 75, in <module> logs/exceptions.log >>> main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 71, in main logs/exceptions.log >>> PantsLoader.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 67, in run logs/exceptions.log >>> cls.load_and_execute(entrypoint) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_loader.py", line 60, in load_and_execute logs/exceptions.log >>> entrypoint_main() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_exe.py", line 39, in main logs/exceptions.log >>> PantsRunner(exiter, start_time=start_time).run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/pants_runner.py", line 62, in run logs/exceptions.log >>> return runner.run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 159, in run logs/exceptions.log >>> self._run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 227, in _run logs/exceptions.log >>> goal_runner_result = self._maybe_run_v1(run_tracker, reporting) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/local_pants_runner.py", line 176, in _maybe_run_v1 logs/exceptions.log >>> return goal_runner_factory.create().run() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 125, in create logs/exceptions.log >>> goals, context = self._setup_context() logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/bin/goal_runner.py", line 95, in _setup_context logs/exceptions.log >>> self._root_dir logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 226, in create_build_graph logs/exceptions.log >>> for _ in graph.inject_roots_closure(target_roots): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 217, in inject_roots_closure logs/exceptions.log >>> for address in self._inject_specs(target_roots.specs): logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 270, in _inject_specs logs/exceptions.log >>> subjects) logs/exceptions.log >>> File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__ logs/exceptions.log >>> self.gen.throw(type, value, traceback) logs/exceptions.log >>> File "/Users/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 237, in _resolve_context logs/exceptions.log >>> 'Build graph construction failed: {} {}'.format(type(e).__name__, str(e)) logs/exceptions.log >>> logs/exceptions.log >>> Exception message: Build graph construction failed: RuntimeError cannot use from_handle() on NULL pointer logs/exceptions.log >>> logs/exceptions.log --- generated xml file: /Users/travis/build/pantsbuild/pants/.pants.d/test/pytest/tests.python.pants_test.base.exception_sink_integration/junitxml/TEST-tests.python.pants_test.base.exception_sink_integration.xml ============ slowest 3 test durations ============ 93.67s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_dumps_traceback_on_sigabrt 6.08s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_prints_traceback_on_sigusr2 5.55s call ../tests/python/pants_test/base/test_exception_sink_integration.py::ExceptionSinkIntegrationTest::test_reset_interactive_output_stream 1 failed, 5 passed, 1 skipped in 118.85 seconds =
AssertionError
def setup_logging(level, console_stream=None, log_dir=None, scope=None, log_name=None): """Configures logging for a given scope, by default the global scope. :param str level: The logging level to enable, must be one of the level names listed here: https://docs.python.org/2/library/logging.html#levels :param file console_stream: The stream to use for default (console) logging. If None (default), this will disable console logging. :param str log_dir: An optional directory to emit logs files in. If unspecified, no disk logging will occur. If supplied, the directory will be created if it does not already exist and all logs will be tee'd to a rolling set of log files in that directory. :param str scope: A logging scope to configure. The scopes are hierarchichal logger names, with The '.' separator providing the scope hierarchy. By default the root logger is configured. :param str log_name: The base name of the log file (defaults to 'pants.log'). :returns: The full path to the main log file if file logging is configured or else `None`. :rtype: str """ # TODO(John Sirois): Consider moving to straight python logging. The divide between the # context/work-unit logging and standard python logging doesn't buy us anything. # TODO(John Sirois): Support logging.config.fileConfig so a site can setup fine-grained # logging control and we don't need to be the middleman plumbing an option for each python # standard logging knob. log_filename = None file_handler = None logger = logging.getLogger(scope) for handler in logger.handlers: logger.removeHandler(handler) if console_stream: console_handler = StreamHandler(stream=console_stream) console_handler.setFormatter(Formatter(fmt="%(levelname)s] %(message)s")) console_handler.setLevel(level) logger.addHandler(console_handler) if log_dir: safe_mkdir(log_dir) log_filename = os.path.join(log_dir, log_name or "pants.log") file_handler = FileHandler(log_filename) class GlogFormatter(Formatter): LEVEL_MAP = { logging.FATAL: "F", logging.ERROR: "E", logging.WARN: "W", logging.INFO: "I", logging.DEBUG: "D", } def format(self, record): datetime = time.strftime( "%m%d %H:%M:%S", time.localtime(record.created) ) micros = int((record.created - int(record.created)) * 1e6) return "{levelchar}{datetime}.{micros:06d} {process} {filename}:{lineno}] {msg}".format( levelchar=self.LEVEL_MAP[record.levelno], datetime=datetime, micros=micros, process=record.process, filename=record.filename, lineno=record.lineno, msg=record.getMessage(), ) file_handler.setFormatter(GlogFormatter()) file_handler.setLevel(level) logger.addHandler(file_handler) logger.setLevel(level) # This routes warnings through our loggers instead of straight to raw stderr. logging.captureWarnings(True) return LoggingSetupResult(log_filename, file_handler)
def setup_logging(level, console_stream=None, log_dir=None, scope=None, log_name=None): """Configures logging for a given scope, by default the global scope. :param str level: The logging level to enable, must be one of the level names listed here: https://docs.python.org/2/library/logging.html#levels :param file console_stream: The stream to use for default (console) logging. If None (default), this will disable console logging. :param str log_dir: An optional directory to emit logs files in. If unspecified, no disk logging will occur. If supplied, the directory will be created if it does not already exist and all logs will be tee'd to a rolling set of log files in that directory. :param str scope: A logging scope to configure. The scopes are hierarchichal logger names, with The '.' separator providing the scope hierarchy. By default the root logger is configured. :param str log_name: The base name of the log file (defaults to 'pants.log'). :returns: The full path to the main log file if file logging is configured or else `None`. :rtype: str """ # TODO(John Sirois): Consider moving to straight python logging. The divide between the # context/work-unit logging and standard python logging doesn't buy us anything. # TODO(John Sirois): Support logging.config.fileConfig so a site can setup fine-grained # logging control and we don't need to be the middleman plumbing an option for each python # standard logging knob. log_filename = None log_stream = None logger = logging.getLogger(scope) for handler in logger.handlers: logger.removeHandler(handler) if console_stream: console_handler = StreamHandler(stream=console_stream) console_handler.setFormatter(Formatter(fmt="%(levelname)s] %(message)s")) console_handler.setLevel(level) logger.addHandler(console_handler) if log_dir: safe_mkdir(log_dir) log_filename = os.path.join(log_dir, log_name or "pants.log") file_handler = RotatingFileHandler( log_filename, maxBytes=10 * 1024 * 1024, backupCount=4 ) log_stream = file_handler.stream class GlogFormatter(Formatter): LEVEL_MAP = { logging.FATAL: "F", logging.ERROR: "E", logging.WARN: "W", logging.INFO: "I", logging.DEBUG: "D", } def format(self, record): datetime = time.strftime( "%m%d %H:%M:%S", time.localtime(record.created) ) micros = int((record.created - int(record.created)) * 1e6) return "{levelchar}{datetime}.{micros:06d} {process} {filename}:{lineno}] {msg}".format( levelchar=self.LEVEL_MAP[record.levelno], datetime=datetime, micros=micros, process=record.process, filename=record.filename, lineno=record.lineno, msg=record.getMessage(), ) file_handler.setFormatter(GlogFormatter()) file_handler.setLevel(level) logger.addHandler(file_handler) logger.setLevel(level) # This routes warnings through our loggers instead of straight to raw stderr. logging.captureWarnings(True) return LoggingSetupResult(log_filename, log_stream)
https://github.com/pantsbuild/pants/issues/5354
F0117 15:10:04.500231 12664 process_manager.py:463] Traceback (most recent call last): File "/Users/redacted/.pex/install/pantsbuild.pants-1.4.0.dev20+3346017507-cp27-none-macosx_10_8_x86_64.whl.ac6c80da047e6ed09228262b774906b65ebf6918/pantsbuild.pants-1.4.0.dev20+3346017507-cp27-none-macosx_10_8_x86_64.whl/pants/pantsd/process_manager.py", line 461, in daemonize self.post_fork_child(**post_fork_child_opts or {}) File "/Users/redacted/.pex/install/pantsbuild.pants-1.4.0.dev20+3346017507-cp27-none-macosx_10_8_x86_64.whl.ac6c80da047e6ed09228262b774906b65ebf6918/pantsbuild.pants-1.4.0.dev20+3346017507-cp27-none-macosx_10_8_x86_64.whl/pants/bin/daemon_pants_runner.py", line 172, in post_fork_child self._exiter.set_except_hook(sys.stderr) File "/Users/redacted/.pex/install/pantsbuild.pants-1.4.0.dev20+3346017507-cp27-none-macosx_10_8_x86_64.whl.ac6c80da047e6ed09228262b774906b65ebf6918/pantsbuild.pants-1.4.0.dev20+3346017507-cp27-none-macosx_10_8_x86_64.whl/pants/base/exiter.py", line 123, in set_except_hook self._setup_faulthandler(trace_stream or sys.stderr) File "/Users/redacted/.pex/install/pantsbuild.pants-1.4.0.dev20+3346017507-cp27-none-macosx_10_8_x86_64.whl.ac6c80da047e6ed09228262b774906b65ebf6918/pantsbuild.pants-1.4.0.dev20+3346017507-cp27-none-macosx_10_8_x86_64.whl/pants/base/exiter.py", line 117, in _setup_faulthandler faulthandler.enable(trace_stream) File "/Users/redacted/.pex/install/pantsbuild.pants-1.4.0.dev20+3346017507-cp27-none-macosx_10_8_x86_64.whl.ac6c80da047e6ed09228262b774906b65ebf6918/pantsbuild.pants-1.4.0.dev20+3346017507-cp27-none-macosx_10_8_x86_64.whl/pants/pantsd/pants_daemon.py", line 61, in fileno return self._stream.fileno() ValueError: I/O operation on closed file
ValueError
def __init__(self, logger, log_level, handler): """ :param logging.Logger logger: The logger instance to emit writes to. :param int log_level: The log level to use for the given logger. :param Handler handler: The underlying log handler, for determining the fileno to support faulthandler logging. """ self._logger = logger self._log_level = log_level self._handler = handler
def __init__(self, logger, log_level, logger_stream): """ :param logging.Logger logger: The logger instance to emit writes to. :param int log_level: The log level to use for the given logger. :param file logger_stream: The underlying file object the logger is writing to, for determining the fileno to support faulthandler logging. """ self._logger = logger self._log_level = log_level self._stream = logger_stream
https://github.com/pantsbuild/pants/issues/5354
F0117 15:10:04.500231 12664 process_manager.py:463] Traceback (most recent call last): File "/Users/redacted/.pex/install/pantsbuild.pants-1.4.0.dev20+3346017507-cp27-none-macosx_10_8_x86_64.whl.ac6c80da047e6ed09228262b774906b65ebf6918/pantsbuild.pants-1.4.0.dev20+3346017507-cp27-none-macosx_10_8_x86_64.whl/pants/pantsd/process_manager.py", line 461, in daemonize self.post_fork_child(**post_fork_child_opts or {}) File "/Users/redacted/.pex/install/pantsbuild.pants-1.4.0.dev20+3346017507-cp27-none-macosx_10_8_x86_64.whl.ac6c80da047e6ed09228262b774906b65ebf6918/pantsbuild.pants-1.4.0.dev20+3346017507-cp27-none-macosx_10_8_x86_64.whl/pants/bin/daemon_pants_runner.py", line 172, in post_fork_child self._exiter.set_except_hook(sys.stderr) File "/Users/redacted/.pex/install/pantsbuild.pants-1.4.0.dev20+3346017507-cp27-none-macosx_10_8_x86_64.whl.ac6c80da047e6ed09228262b774906b65ebf6918/pantsbuild.pants-1.4.0.dev20+3346017507-cp27-none-macosx_10_8_x86_64.whl/pants/base/exiter.py", line 123, in set_except_hook self._setup_faulthandler(trace_stream or sys.stderr) File "/Users/redacted/.pex/install/pantsbuild.pants-1.4.0.dev20+3346017507-cp27-none-macosx_10_8_x86_64.whl.ac6c80da047e6ed09228262b774906b65ebf6918/pantsbuild.pants-1.4.0.dev20+3346017507-cp27-none-macosx_10_8_x86_64.whl/pants/base/exiter.py", line 117, in _setup_faulthandler faulthandler.enable(trace_stream) File "/Users/redacted/.pex/install/pantsbuild.pants-1.4.0.dev20+3346017507-cp27-none-macosx_10_8_x86_64.whl.ac6c80da047e6ed09228262b774906b65ebf6918/pantsbuild.pants-1.4.0.dev20+3346017507-cp27-none-macosx_10_8_x86_64.whl/pants/pantsd/pants_daemon.py", line 61, in fileno return self._stream.fileno() ValueError: I/O operation on closed file
ValueError
def fileno(self): return self._handler.stream.fileno()
def fileno(self): return self._stream.fileno()
https://github.com/pantsbuild/pants/issues/5354
F0117 15:10:04.500231 12664 process_manager.py:463] Traceback (most recent call last): File "/Users/redacted/.pex/install/pantsbuild.pants-1.4.0.dev20+3346017507-cp27-none-macosx_10_8_x86_64.whl.ac6c80da047e6ed09228262b774906b65ebf6918/pantsbuild.pants-1.4.0.dev20+3346017507-cp27-none-macosx_10_8_x86_64.whl/pants/pantsd/process_manager.py", line 461, in daemonize self.post_fork_child(**post_fork_child_opts or {}) File "/Users/redacted/.pex/install/pantsbuild.pants-1.4.0.dev20+3346017507-cp27-none-macosx_10_8_x86_64.whl.ac6c80da047e6ed09228262b774906b65ebf6918/pantsbuild.pants-1.4.0.dev20+3346017507-cp27-none-macosx_10_8_x86_64.whl/pants/bin/daemon_pants_runner.py", line 172, in post_fork_child self._exiter.set_except_hook(sys.stderr) File "/Users/redacted/.pex/install/pantsbuild.pants-1.4.0.dev20+3346017507-cp27-none-macosx_10_8_x86_64.whl.ac6c80da047e6ed09228262b774906b65ebf6918/pantsbuild.pants-1.4.0.dev20+3346017507-cp27-none-macosx_10_8_x86_64.whl/pants/base/exiter.py", line 123, in set_except_hook self._setup_faulthandler(trace_stream or sys.stderr) File "/Users/redacted/.pex/install/pantsbuild.pants-1.4.0.dev20+3346017507-cp27-none-macosx_10_8_x86_64.whl.ac6c80da047e6ed09228262b774906b65ebf6918/pantsbuild.pants-1.4.0.dev20+3346017507-cp27-none-macosx_10_8_x86_64.whl/pants/base/exiter.py", line 117, in _setup_faulthandler faulthandler.enable(trace_stream) File "/Users/redacted/.pex/install/pantsbuild.pants-1.4.0.dev20+3346017507-cp27-none-macosx_10_8_x86_64.whl.ac6c80da047e6ed09228262b774906b65ebf6918/pantsbuild.pants-1.4.0.dev20+3346017507-cp27-none-macosx_10_8_x86_64.whl/pants/pantsd/pants_daemon.py", line 61, in fileno return self._stream.fileno() ValueError: I/O operation on closed file
ValueError
def _pantsd_logging(self): """A context manager that runs with pantsd logging. Asserts that stdio (represented by file handles 0, 1, 2) is closed to ensure that we can safely reuse those fd numbers. """ # Ensure that stdio is closed so that we can safely reuse those file descriptors. for fd in (0, 1, 2): try: os.fdopen(fd) raise AssertionError( "pantsd logging cannot initialize while stdio is open: {}".format(fd) ) except OSError: pass # Redirect stdio to /dev/null for the rest of the run, to reserve those file descriptors # for further forks. with stdio_as(stdin_fd=-1, stdout_fd=-1, stderr_fd=-1): # Reinitialize logging for the daemon context. result = setup_logging( self._log_level, log_dir=self._log_dir, log_name=self.LOG_NAME ) # Do a python-level redirect of stdout/stderr, which will not disturb `0,1,2`. # TODO: Consider giving these pipes/actual fds, in order to make them "deep" replacements # for `1,2`, and allow them to be used via `stdio_as`. sys.stdout = _LoggerStream( logging.getLogger(), logging.INFO, result.log_handler ) sys.stderr = _LoggerStream( logging.getLogger(), logging.WARN, result.log_handler ) self._logger.debug("logging initialized") yield result.log_handler.stream
def _pantsd_logging(self): """A context manager that runs with pantsd logging. Asserts that stdio (represented by file handles 0, 1, 2) is closed to ensure that we can safely reuse those fd numbers. """ # Ensure that stdio is closed so that we can safely reuse those file descriptors. for fd in (0, 1, 2): try: os.fdopen(fd) raise AssertionError( "pantsd logging cannot initialize while stdio is open: {}".format(fd) ) except OSError: pass # Redirect stdio to /dev/null for the rest of the run, to reserve those file descriptors # for further forks. with stdio_as(stdin_fd=-1, stdout_fd=-1, stderr_fd=-1): # Reinitialize logging for the daemon context. result = setup_logging( self._log_level, log_dir=self._log_dir, log_name=self.LOG_NAME ) # Do a python-level redirect of stdout/stderr, which will not disturb `0,1,2`. # TODO: Consider giving these pipes/actual fds, in order to make them "deep" replacements # for `1,2`, and allow them to be used via `stdio_as`. sys.stdout = _LoggerStream(logging.getLogger(), logging.INFO, result.log_stream) sys.stderr = _LoggerStream(logging.getLogger(), logging.WARN, result.log_stream) self._logger.debug("logging initialized") yield result.log_stream
https://github.com/pantsbuild/pants/issues/5354
F0117 15:10:04.500231 12664 process_manager.py:463] Traceback (most recent call last): File "/Users/redacted/.pex/install/pantsbuild.pants-1.4.0.dev20+3346017507-cp27-none-macosx_10_8_x86_64.whl.ac6c80da047e6ed09228262b774906b65ebf6918/pantsbuild.pants-1.4.0.dev20+3346017507-cp27-none-macosx_10_8_x86_64.whl/pants/pantsd/process_manager.py", line 461, in daemonize self.post_fork_child(**post_fork_child_opts or {}) File "/Users/redacted/.pex/install/pantsbuild.pants-1.4.0.dev20+3346017507-cp27-none-macosx_10_8_x86_64.whl.ac6c80da047e6ed09228262b774906b65ebf6918/pantsbuild.pants-1.4.0.dev20+3346017507-cp27-none-macosx_10_8_x86_64.whl/pants/bin/daemon_pants_runner.py", line 172, in post_fork_child self._exiter.set_except_hook(sys.stderr) File "/Users/redacted/.pex/install/pantsbuild.pants-1.4.0.dev20+3346017507-cp27-none-macosx_10_8_x86_64.whl.ac6c80da047e6ed09228262b774906b65ebf6918/pantsbuild.pants-1.4.0.dev20+3346017507-cp27-none-macosx_10_8_x86_64.whl/pants/base/exiter.py", line 123, in set_except_hook self._setup_faulthandler(trace_stream or sys.stderr) File "/Users/redacted/.pex/install/pantsbuild.pants-1.4.0.dev20+3346017507-cp27-none-macosx_10_8_x86_64.whl.ac6c80da047e6ed09228262b774906b65ebf6918/pantsbuild.pants-1.4.0.dev20+3346017507-cp27-none-macosx_10_8_x86_64.whl/pants/base/exiter.py", line 117, in _setup_faulthandler faulthandler.enable(trace_stream) File "/Users/redacted/.pex/install/pantsbuild.pants-1.4.0.dev20+3346017507-cp27-none-macosx_10_8_x86_64.whl.ac6c80da047e6ed09228262b774906b65ebf6918/pantsbuild.pants-1.4.0.dev20+3346017507-cp27-none-macosx_10_8_x86_64.whl/pants/pantsd/pants_daemon.py", line 61, in fileno return self._stream.fileno() ValueError: I/O operation on closed file
ValueError
def execute(self): binary = self.require_single_root_target() if isinstance(binary, PythonBinary): # We can't throw if binary isn't a PythonBinary, because perhaps we were called on a # jvm_binary, in which case we have to no-op and let jvm_run do its thing. # TODO(benjy): Use MutexTask to coordinate this. pex = self.create_pex(binary.pexinfo) self.context.release_lock() with self.context.new_workunit(name="run", labels=[WorkUnitLabel.RUN]): args = [] for arg in self.get_options().args: args.extend(safe_shlex_split(arg)) args += self.get_passthru_args() po = pex.run(blocking=False, args=args, env=os.environ.copy()) try: result = po.wait() if result != 0: msg = "{interpreter} {entry_point} {args} ... exited non-zero ({code})".format( interpreter=pex.interpreter.binary, entry_point=binary.entry_point, args=" ".join(args), code=result, ) raise TaskError(msg, exit_code=result) except KeyboardInterrupt: po.send_signal(signal.SIGINT) raise
def execute(self): binary = self.require_single_root_target() if isinstance(binary, PythonBinary): # We can't throw if binary isn't a PythonBinary, because perhaps we were called on a # jvm_binary, in which case we have to no-op and let jvm_run do its thing. # TODO(benjy): Use MutexTask to coordinate this. pex = self.create_pex(binary.pexinfo) self.context.release_lock() with self.context.new_workunit(name="run", labels=[WorkUnitLabel.RUN]): args = [] for arg in self.get_options().args: args.extend(safe_shlex_split(arg)) args += self.get_passthru_args() po = pex.run(blocking=False, args=args) try: result = po.wait() if result != 0: msg = "{interpreter} {entry_point} {args} ... exited non-zero ({code})".format( interpreter=pex.interpreter.binary, entry_point=binary.entry_point, args=" ".join(args), code=result, ) raise TaskError(msg, exit_code=result) except KeyboardInterrupt: po.send_signal(signal.SIGINT) raise
https://github.com/pantsbuild/pants/issues/4590
Traceback (most recent call last): File "/Users/mike/code/fr/source/.pants.d/run/py/CPython-2.7.10/f4fb689ebb3890a4f8f61526b64dbf8f00714968-DefaultFingerprintStrategy_4fa5ce70a419/.bootstrap/_pex/pex.py", line 360, in execute self._wrap_coverage(self._wrap_profiling, self._execute) File "/Users/mike/code/fr/source/.pants.d/run/py/CPython-2.7.10/f4fb689ebb3890a4f8f61526b64dbf8f00714968-DefaultFingerprintStrategy_4fa5ce70a419/.bootstrap/_pex/pex.py", line 288, in _wrap_coverage runner(*args) File "/Users/mike/code/fr/source/.pants.d/run/py/CPython-2.7.10/f4fb689ebb3890a4f8f61526b64dbf8f00714968-DefaultFingerprintStrategy_4fa5ce70a419/.bootstrap/_pex/pex.py", line 320, in _wrap_profiling runner(*args) File "/Users/mike/code/fr/source/.pants.d/run/py/CPython-2.7.10/f4fb689ebb3890a4f8f61526b64dbf8f00714968-DefaultFingerprintStrategy_4fa5ce70a419/.bootstrap/_pex/pex.py", line 403, in _execute return self.execute_entry(self._pex_info.entry_point) File "/Users/mike/code/fr/source/.pants.d/run/py/CPython-2.7.10/f4fb689ebb3890a4f8f61526b64dbf8f00714968-DefaultFingerprintStrategy_4fa5ce70a419/.bootstrap/_pex/pex.py", line 461, in execute_entry return runner(entry_point) File "/Users/mike/code/fr/source/.pants.d/run/py/CPython-2.7.10/f4fb689ebb3890a4f8f61526b64dbf8f00714968-DefaultFingerprintStrategy_4fa5ce70a419/.bootstrap/_pex/pex.py", line 466, in execute_module runpy.run_module(module_name, run_name='__main__') File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 180, in run_module fname, loader, pkg_name) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/Users/mike/code/fr/source/.pants.d/pyprep/sources/f4fb689ebb3890a4f8f61526b64dbf8f00714968-DefaultFingerprintStrategy_898c4dfd47d2/env_var.py", line 3, in <module> print(os.environ['SHELL']) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/UserDict.py", line 23, in __getitem__ raise KeyError(key) KeyError: 'SHELL' FAILURE: /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 env_var ... exited non-zero (1)
KeyError
def create_graph(self, spec_roots): """Construct and return a BuildGraph given a set of input specs.""" graph = self.legacy_graph_cls(self.scheduler, self.engine, self.symbol_table_cls) with self.scheduler.locked(): for _ in graph.inject_specs_closure( spec_roots ): # Ensure the entire generator is unrolled. pass logger.debug("engine cache stats: %s", self.engine.cache_stats()) logger.debug("build_graph is: %s", graph) return graph
def create_graph(self, spec_roots): """Construct and return a BuildGraph given a set of input specs.""" graph = self.legacy_graph_cls(self.scheduler, self.engine, self.symbol_table_cls) for _ in graph.inject_specs_closure( spec_roots ): # Ensure the entire generator is unrolled. pass logger.debug("engine cache stats: %s", self.engine.cache_stats()) logger.debug("build_graph is: %s", graph) return graph
https://github.com/pantsbuild/pants/issues/3565
W0602 21:35:21.260252 22326 pailgun_service.py:69] encountered exception during SchedulerService.get_build_graph(): Traceback (most recent call last): File "/home/travis/build/pantsbuild/pants/src/python/pants/pantsd/service/pailgun_service.py", line 65, in runner_factory build_graph = self._scheduler_service.get_build_graph(spec_roots) File "/home/travis/build/pantsbuild/pants/src/python/pants/pantsd/service/scheduler_service.py", line 84, in get_build_graph return self._graph_helper.create_graph(spec_roots) File "/home/travis/build/pantsbuild/pants/src/python/pants/bin/engine_initializer.py", line 64, in create_graph for _ in graph.inject_specs_closure(spec_roots): # Ensure the entire generator is unrolled. File "/home/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 169, in inject_specs_closure for address in self._inject(specs): File "/home/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 185, in _inject entries = maybe_list(state.value, expected_type=LegacyTarget) AttributeError: 'NoneType' object has no attribute 'value'
AttributeError
def __init__( self, server_address, runner_factory, context_lock, handler_class=None, bind_and_activate=True, ): """Override of TCPServer.__init__(). N.B. the majority of this function is copied verbatim from TCPServer.__init__(). :param tuple server_address: An address tuple of (hostname, port) for socket.bind(). :param class runner_factory: A factory function for creating a DaemonPantsRunner for each run. :param func context_lock: A contextmgr that will be used as a lock during request handling/forking. :param class handler_class: The request handler class to use for each request. (Optional) :param bool bind_and_activate: If True, binds and activates networking at __init__ time. (Optional) """ # Old-style class, so we must invoke __init__() this way. BaseServer.__init__(self, server_address, handler_class or PailgunHandler) self.socket = RecvBufferedSocket( socket.socket(self.address_family, self.socket_type) ) self.runner_factory = runner_factory self.allow_reuse_address = True # Allow quick reuse of TCP_WAIT sockets. self.server_port = None # Set during server_bind() once the port is bound. self._context_lock = context_lock if bind_and_activate: try: self.server_bind() self.server_activate() except Exception: self.server_close() raise
def __init__( self, server_address, runner_factory, handler_class=None, bind_and_activate=True ): """Override of TCPServer.__init__(). N.B. the majority of this function is copied verbatim from TCPServer.__init__(). :param tuple server_address: An address tuple of (hostname, port) for socket.bind(). :param class runner_factory: A factory function for creating a DaemonPantsRunner for each run. :param class handler_class: The request handler class to use for each request. (Optional) :param bool bind_and_activate: If True, binds and activates networking at __init__ time. (Optional) """ # Old-style class, so we must invoke __init__() this way. BaseServer.__init__(self, server_address, handler_class or PailgunHandler) self.socket = RecvBufferedSocket( socket.socket(self.address_family, self.socket_type) ) self.runner_factory = runner_factory self.allow_reuse_address = True # Allow quick reuse of TCP_WAIT sockets. self.server_port = None # Set during server_bind() once the port is bound. if bind_and_activate: try: self.server_bind() self.server_activate() except Exception: self.server_close() raise
https://github.com/pantsbuild/pants/issues/3565
W0602 21:35:21.260252 22326 pailgun_service.py:69] encountered exception during SchedulerService.get_build_graph(): Traceback (most recent call last): File "/home/travis/build/pantsbuild/pants/src/python/pants/pantsd/service/pailgun_service.py", line 65, in runner_factory build_graph = self._scheduler_service.get_build_graph(spec_roots) File "/home/travis/build/pantsbuild/pants/src/python/pants/pantsd/service/scheduler_service.py", line 84, in get_build_graph return self._graph_helper.create_graph(spec_roots) File "/home/travis/build/pantsbuild/pants/src/python/pants/bin/engine_initializer.py", line 64, in create_graph for _ in graph.inject_specs_closure(spec_roots): # Ensure the entire generator is unrolled. File "/home/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 169, in inject_specs_closure for address in self._inject(specs): File "/home/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 185, in _inject entries = maybe_list(state.value, expected_type=LegacyTarget) AttributeError: 'NoneType' object has no attribute 'value'
AttributeError
def process_request(self, request, client_address): """Override of TCPServer.process_request() that provides for forking request handlers and delegates error handling to the request handler.""" # Instantiate the request handler. handler = self.RequestHandlerClass(request, client_address, self) try: # Attempt to handle a request with the handler under the context_lock. with self._context_lock(): handler.handle_request() except Exception as e: # If that fails, (synchronously) handle the error with the error handler sans-fork. try: handler.handle_error(e) finally: # Shutdown the socket since we don't expect a fork() in the exception context. self.shutdown_request(request) else: # At this point, we expect a fork() has taken place - the parent side will return, and so we # close the request here from the parent without explicitly shutting down the socket. The # child half of this will perform an os._exit() before it gets to this point and is also # responsible for shutdown and closing of the socket when its execution is complete. self.close_request(request)
def process_request(self, request, client_address): """Override of TCPServer.process_request() that provides for forking request handlers and delegates error handling to the request handler.""" # Instantiate the request handler. handler = self.RequestHandlerClass(request, client_address, self) try: # Attempt to handle a request with the handler. handler.handle_request() except Exception as e: # If that fails, (synchronously) handle the error with the error handler sans-fork. try: handler.handle_error(e) finally: # Shutdown the socket since we don't expect a fork() in the exception context. self.shutdown_request(request) else: # At this point, we expect a fork() has taken place - the parent side will return, and so we # close the request here from the parent without explicitly shutting down the socket. The # child half of this will perform an os._exit() before it gets to this point and is also # responsible for shutdown and closing of the socket when its execution is complete. self.close_request(request)
https://github.com/pantsbuild/pants/issues/3565
W0602 21:35:21.260252 22326 pailgun_service.py:69] encountered exception during SchedulerService.get_build_graph(): Traceback (most recent call last): File "/home/travis/build/pantsbuild/pants/src/python/pants/pantsd/service/pailgun_service.py", line 65, in runner_factory build_graph = self._scheduler_service.get_build_graph(spec_roots) File "/home/travis/build/pantsbuild/pants/src/python/pants/pantsd/service/scheduler_service.py", line 84, in get_build_graph return self._graph_helper.create_graph(spec_roots) File "/home/travis/build/pantsbuild/pants/src/python/pants/bin/engine_initializer.py", line 64, in create_graph for _ in graph.inject_specs_closure(spec_roots): # Ensure the entire generator is unrolled. File "/home/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 169, in inject_specs_closure for address in self._inject(specs): File "/home/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 185, in _inject entries = maybe_list(state.value, expected_type=LegacyTarget) AttributeError: 'NoneType' object has no attribute 'value'
AttributeError
def _setup_pailgun(self): """Sets up a PailgunServer instance.""" # Constructs and returns a runnable PantsRunner. def runner_factory(sock, arguments, environment): exiter = self._exiter_class(sock) build_graph = None self._logger.debug("execution commandline: %s", arguments) if self._scheduler_service: # N.B. This parses sys.argv by way of OptionsInitializer/OptionsBootstrapper prior to # the main pants run to derive spec_roots for caching in the underlying scheduler. spec_roots = self._parse_commandline_to_spec_roots(args=arguments) self._logger.debug("parsed spec_roots: %s", spec_roots) try: self._logger.debug( "requesting BuildGraph from %s", self._scheduler_service ) # N.B. This call is made in the pre-fork daemon context for reach and reuse of the # resident scheduler for BuildGraph construction. build_graph = self._scheduler_service.get_build_graph(spec_roots) except Exception: self._logger.warning( "encountered exception during SchedulerService.get_build_graph():\n%s", traceback.format_exc(), ) return self._runner_class(sock, exiter, arguments, environment, build_graph) @contextmanager def context_lock(): """This lock is used to safeguard Pailgun request handling against a fork() with the scheduler lock held by another thread (e.g. the FSEventService thread), which can lead to a pailgun deadlock. """ if self._scheduler_service: with self._scheduler_service.locked(): yield else: yield return PailgunServer(self._bind_addr, runner_factory, context_lock)
def _setup_pailgun(self): """Sets up a PailgunServer instance.""" # Constructs and returns a runnable PantsRunner. def runner_factory(sock, arguments, environment): exiter = self._exiter_class(sock) build_graph = None self._logger.debug("execution commandline: %s", arguments) if self._scheduler_service: # N.B. This parses sys.argv by way of OptionsInitializer/OptionsBootstrapper prior to # the main pants run to derive spec_roots for caching in the underlying scheduler. spec_roots = self._parse_commandline_to_spec_roots(args=arguments) self._logger.debug("parsed spec_roots: %s", spec_roots) try: self._logger.debug( "requesting BuildGraph from %s", self._scheduler_service ) # N.B. This call is made in the pre-fork daemon context for reach and reuse of the # resident scheduler for BuildGraph construction. build_graph = self._scheduler_service.get_build_graph(spec_roots) except Exception: self._logger.warning( "encountered exception during SchedulerService.get_build_graph():\n%s", traceback.format_exc(), ) return self._runner_class(sock, exiter, arguments, environment, build_graph) return PailgunServer(self._bind_addr, runner_factory)
https://github.com/pantsbuild/pants/issues/3565
W0602 21:35:21.260252 22326 pailgun_service.py:69] encountered exception during SchedulerService.get_build_graph(): Traceback (most recent call last): File "/home/travis/build/pantsbuild/pants/src/python/pants/pantsd/service/pailgun_service.py", line 65, in runner_factory build_graph = self._scheduler_service.get_build_graph(spec_roots) File "/home/travis/build/pantsbuild/pants/src/python/pants/pantsd/service/scheduler_service.py", line 84, in get_build_graph return self._graph_helper.create_graph(spec_roots) File "/home/travis/build/pantsbuild/pants/src/python/pants/bin/engine_initializer.py", line 64, in create_graph for _ in graph.inject_specs_closure(spec_roots): # Ensure the entire generator is unrolled. File "/home/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 169, in inject_specs_closure for address in self._inject(specs): File "/home/travis/build/pantsbuild/pants/src/python/pants/engine/legacy/graph.py", line 185, in _inject entries = maybe_list(state.value, expected_type=LegacyTarget) AttributeError: 'NoneType' object has no attribute 'value'
AttributeError
def _run(): """ To add additional paths to sys.path, add a block to the config similar to the following: [main] roots: ['src/python/pants_internal/test/',] """ version = get_version() if len(sys.argv) == 2 and sys.argv[1] == _VERSION_OPTION: _do_exit(version) root_dir = get_buildroot() if not os.path.exists(root_dir): _exit_and_fail("PANTS_BUILD_ROOT does not point to a valid path: %s" % root_dir) if len(sys.argv) < 2 or (len(sys.argv) == 2 and sys.argv[1] in _HELP_ALIASES): _help(version, root_dir) command_class, command_args = _parse_command(root_dir, sys.argv[1:]) parser = optparse.OptionParser(version=version) RcFile.install_disable_rc_option(parser) parser.add_option( _LOG_EXIT_OPTION, action="store_true", default=False, dest="log_exit", help="Log an exit message on success or failure.", ) config = Config.load() # TODO: This can be replaced once extensions are enabled with # https://github.com/pantsbuild/pants/issues/5 roots = config.getlist("parse", "roots", default=[]) sys.path.extend(map(lambda root: os.path.join(root_dir, root), roots)) # XXX(wickman) This should be in the command goal, not un pants_exe.py! run_tracker = RunTracker.from_config(config) report = initial_reporting(config, run_tracker) run_tracker.start(report) url = run_tracker.run_info.get_info("report_url") if url: run_tracker.log(Report.INFO, "See a report at: %s" % url) else: run_tracker.log(Report.INFO, "(To run a reporting server: ./pants goal server)") command = command_class(run_tracker, root_dir, parser, command_args) try: if command.serialized(): def onwait(pid): print( "Waiting on pants process %s to complete" % _process_info(pid), file=sys.stderr, ) return True runfile = os.path.join(root_dir, ".pants.run") lock = Lock.acquire(runfile, onwait=onwait) else: lock = Lock.unlocked() try: result = command.run(lock) _do_exit(result) except KeyboardInterrupt: command.cleanup() raise finally: lock.release() finally: run_tracker.end() # Must kill nailguns only after run_tracker.end() is called, because there may still # be pending background work that needs a nailgun. if ( hasattr(command.options, "cleanup_nailguns") and command.options.cleanup_nailguns ) or config.get("nailgun", "autokill", default=False): NailgunTask.killall(None)
def _run(): """ To add additional paths to sys.path, add a block to the config similar to the following: [main] roots: ['src/python/pants_internal/test/',] """ version = get_version() if len(sys.argv) == 2 and sys.argv[1] == _VERSION_OPTION: _do_exit(version) root_dir = get_buildroot() if not os.path.exists(root_dir): _exit_and_fail("PANTS_BUILD_ROOT does not point to a valid path: %s" % root_dir) if len(sys.argv) < 2 or (len(sys.argv) == 2 and sys.argv[1] in _HELP_ALIASES): _help(version, root_dir) command_class, command_args = _parse_command(root_dir, sys.argv[1:]) parser = optparse.OptionParser(version=version) RcFile.install_disable_rc_option(parser) parser.add_option( _LOG_EXIT_OPTION, action="store_true", default=False, dest="log_exit", help="Log an exit message on success or failure.", ) config = Config.load() # TODO: This can be replaced once extensions are enabled with # https://github.com/pantsbuild/pants/issues/5 roots = config.getlist("parse", "roots", default=[]) sys.path.extend(map(lambda root: os.path.join(root_dir, root), roots)) # XXX(wickman) This should be in the command goal, not un pants_exe.py! run_tracker = RunTracker.from_config(config) report = initial_reporting(config, run_tracker) run_tracker.start(report) url = run_tracker.run_info.get_info("report_url") if url: run_tracker.log(Report.INFO, "See a report at: %s" % url) else: run_tracker.log(Report.INFO, "(To run a reporting server: ./pants server)") command = command_class(run_tracker, root_dir, parser, command_args) try: if command.serialized(): def onwait(pid): print( "Waiting on pants process %s to complete" % _process_info(pid), file=sys.stderr, ) return True runfile = os.path.join(root_dir, ".pants.run") lock = Lock.acquire(runfile, onwait=onwait) else: lock = Lock.unlocked() try: result = command.run(lock) _do_exit(result) except KeyboardInterrupt: command.cleanup() raise finally: lock.release() finally: run_tracker.end() # Must kill nailguns only after run_tracker.end() is called, because there may still # be pending background work that needs a nailgun. if ( hasattr(command.options, "cleanup_nailguns") and command.options.cleanup_nailguns ) or config.get("nailgun", "autokill", default=False): NailgunTask.killall(None)
https://github.com/pantsbuild/pants/issues/52
[tw-mbp13-tdesai pants]$ ./pants server Failed to execute pants build: Traceback (most recent call last): File "/Users/tdesai/projects/pants/pants.pex/pants/bin/pants_exe.py", line 89, in _synthesize_command Address.parse(root_dir, command) File "/Users/tdesai/projects/pants/pants.pex/pants/base/address.py", line 57, in parse buildfile = BuildFile(root_dir, path) File "/Users/tdesai/projects/pants/pants.pex/pants/base/build_file.py", line 54, in __init__ raise IOError("BUILD file does not exist at: %s" % buildfile) IOError: BUILD file does not exist at: /Users/tdesai/projects/pants/server [tw-mbp13-tdesai pants]$
IOError
def _create_launchers(self): """Create launchers""" self._print("Creating launchers") self.create_launcher( "WinPython Command Prompt.exe", "cmd.ico", command="$SYSDIR\cmd.exe", args=r"/k cmd.bat", ) self.create_launcher( "WinPython Interpreter.exe", "python.ico", command="$SYSDIR\cmd.exe", args=r"/k winpython.bat", ) # self.create_launcher('IDLEX (students).exe', 'python.ico', # command='$SYSDIR\cmd.exe', # args= r'/k IDLEX_for_student.bat %*', # workdir='$EXEDIR\scripts') self.create_launcher( "IDLEX (Python GUI).exe", "python.ico", command="wscript.exe", args=r"Noshell.vbs IDLEX.bat", ) self.create_launcher( "Spyder.exe", "spyder.ico", command="wscript.exe", args=r"Noshell.vbs spyder.bat", ) self.create_launcher( "Spyder reset.exe", "spyder_reset.ico", command="wscript.exe", args=r"Noshell.vbs spyder_reset.bat", ) self.create_launcher( "WinPython Control Panel.exe", "winpython.ico", command="wscript.exe", args=r"Noshell.vbs wpcp.bat", ) # Multi-Qt launchers (Qt5 has priority if found) self.create_launcher( "Qt Demo.exe", "qt.ico", command="wscript.exe", args=r"Noshell.vbs qtdemo.bat" ) self.create_launcher( "Qt Assistant.exe", "qtassistant.ico", command="wscript.exe", args=r"Noshell.vbs qtassistant.bat", ) self.create_launcher( "Qt Designer.exe", "qtdesigner.ico", command="wscript.exe", args=r"Noshell.vbs qtdesigner.bat", ) self.create_launcher( "Qt Linguist.exe", "qtlinguist.ico", command="wscript.exe", args=r"Noshell.vbs qtlinguist.bat", ) # Jupyter launchers self.create_launcher( "IPython Qt Console.exe", "ipython.ico", command="wscript.exe", args=r"Noshell.vbs qtconsole.bat", ) # this one needs a shell to kill fantom processes self.create_launcher( "Jupyter Notebook.exe", "jupyter.ico", command="$SYSDIR\cmd.exe", args=r"/k ipython_notebook.bat", ) self._print_done()
def _create_launchers(self): """Create launchers""" self._print("Creating launchers") self.create_launcher( "WinPython Command Prompt.exe", "cmd.ico", command="$SYSDIR\cmd.exe", args=r"/k cmd.bat", ) self.create_launcher( "WinPython Interpreter.exe", "python.ico", command="$SYSDIR\cmd.exe", args=r"/k python.bat", ) # self.create_launcher('IDLEX (students).exe', 'python.ico', # command='$SYSDIR\cmd.exe', # args= r'/k IDLEX_for_student.bat %*', # workdir='$EXEDIR\scripts') self.create_launcher( "IDLEX (Python GUI).exe", "python.ico", command="wscript.exe", args=r"Noshell.vbs IDLEX.bat", ) self.create_launcher( "Spyder.exe", "spyder.ico", command="wscript.exe", args=r"Noshell.vbs spyder.bat", ) self.create_launcher( "Spyder reset.exe", "spyder_reset.ico", command="wscript.exe", args=r"Noshell.vbs spyder_reset.bat", ) self.create_launcher( "WinPython Control Panel.exe", "winpython.ico", command="wscript.exe", args=r"Noshell.vbs wpcp.bat", ) # Multi-Qt launchers (Qt5 has priority if found) self.create_launcher( "Qt Demo.exe", "qt.ico", command="wscript.exe", args=r"Noshell.vbs qtdemo.bat" ) self.create_launcher( "Qt Assistant.exe", "qtassistant.ico", command="wscript.exe", args=r"Noshell.vbs qtassistant.bat", ) self.create_launcher( "Qt Designer.exe", "qtdesigner.ico", command="wscript.exe", args=r"Noshell.vbs qtdesigner.bat", ) self.create_launcher( "Qt Linguist.exe", "qtlinguist.ico", command="wscript.exe", args=r"Noshell.vbs qtlinguist.bat", ) # Jupyter launchers self.create_launcher( "IPython Qt Console.exe", "ipython.ico", command="wscript.exe", args=r"Noshell.vbs qtconsole.bat", ) # this one needs a shell to kill fantom processes self.create_launcher( "Jupyter Notebook.exe", "jupyter.ico", command="$SYSDIR\cmd.exe", args=r"/k ipython_notebook.bat", ) self._print_done()
https://github.com/winpython/winpython/issues/315
Traceback (most recent call last): File "C:\Users\XXX\Documents\zipp\winpython\WinPython-32bit-3.4.4.2Qt5\python-3.4.4\lib\site-packages\llvmlite\binding\ffi.py", line 40, in <module> lib = ctypes.CDLL(os.path.join(_lib_dir, _lib_name)) File "C:\Users\XXX\Documents\zipp\winpython\WinPython-32bit-3.4.4.2Qt5\python-3.4.4\lib\ctypes\__init__.py", line 351, in __init__ self._handle = _dlopen(self._name, mode) OSError: [WinError 126] The specified module could not be found During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<string>", line 1, in <module> File "C:\Users\XXX\Documents\zipp\winpython\WinPython-32bit-3.4.4.2Qt5\python-3.4.4\lib\site-packages\numba\__init__.py", line 9, in <module> from . import runtests, decorators File "C:\Users\XXX\Documents\zipp\winpython\WinPython-32bit-3.4.4.2Qt5\python-3.4.4\lib\site-packages\numba\decorators.py", line 8, in <module> from . import config, sigutils File "C:\Users\XXX\Documents\zipp\winpython\WinPython-32bit-3.4.4.2Qt5\python-3.4.4\lib\site-packages\numba\config.py", line 10, in <module> import llvmlite.binding as ll File "C:\Users\XXX\Documents\zipp\winpython\WinPython-32bit-3.4.4.2Qt5\python-3.4.4\lib\site-packages\llvmlite\binding\__init__.py", line 6, in <module> from .dylib import * File "C:\Users\XXX\Documents\zipp\winpython\WinPython-32bit-3.4.4.2Qt5\python-3.4.4\lib\site-packages\llvmlite\binding\dylib.py", line 4, in <module> from . import ffi File "C:\Users\XXX\Documents\zipp\winpython\WinPython-32bit-3.4.4.2Qt5\python-3.4.4\lib\site-packages\llvmlite\binding\ffi.py", line 45, in <module> lib = ctypes.CDLL(_lib_name) File "C:\Users\XXX\Documents\zipp\winpython\WinPython-32bit-3.4.4.2Qt5\python-3.4.4\lib\ctypes\__init__.py", line 351, in __init__ self._handle = _dlopen(self._name, mode) OSError: [WinError 126] The specified module could not be found
OSError
def _create_batch_scripts(self): """Create batch scripts""" self._print("Creating batch scripts") self.create_batch_script( "readme.txt", r"""These batch files are required to run WinPython icons. These files should help the user writing his/her own specific batch file to call Python scripts inside WinPython. The environment variables are set-up in 'env_.bat' and 'env_for_icons.bat'.""", ) conv = lambda path: ";".join(["%WINPYDIR%\\" + pth for pth in path]) path = conv(self.prepath) + ";%PATH%;" + conv(self.postpath) self.create_batch_script( "make_cython_use_mingw.bat", r"""@echo off call %~dp0env.bat rem ****************** rem mingw part rem ****************** set pydistutils_cfg=%WINPYDIR%\..\settings\pydistutils.cfg set tmp_blank= echo [config]>"%pydistutils_cfg%" echo compiler=mingw32>>"%pydistutils_cfg%" echo [build]>>"%pydistutils_cfg%" echo compiler=mingw32>>"%pydistutils_cfg%" echo [build_ext]>>"%pydistutils_cfg%" echo compiler=mingw32>>"%pydistutils_cfg%" echo cython has been set to use mingw32 echo to remove this, remove file "%pydistutils_cfg%" rem pause """, ) self.create_batch_script( "make_cython_use_vc.bat", r"""@echo off call %~dp0env.bat set pydistutils_cfg=%WINPYDIR%\..\settings\pydistutils.cfg echo [config]>%pydistutils_cfg% """, ) self.create_batch_script( "make_winpython_movable.bat", r"""@echo off call %~dp0env.bat echo patch pip and current launchers for move %WINPYDIR%\python.exe -c "from winpython import wppm;dist=wppm.Distribution(r'%WINPYDIR%');dist.patch_standard_packages('pip', to_movable=True)" pause """, ) self.create_batch_script( "make_winpython_fix.bat", r"""@echo off call %~dp0env.bat echo patch pip and current launchers for non-move %WINPYDIR%\python.exe -c "from winpython import wppm;dist=wppm.Distribution(r'%WINPYDIR%');dist.patch_standard_packages('pip', to_movable=False)" pause """, ) self.create_batch_script( "make_working_directory_be_not_winpython.bat", r"""@echo off set winpython_ini=%~dp0..\\settings\winpython.ini echo [debug]>"%winpython_ini%" echo state = disabled>>"%winpython_ini%" echo [environment]>>"%winpython_ini%" echo ## <?> Uncomment lines to override environment variables>>"%winpython_ini%" echo HOME = %%HOMEDRIVE%%%%HOMEPATH%%\Documents\WinPython%%WINPYVER%%\settings>>"%winpython_ini%" echo JUPYTER_DATA_DIR = %%HOME%%>>"%winpython_ini%" echo WINPYWORKDIR = %%HOMEDRIVE%%%%HOMEPATH%%\Documents\WinPython%%WINPYVER%%\Notebooks>>"%winpython_ini%" """, ) self.create_batch_script( "make_working_directory_be_winpython.bat", r"""@echo off set winpython_ini=%~dp0..\\settings\winpython.ini echo [debug]>"%winpython_ini%" echo state = disabled>>"%winpython_ini%" echo [environment]>>"%winpython_ini%" echo ## <?> Uncomment lines to override environment variables>>"%winpython_ini%" echo #HOME = %%HOMEDRIVE%%%%HOMEPATH%%\Documents\WinPython%%WINPYVER%%\settings>>"%winpython_ini%" echo #JUPYTER_DATA_DIR = %%HOME%%>>"%winpython_ini%" echo #WINPYWORKDIR = %%HOMEDRIVE%%%%HOMEPATH%%\Documents\WinPython%%WINPYVER%%\Notebooks>>"%winpython_ini%" """, ) self.create_batch_script( "cmd.bat", r"""@echo off call "%~dp0env_for_icons.bat" cmd.exe /k""", ) self.create_batch_script( "python.bat", r"""@echo off call "%~dp0env_for_icons.bat" cd/D "%WINPYWORKDIR%" rem backward compatibility for python command-line users "%WINPYDIR%\python.exe" %* """, ) self.create_batch_script( "winpython.bat", r"""@echo off call "%~dp0env_for_icons.bat" cd/D "%WINPYWORKDIR%" rem backward compatibility for non-ptpython users if exist "%WINPYDIR%\scripts\ptpython.exe" ( "%WINPYDIR%\scripts\ptpython.exe" %* ) else ( "%WINPYDIR%\python.exe" %* ) """, ) self.create_batch_script( "idlex.bat", r"""@echo off call "%~dp0env_for_icons.bat" cd/D "%WINPYWORKDIR%" rem backward compatibility for non-IDLEX users if exist "%WINPYDIR%\scripts\idlex.pyw" ( "%WINPYDIR%\python.exe" "%WINPYDIR%\scripts\idlex.pyw" %* ) else ( "%WINPYDIR%\python.exe" "%WINPYDIR%\Lib\idlelib\idle.pyw" %* ) """, ) self.create_batch_script( "spyder.bat", r"""@echo off call "%~dp0env_for_icons.bat" cd/D "%WINPYWORKDIR%" "%WINPYDIR%\scripts\spyder.exe" %* """, ) self.create_batch_script( "spyder_reset.bat", r"""@echo off call "%~dp0env_for_icons.bat" cd/D "%WINPYWORKDIR%" %WINPYDIR%\scripts\spyder.exe --reset %* """, ) self.create_batch_script( "ipython_notebook.bat", r"""@echo off call "%~dp0env_for_icons.bat" cd/D "%WINPYWORKDIR%" "%WINPYDIR%\scripts\jupyter-notebook.exe" %* """, ) self.create_batch_script( "qtconsole.bat", r"""@echo off call "%~dp0env_for_icons.bat" cd/D "%WINPYWORKDIR%" "%WINPYDIR%\scripts\jupyter-qtconsole.exe" %* """, ) self.create_batch_script( "qtdemo.bat", r"""@echo off call "%~dp0env_for_icons.bat" cd/D "%WINPYWORKDIR%" if "%QT_API%"=="pyqt5" ( "%WINPYDIR%\python.exe" "%WINPYDIR%\Lib\site-packages\PyQt5\examples\qtdemo\demo.py" ) else ( "%WINPYDIR%\pythonw.exe" "%WINPYDIR%\Lib\site-packages\PyQt4\examples\demos\qtdemo\qtdemo.pyw" ) """, ) self.create_batch_script( "qtdesigner.bat", r"""@echo off call "%~dp0env_for_icons.bat" cd/D "%WINPYWORKDIR%" if "%QT_API%"=="pyqt5" ( "%WINPYDIR%\Lib\site-packages\PyQt5\designer.exe" %* ) else ( "%WINPYDIR%\Lib\site-packages\PyQt4\designer.exe" %* ) """, ) self.create_batch_script( "qtassistant.bat", r"""@echo off call "%~dp0env_for_icons.bat" cd/D "%WINPYWORKDIR%" if "%QT_API%"=="pyqt5" ( "%WINPYDIR%\Lib\site-packages\PyQt5\assistant.exe" %* ) else ( "%WINPYDIR%\Lib\site-packages\PyQt4\assistant.exe" %* ) """, ) self.create_batch_script( "qtlinguist.bat", r"""@echo off call "%~dp0env_for_icons.bat" cd/D "%WINPYWORKDIR%" if "%QT_API%"=="pyqt5" ( cd/D "%WINPYDIR%\Lib\site-packages\PyQt5" "%WINPYDIR%\Lib\site-packages\PyQt5\linguist.exe" %* ) else ( cd/D "%WINPYDIR%\Lib\site-packages\PyQt4" "%WINPYDIR%\Lib\site-packages\PyQt4\linguist.exe" %* ) """, ) self.create_python_batch( "register_python.bat", "register_python", workdir=r'"%WINPYDIR%\Scripts"' ) self.create_batch_script( "register_python_for_all.bat", r"""@echo off call %~dp0env.bat call %~dp0register_python.bat --all""", ) self.create_batch_script( "wpcp.bat", r"""@echo off call "%~dp0env_for_icons.bat" cd/D "%WINPYWORKDIR%" %WINPYDIR%\python.exe -m winpython.controlpanel %* """, ) # self.create_python_batch('wpcp.bat', '-m winpython.controlpanel', # workdir=r'"%WINPYDIR%\Scripts"') self.create_batch_script( "upgrade_pip.bat", r"""@echo off call %~dp0env.bat echo this will upgrade pip with latest version, then patch it for WinPython portability ok ? pause %WINPYDIR%\python.exe -m pip install --upgrade --force-reinstall pip %WINPYDIR%\python.exe -c "from winpython import wppm;dist=wppm.Distribution(r'%WINPYDIR%');dist.patch_standard_packages('pip', to_movable=True) pause """, ) # pre-run mingw batch print("now pre-running extra mingw") filepath = osp.join(self.winpydir, "scripts", "make_cython_use_mingw.bat") p = subprocess.Popen(filepath, shell=True, stdout=subprocess.PIPE) stdout, stderr = p.communicate() self._print_done()
def _create_batch_scripts(self): """Create batch scripts""" self._print("Creating batch scripts") self.create_batch_script( "readme.txt", r"""These batch files are required to run WinPython icons. These files should help the user writing his/her own specific batch file to call Python scripts inside WinPython. The environment variables are set-up in 'env_.bat' and 'env_for_icons.bat'.""", ) conv = lambda path: ";".join(["%WINPYDIR%\\" + pth for pth in path]) path = conv(self.prepath) + ";%PATH%;" + conv(self.postpath) self.create_batch_script( "make_cython_use_mingw.bat", r"""@echo off call %~dp0env.bat rem ****************** rem mingw part rem ****************** set pydistutils_cfg=%WINPYDIR%\..\settings\pydistutils.cfg set tmp_blank= echo [config]>"%pydistutils_cfg%" echo compiler=mingw32>>"%pydistutils_cfg%" echo [build]>>"%pydistutils_cfg%" echo compiler=mingw32>>"%pydistutils_cfg%" echo [build_ext]>>"%pydistutils_cfg%" echo compiler=mingw32>>"%pydistutils_cfg%" echo cython has been set to use mingw32 echo to remove this, remove file "%pydistutils_cfg%" rem pause """, ) self.create_batch_script( "make_cython_use_vc.bat", r"""@echo off call %~dp0env.bat set pydistutils_cfg=%WINPYDIR%\..\settings\pydistutils.cfg echo [config]>%pydistutils_cfg% """, ) self.create_batch_script( "make_winpython_movable.bat", r"""@echo off call %~dp0env.bat echo patch pip and current launchers for move %WINPYDIR%\python.exe -c "from winpython import wppm;dist=wppm.Distribution(r'%WINPYDIR%');dist.patch_standard_packages('pip', to_movable=True)" pause """, ) self.create_batch_script( "make_winpython_fix.bat", r"""@echo off call %~dp0env.bat echo patch pip and current launchers for non-move %WINPYDIR%\python.exe -c "from winpython import wppm;dist=wppm.Distribution(r'%WINPYDIR%');dist.patch_standard_packages('pip', to_movable=False)" pause """, ) self.create_batch_script( "make_working_directory_be_not_winpython.bat", r"""@echo off set winpython_ini=%~dp0..\\settings\winpython.ini echo [debug]>"%winpython_ini%" echo state = disabled>>"%winpython_ini%" echo [environment]>>"%winpython_ini%" echo ## <?> Uncomment lines to override environment variables>>"%winpython_ini%" echo HOME = %%HOMEDRIVE%%%%HOMEPATH%%\Documents\WinPython%%WINPYVER%%\settings>>"%winpython_ini%" echo JUPYTER_DATA_DIR = %%HOME%%>>"%winpython_ini%" echo WINPYWORKDIR = %%HOMEDRIVE%%%%HOMEPATH%%\Documents\WinPython%%WINPYVER%%\Notebooks>>"%winpython_ini%" """, ) self.create_batch_script( "make_working_directory_be_winpython.bat", r"""@echo off set winpython_ini=%~dp0..\\settings\winpython.ini echo [debug]>"%winpython_ini%" echo state = disabled>>"%winpython_ini%" echo [environment]>>"%winpython_ini%" echo ## <?> Uncomment lines to override environment variables>>"%winpython_ini%" echo #HOME = %%HOMEDRIVE%%%%HOMEPATH%%\Documents\WinPython%%WINPYVER%%\settings>>"%winpython_ini%" echo #JUPYTER_DATA_DIR = %%HOME%%>>"%winpython_ini%" echo #WINPYWORKDIR = %%HOMEDRIVE%%%%HOMEPATH%%\Documents\WinPython%%WINPYVER%%\Notebooks>>"%winpython_ini%" """, ) self.create_batch_script( "cmd.bat", r"""@echo off call "%~dp0env_for_icons.bat" cmd.exe /k""", ) self.create_batch_script( "python.bat", r"""@echo off call "%~dp0env_for_icons.bat" cd/D "%WINPYWORKDIR%" rem backward compatibility for non-ptpython users if exist "%WINPYDIR%\scripts\ptpython.exe" ( "%WINPYDIR%\scripts\ptpython.exe" %* ) else ( "%WINPYDIR%\python.exe" %* ) """, ) self.create_batch_script( "idlex.bat", r"""@echo off call "%~dp0env_for_icons.bat" cd/D "%WINPYWORKDIR%" rem backward compatibility for non-IDLEX users if exist "%WINPYDIR%\scripts\idlex.pyw" ( "%WINPYDIR%\python.exe" "%WINPYDIR%\scripts\idlex.pyw" %* ) else ( "%WINPYDIR%\python.exe" "%WINPYDIR%\Lib\idlelib\idle.pyw" %* ) """, ) self.create_batch_script( "spyder.bat", r"""@echo off call "%~dp0env_for_icons.bat" cd/D "%WINPYWORKDIR%" "%WINPYDIR%\scripts\spyder.exe" %* """, ) self.create_batch_script( "spyder_reset.bat", r"""@echo off call "%~dp0env_for_icons.bat" cd/D "%WINPYWORKDIR%" %WINPYDIR%\scripts\spyder.exe --reset %* """, ) self.create_batch_script( "ipython_notebook.bat", r"""@echo off call "%~dp0env_for_icons.bat" cd/D "%WINPYWORKDIR%" "%WINPYDIR%\scripts\jupyter-notebook.exe" %* """, ) self.create_batch_script( "qtconsole.bat", r"""@echo off call "%~dp0env_for_icons.bat" cd/D "%WINPYWORKDIR%" "%WINPYDIR%\scripts\jupyter-qtconsole.exe" %* """, ) self.create_batch_script( "qtdemo.bat", r"""@echo off call "%~dp0env_for_icons.bat" cd/D "%WINPYWORKDIR%" if "%QT_API%"=="pyqt5" ( "%WINPYDIR%\python.exe" "%WINPYDIR%\Lib\site-packages\PyQt5\examples\qtdemo\demo.py" ) else ( "%WINPYDIR%\pythonw.exe" "%WINPYDIR%\Lib\site-packages\PyQt4\examples\demos\qtdemo\qtdemo.pyw" ) """, ) self.create_batch_script( "qtdesigner.bat", r"""@echo off call "%~dp0env_for_icons.bat" cd/D "%WINPYWORKDIR%" if "%QT_API%"=="pyqt5" ( "%WINPYDIR%\Lib\site-packages\PyQt5\designer.exe" %* ) else ( "%WINPYDIR%\Lib\site-packages\PyQt4\designer.exe" %* ) """, ) self.create_batch_script( "qtassistant.bat", r"""@echo off call "%~dp0env_for_icons.bat" cd/D "%WINPYWORKDIR%" if "%QT_API%"=="pyqt5" ( "%WINPYDIR%\Lib\site-packages\PyQt5\assistant.exe" %* ) else ( "%WINPYDIR%\Lib\site-packages\PyQt4\assistant.exe" %* ) """, ) self.create_batch_script( "qtlinguist.bat", r"""@echo off call "%~dp0env_for_icons.bat" cd/D "%WINPYWORKDIR%" if "%QT_API%"=="pyqt5" ( cd/D "%WINPYDIR%\Lib\site-packages\PyQt5" "%WINPYDIR%\Lib\site-packages\PyQt5\linguist.exe" %* ) else ( cd/D "%WINPYDIR%\Lib\site-packages\PyQt4" "%WINPYDIR%\Lib\site-packages\PyQt4\linguist.exe" %* ) """, ) self.create_python_batch( "register_python.bat", "register_python", workdir=r'"%WINPYDIR%\Scripts"' ) self.create_batch_script( "register_python_for_all.bat", r"""@echo off call %~dp0env.bat call %~dp0register_python.bat --all""", ) self.create_batch_script( "wpcp.bat", r"""@echo off call "%~dp0env_for_icons.bat" cd/D "%WINPYWORKDIR%" %WINPYDIR%\python.exe -m winpython.controlpanel %* """, ) # self.create_python_batch('wpcp.bat', '-m winpython.controlpanel', # workdir=r'"%WINPYDIR%\Scripts"') self.create_batch_script( "upgrade_pip.bat", r"""@echo off call %~dp0env.bat echo this will upgrade pip with latest version, then patch it for WinPython portability ok ? pause %WINPYDIR%\python.exe -m pip install --upgrade --force-reinstall pip %WINPYDIR%\python.exe -c "from winpython import wppm;dist=wppm.Distribution(r'%WINPYDIR%');dist.patch_standard_packages('pip', to_movable=True) pause """, ) # pre-run mingw batch print("now pre-running extra mingw") filepath = osp.join(self.winpydir, "scripts", "make_cython_use_mingw.bat") p = subprocess.Popen(filepath, shell=True, stdout=subprocess.PIPE) stdout, stderr = p.communicate() self._print_done()
https://github.com/winpython/winpython/issues/315
Traceback (most recent call last): File "C:\Users\XXX\Documents\zipp\winpython\WinPython-32bit-3.4.4.2Qt5\python-3.4.4\lib\site-packages\llvmlite\binding\ffi.py", line 40, in <module> lib = ctypes.CDLL(os.path.join(_lib_dir, _lib_name)) File "C:\Users\XXX\Documents\zipp\winpython\WinPython-32bit-3.4.4.2Qt5\python-3.4.4\lib\ctypes\__init__.py", line 351, in __init__ self._handle = _dlopen(self._name, mode) OSError: [WinError 126] The specified module could not be found During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<string>", line 1, in <module> File "C:\Users\XXX\Documents\zipp\winpython\WinPython-32bit-3.4.4.2Qt5\python-3.4.4\lib\site-packages\numba\__init__.py", line 9, in <module> from . import runtests, decorators File "C:\Users\XXX\Documents\zipp\winpython\WinPython-32bit-3.4.4.2Qt5\python-3.4.4\lib\site-packages\numba\decorators.py", line 8, in <module> from . import config, sigutils File "C:\Users\XXX\Documents\zipp\winpython\WinPython-32bit-3.4.4.2Qt5\python-3.4.4\lib\site-packages\numba\config.py", line 10, in <module> import llvmlite.binding as ll File "C:\Users\XXX\Documents\zipp\winpython\WinPython-32bit-3.4.4.2Qt5\python-3.4.4\lib\site-packages\llvmlite\binding\__init__.py", line 6, in <module> from .dylib import * File "C:\Users\XXX\Documents\zipp\winpython\WinPython-32bit-3.4.4.2Qt5\python-3.4.4\lib\site-packages\llvmlite\binding\dylib.py", line 4, in <module> from . import ffi File "C:\Users\XXX\Documents\zipp\winpython\WinPython-32bit-3.4.4.2Qt5\python-3.4.4\lib\site-packages\llvmlite\binding\ffi.py", line 45, in <module> lib = ctypes.CDLL(_lib_name) File "C:\Users\XXX\Documents\zipp\winpython\WinPython-32bit-3.4.4.2Qt5\python-3.4.4\lib\ctypes\__init__.py", line 351, in __init__ self._handle = _dlopen(self._name, mode) OSError: [WinError 126] The specified module could not be found
OSError
def eventstream(f): def new_func(*args, **kwargs): def generate(): for event in chain(f(*args, **kwargs), (None,)): yield ("data: %s\n\n" % json.dumps(event)).encode() return Response( generate(), mimetype="text/event-stream", direct_passthrough=True ) return update_wrapper(new_func, f)
def eventstream(f): def new_func(*args, **kwargs): def generate(): for event in chain(f(*args, **kwargs), (None,)): yield "data: %s\n\n" % json.dumps(event) return Response( generate(), mimetype="text/event-stream", direct_passthrough=True ) return update_wrapper(new_func, f)
https://github.com/lektor/lektor/issues/508
Started build Error on request: Traceback (most recent call last): File "/private/tmp/test/lib/python3.6/site-packages/werkzeug/serving.py", line 270, in run_wsgi execute(self.server.app) File "/private/tmp/test/lib/python3.6/site-packages/werkzeug/serving.py", line 261, in execute write(data) File "/private/tmp/test/lib/python3.6/site-packages/werkzeug/serving.py", line 241, in write assert isinstance(data, bytes), 'applications must write bytes' AssertionError: applications must write bytes Finished build in 0.02 sec
AssertionError
def new_func(*args, **kwargs): def generate(): for event in chain(f(*args, **kwargs), (None,)): yield ("data: %s\n\n" % json.dumps(event)).encode() return Response(generate(), mimetype="text/event-stream", direct_passthrough=True)
def new_func(*args, **kwargs): def generate(): for event in chain(f(*args, **kwargs), (None,)): yield "data: %s\n\n" % json.dumps(event) return Response(generate(), mimetype="text/event-stream", direct_passthrough=True)
https://github.com/lektor/lektor/issues/508
Started build Error on request: Traceback (most recent call last): File "/private/tmp/test/lib/python3.6/site-packages/werkzeug/serving.py", line 270, in run_wsgi execute(self.server.app) File "/private/tmp/test/lib/python3.6/site-packages/werkzeug/serving.py", line 261, in execute write(data) File "/private/tmp/test/lib/python3.6/site-packages/werkzeug/serving.py", line 241, in write assert isinstance(data, bytes), 'applications must write bytes' AssertionError: applications must write bytes Finished build in 0.02 sec
AssertionError
def generate(): for event in chain(f(*args, **kwargs), (None,)): yield ("data: %s\n\n" % json.dumps(event)).encode()
def generate(): for event in chain(f(*args, **kwargs), (None,)): yield "data: %s\n\n" % json.dumps(event)
https://github.com/lektor/lektor/issues/508
Started build Error on request: Traceback (most recent call last): File "/private/tmp/test/lib/python3.6/site-packages/werkzeug/serving.py", line 270, in run_wsgi execute(self.server.app) File "/private/tmp/test/lib/python3.6/site-packages/werkzeug/serving.py", line 261, in execute write(data) File "/private/tmp/test/lib/python3.6/site-packages/werkzeug/serving.py", line 241, in write assert isinstance(data, bytes), 'applications must write bytes' AssertionError: applications must write bytes Finished build in 0.02 sec
AssertionError
def portable_popen(cmd, *args, **kwargs): """A portable version of subprocess.Popen that automatically locates executables before invoking them. This also looks for executables in the bundle bin. """ if cmd[0] is None: raise RuntimeError("No executable specified") exe = locate_executable(cmd[0], kwargs.get("cwd")) if exe is None: raise RuntimeError('Could not locate executable "%s"' % cmd[0]) if isinstance(exe, text_type) and sys.platform != "win32": exe = exe.encode(sys.getfilesystemencoding()) cmd[0] = exe return subprocess.Popen(cmd, *args, **kwargs)
def portable_popen(cmd, *args, **kwargs): """A portable version of subprocess.Popen that automatically locates executables before invoking them. This also looks for executables in the bundle bin. """ if cmd[0] is None: raise RuntimeError("No executable specified") exe = locate_executable(cmd[0], kwargs.get("cwd")) if exe is None: raise RuntimeError('Could not locate executable "%s"' % cmd[0]) if isinstance(exe, text_type): exe = exe.encode(sys.getfilesystemencoding()) cmd[0] = exe return subprocess.Popen(cmd, *args, **kwargs)
https://github.com/lektor/lektor/issues/414
Ξ» lektor build Updating packages in C:\Users\Aperez\AppData\Local\Lektor\Cache\packages\4f6825e8ddb9e94fa8041414ed8a88e0 for project Traceback (most recent call last): File "C:\Users\Aperez\AppData\Local\Programs\Python\Python36-32\Scripts\lektor-script.py", line 11, in <module> load_entry_point('Lektor==3.0', 'console_scripts', 'lektor')() File "C:\Users\Aperez\AppData\Local\Programs\Python\Python36-32\lib\site-packages\click\core.py", line 722, in __call__ return self.main(*args, **kwargs) File "C:\Users\Aperez\AppData\Local\Programs\Python\Python36-32\lib\site-packages\click\core.py", line 697, in main rv = self.invoke(ctx) File "C:\Users\Aperez\AppData\Local\Programs\Python\Python36-32\lib\site-packages\click\core.py", line 1066, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "C:\Users\Aperez\AppData\Local\Programs\Python\Python36-32\lib\site-packages\click\core.py", line 895, in invoke return ctx.invoke(self.callback, **ctx.params) File "C:\Users\Aperez\AppData\Local\Programs\Python\Python36-32\lib\site-packages\click\core.py", line 535, in invoke return callback(*args, **kwargs) File "C:\Users\Aperez\AppData\Local\Programs\Python\Python36-32\lib\site-packages\click\decorators.py", line 64, in new_func return ctx.invoke(f, obj, *args[1:], **kwargs) File "C:\Users\Aperez\AppData\Local\Programs\Python\Python36-32\lib\site-packages\click\core.py", line 535, in invoke return callback(*args, **kwargs) File "C:\Users\Aperez\AppData\Local\Programs\Python\Python36-32\lib\site-packages\lektor-3.0-py3.6.egg\lektor\cli.py", line 198, in build_cmd ctx.load_plugins() File "C:\Users\Aperez\AppData\Local\Programs\Python\Python36-32\lib\site-packages\lektor-3.0-py3.6.egg\lektor\cli.py", line 114, in load_plugins load_packages(self.get_env(), reinstall=reinstall) File "C:\Users\Aperez\AppData\Local\Programs\Python\Python36-32\lib\site-packages\lektor-3.0-py3.6.egg\lektor\packages.py", line 304, in load_packages refresh=reinstall) File "C:\Users\Aperez\AppData\Local\Programs\Python\Python36-32\lib\site-packages\lektor-3.0-py3.6.egg\lektor\packages.py", line 274, in update_cache download_and_install_package(package_root, package, version) File "C:\Users\Aperez\AppData\Local\Programs\Python\Python36-32\lib\site-packages\lektor-3.0-py3.6.egg\lektor\packages.py", line 101, in download_and_install_package rv = portable_popen(args, env=env).wait() File "C:\Users\Aperez\AppData\Local\Programs\Python\Python36-32\lib\site-packages\lektor-3.0-py3.6.egg\lektor\utils.py", line 490, in portable_popen return subprocess.Popen(cmd, *args, **kwargs) File "C:\Users\Aperez\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 707, in __init__ restore_signals, start_new_session) File "C:\Users\Aperez\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 966, in _execute_child args = list2cmdline(args) File "C:\Users\Aperez\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 461, in list2cmdline needquote = (" " in arg) or ("\t" in arg) or not arg TypeError: a bytes-like object is required, not 'str'
TypeError
def rpc(self, method, args): """Returns the result of an rpc call to the Bitcoin Core RPC API. If the connection is permanently or unrecognizably broken, None is returned *and the reactor is shutdown* (because we consider this condition unsafe - TODO possibly create a "freeze" mode that could restart when the connection is healed, but that is tricky). """ if method not in [ "importaddress", "walletpassphrase", "getaccount", "gettransaction", "getrawtransaction", "gettxout", "importmulti", "listtransactions", "getblockcount", "scantxoutset", ]: log.debug("rpc: " + method + " " + str(args)) try: res = self.jsonRpc.call(method, args) except JsonRpcConnectionError as e: # note that we only raise this in case the connection error is # a refusal, or is unrecognized/unknown by our code. So this does # NOT happen in a reset or broken pipe scenario. # It is safest to simply shut down. # Why not sys.exit? sys.exit calls do *not* work inside delayedCalls # or deferreds in twisted, since a bare exception catch prevents # an actual system exit (i.e. SystemExit is caught as a # BareException type). log.error( "Failure of RPC connection to Bitcoin Core. " "Application cannot continue, shutting down." ) stop_reactor() return None # note that JsonRpcError is not caught here; for some calls, we # have specific behaviour requirements depending on these errors, # so this is handled elsewhere in BitcoinCoreInterface. return res
def rpc(self, method, args): """Returns the result of an rpc call to the Bitcoin Core RPC API. If the connection is permanently or unrecognizably broken, None is returned *and the reactor is shutdown* (because we consider this condition unsafe - TODO possibly create a "freeze" mode that could restart when the connection is healed, but that is tricky). """ if method not in [ "importaddress", "walletpassphrase", "getaccount", "gettransaction", "getrawtransaction", "gettxout", "importmulti", "listtransactions", "getblockcount", "scantxoutset", ]: log.debug("rpc: " + method + " " + str(args)) try: res = self.jsonRpc.call(method, args) except JsonRpcConnectionError as e: # note that we only raise this in case the connection error is # a refusal, or is unrecognized/unknown by our code. So this does # NOT happen in a reset or broken pipe scenario. # It is safest to simply shut down. # Why not sys.exit? sys.exit calls do *not* work inside delayedCalls # or deferreds in twisted, since a bare exception catch prevents # an actual system exit (i.e. SystemExit is caught as a # BareException type). log.error( "Failure of RPC connection to Bitcoin Core. " "Application cannot continue, shutting down." ) if reactor.running: reactor.stop() return None return res
https://github.com/JoinMarket-Org/joinmarket-clientserver/issues/673
2020-08-20 13:51:53,349 [DEBUG] >>privmsg on darkscience: nick=JXXX cmd=pubkey msg=8XXX 2020-08-20 13:52:02,337 [DEBUG] mix depths that have enough = {0: XXX} 2020-08-20 13:52:02,338 [INFO] filling offer, mixdepth=0, amount=2XXX 2020-08-20 13:52:02,893 [INFO] sending output to address=3XXX Unhandled Error Traceback (most recent call last): File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1041, in _commandReceived deferred = self.dispatchCommand(box) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1099, in dispatchCommand return maybeDeferred(responder, box) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 151, in maybeDeferred result = f(*args, **kw) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1186, in doit return maybeDeferred(aCallable, **kw).addCallback( --- <exception caught here> --- File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 654, in _runCallbacks current.result = callback(current.result, *args, **kw) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1169, in checkKnownErrors key = error.trap(*command.allErrors) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 460, in trap self.raiseException() File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 488, in raiseException raise self.value.with_traceback(self.tb) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 151, in maybeDeferred result = f(*args, **kw) File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/client_protocol.py", line 242, in on_JM_AUTH_RECEIVED commitment, revelation, amount, kphex) File "/home/nv01/joinmarket-clientserver/jmbase/jmbase/support.py", line 280, in func_wrapper return func(inst, *newargs, **kwargs) File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/maker.py", line 105, in on_auth_received self.wallet_service.save_wallet() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet_service.py", line 769, in save_wallet self.wallet.save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 1531, in save super().save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 1838, in save super().save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 385, in save self._utxos.save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 182, in save self.storage.save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/storage.py", line 134, in save raise StorageError("Read-only storage cannot be saved.") jmclient.storage.StorageError: Read-only storage cannot be saved. Amp server or network failure unhandled by client application. Dropping connection! To avoid, add errbacks to ALL remote commands! Traceback (most recent call last): --- <exception caught here> --- File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 654, in _runCallbacks current.result = callback(current.result, *args, **kw) File "/home/nv01/joinmarket-clientserver/jmdaemon/jmdaemon/daemon_protocol.py", line 114, in defaultErrback ConnectionDone, ConnectionLost) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 460, in trap self.raiseException() File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 488, in raiseException raise self.value.with_traceback(self.tb) twisted.protocols.amp.UnknownRemoteError: Code<UNKNOWN>: Unknown Error 2020-08-20 13:52:45,357 [DEBUG] Found a new channel, setting to: JXXX,('nXXX.onion', 6667) 2020-08-20 13:52:45,434 [DEBUG] Nick: JXXX has left. 2020-08-20 13:53:43,052 [DEBUG] Dynamic switch nick: JXXX 2020-08-20 13:55:25,035 [DEBUG] JXXX has dusty minsize, capping at 2730 2020-08-20 13:55:25,155 [DEBUG] JXXX has dusty minsize, capping at 2730 (...)
jmclient.storage.StorageError
def get_current_block_height(self): try: res = self.rpc("getblockcount", []) except JsonRpcError as e: log.error("Getblockcount RPC failed with: %i, %s" % (e.code, e.message)) res = None return res
def get_current_block_height(self): return self.rpc("getblockcount", [])
https://github.com/JoinMarket-Org/joinmarket-clientserver/issues/673
2020-08-20 13:51:53,349 [DEBUG] >>privmsg on darkscience: nick=JXXX cmd=pubkey msg=8XXX 2020-08-20 13:52:02,337 [DEBUG] mix depths that have enough = {0: XXX} 2020-08-20 13:52:02,338 [INFO] filling offer, mixdepth=0, amount=2XXX 2020-08-20 13:52:02,893 [INFO] sending output to address=3XXX Unhandled Error Traceback (most recent call last): File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1041, in _commandReceived deferred = self.dispatchCommand(box) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1099, in dispatchCommand return maybeDeferred(responder, box) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 151, in maybeDeferred result = f(*args, **kw) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1186, in doit return maybeDeferred(aCallable, **kw).addCallback( --- <exception caught here> --- File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 654, in _runCallbacks current.result = callback(current.result, *args, **kw) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1169, in checkKnownErrors key = error.trap(*command.allErrors) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 460, in trap self.raiseException() File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 488, in raiseException raise self.value.with_traceback(self.tb) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 151, in maybeDeferred result = f(*args, **kw) File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/client_protocol.py", line 242, in on_JM_AUTH_RECEIVED commitment, revelation, amount, kphex) File "/home/nv01/joinmarket-clientserver/jmbase/jmbase/support.py", line 280, in func_wrapper return func(inst, *newargs, **kwargs) File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/maker.py", line 105, in on_auth_received self.wallet_service.save_wallet() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet_service.py", line 769, in save_wallet self.wallet.save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 1531, in save super().save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 1838, in save super().save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 385, in save self._utxos.save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 182, in save self.storage.save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/storage.py", line 134, in save raise StorageError("Read-only storage cannot be saved.") jmclient.storage.StorageError: Read-only storage cannot be saved. Amp server or network failure unhandled by client application. Dropping connection! To avoid, add errbacks to ALL remote commands! Traceback (most recent call last): --- <exception caught here> --- File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 654, in _runCallbacks current.result = callback(current.result, *args, **kw) File "/home/nv01/joinmarket-clientserver/jmdaemon/jmdaemon/daemon_protocol.py", line 114, in defaultErrback ConnectionDone, ConnectionLost) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 460, in trap self.raiseException() File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 488, in raiseException raise self.value.with_traceback(self.tb) twisted.protocols.amp.UnknownRemoteError: Code<UNKNOWN>: Unknown Error 2020-08-20 13:52:45,357 [DEBUG] Found a new channel, setting to: JXXX,('nXXX.onion', 6667) 2020-08-20 13:52:45,434 [DEBUG] Nick: JXXX has left. 2020-08-20 13:53:43,052 [DEBUG] Dynamic switch nick: JXXX 2020-08-20 13:55:25,035 [DEBUG] JXXX has dusty minsize, capping at 2730 2020-08-20 13:55:25,155 [DEBUG] JXXX has dusty minsize, capping at 2730 (...)
jmclient.storage.StorageError
def __init__(self, wallet_service): self.active_orders = {} assert isinstance(wallet_service, WalletService) self.wallet_service = wallet_service self.nextoid = -1 self.offerlist = None self.sync_wait_loop = task.LoopingCall(self.try_to_create_my_orders) self.sync_wait_loop.start(2.0, now=False) self.aborted = False
def __init__(self, wallet_service): self.active_orders = {} assert isinstance(wallet_service, WalletService) self.wallet_service = wallet_service self.nextoid = -1 self.offerlist = None self.sync_wait_loop = task.LoopingCall(self.try_to_create_my_orders) self.sync_wait_loop.start(2.0) self.aborted = False
https://github.com/JoinMarket-Org/joinmarket-clientserver/issues/673
2020-08-20 13:51:53,349 [DEBUG] >>privmsg on darkscience: nick=JXXX cmd=pubkey msg=8XXX 2020-08-20 13:52:02,337 [DEBUG] mix depths that have enough = {0: XXX} 2020-08-20 13:52:02,338 [INFO] filling offer, mixdepth=0, amount=2XXX 2020-08-20 13:52:02,893 [INFO] sending output to address=3XXX Unhandled Error Traceback (most recent call last): File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1041, in _commandReceived deferred = self.dispatchCommand(box) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1099, in dispatchCommand return maybeDeferred(responder, box) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 151, in maybeDeferred result = f(*args, **kw) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1186, in doit return maybeDeferred(aCallable, **kw).addCallback( --- <exception caught here> --- File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 654, in _runCallbacks current.result = callback(current.result, *args, **kw) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1169, in checkKnownErrors key = error.trap(*command.allErrors) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 460, in trap self.raiseException() File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 488, in raiseException raise self.value.with_traceback(self.tb) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 151, in maybeDeferred result = f(*args, **kw) File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/client_protocol.py", line 242, in on_JM_AUTH_RECEIVED commitment, revelation, amount, kphex) File "/home/nv01/joinmarket-clientserver/jmbase/jmbase/support.py", line 280, in func_wrapper return func(inst, *newargs, **kwargs) File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/maker.py", line 105, in on_auth_received self.wallet_service.save_wallet() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet_service.py", line 769, in save_wallet self.wallet.save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 1531, in save super().save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 1838, in save super().save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 385, in save self._utxos.save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 182, in save self.storage.save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/storage.py", line 134, in save raise StorageError("Read-only storage cannot be saved.") jmclient.storage.StorageError: Read-only storage cannot be saved. Amp server or network failure unhandled by client application. Dropping connection! To avoid, add errbacks to ALL remote commands! Traceback (most recent call last): --- <exception caught here> --- File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 654, in _runCallbacks current.result = callback(current.result, *args, **kw) File "/home/nv01/joinmarket-clientserver/jmdaemon/jmdaemon/daemon_protocol.py", line 114, in defaultErrback ConnectionDone, ConnectionLost) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 460, in trap self.raiseException() File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 488, in raiseException raise self.value.with_traceback(self.tb) twisted.protocols.amp.UnknownRemoteError: Code<UNKNOWN>: Unknown Error 2020-08-20 13:52:45,357 [DEBUG] Found a new channel, setting to: JXXX,('nXXX.onion', 6667) 2020-08-20 13:52:45,434 [DEBUG] Nick: JXXX has left. 2020-08-20 13:53:43,052 [DEBUG] Dynamic switch nick: JXXX 2020-08-20 13:55:25,035 [DEBUG] JXXX has dusty minsize, capping at 2730 2020-08-20 13:55:25,155 [DEBUG] JXXX has dusty minsize, capping at 2730 (...)
jmclient.storage.StorageError
def try_to_create_my_orders(self): """Because wallet syncing is not synchronous(!), we cannot calculate our offers until we know the wallet contents, so poll until BlockchainInterface.wallet_synced is flagged as True. TODO: Use a deferred, probably. Note that create_my_orders() is defined by subclasses. """ if not self.wallet_service.synced: return self.offerlist = self.create_my_orders() self.sync_wait_loop.stop() if not self.offerlist: jlog.info("Failed to create offers, giving up.") stop_reactor() jlog.info("offerlist={}".format(self.offerlist))
def try_to_create_my_orders(self): """Because wallet syncing is not synchronous(!), we cannot calculate our offers until we know the wallet contents, so poll until BlockchainInterface.wallet_synced is flagged as True. TODO: Use a deferred, probably. Note that create_my_orders() is defined by subclasses. """ if not self.wallet_service.synced: return self.offerlist = self.create_my_orders() self.sync_wait_loop.stop() if not self.offerlist: jlog.info("Failed to create offers, giving up.") sys.exit(EXIT_FAILURE) jlog.info("offerlist={}".format(self.offerlist))
https://github.com/JoinMarket-Org/joinmarket-clientserver/issues/673
2020-08-20 13:51:53,349 [DEBUG] >>privmsg on darkscience: nick=JXXX cmd=pubkey msg=8XXX 2020-08-20 13:52:02,337 [DEBUG] mix depths that have enough = {0: XXX} 2020-08-20 13:52:02,338 [INFO] filling offer, mixdepth=0, amount=2XXX 2020-08-20 13:52:02,893 [INFO] sending output to address=3XXX Unhandled Error Traceback (most recent call last): File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1041, in _commandReceived deferred = self.dispatchCommand(box) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1099, in dispatchCommand return maybeDeferred(responder, box) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 151, in maybeDeferred result = f(*args, **kw) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1186, in doit return maybeDeferred(aCallable, **kw).addCallback( --- <exception caught here> --- File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 654, in _runCallbacks current.result = callback(current.result, *args, **kw) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1169, in checkKnownErrors key = error.trap(*command.allErrors) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 460, in trap self.raiseException() File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 488, in raiseException raise self.value.with_traceback(self.tb) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 151, in maybeDeferred result = f(*args, **kw) File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/client_protocol.py", line 242, in on_JM_AUTH_RECEIVED commitment, revelation, amount, kphex) File "/home/nv01/joinmarket-clientserver/jmbase/jmbase/support.py", line 280, in func_wrapper return func(inst, *newargs, **kwargs) File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/maker.py", line 105, in on_auth_received self.wallet_service.save_wallet() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet_service.py", line 769, in save_wallet self.wallet.save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 1531, in save super().save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 1838, in save super().save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 385, in save self._utxos.save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 182, in save self.storage.save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/storage.py", line 134, in save raise StorageError("Read-only storage cannot be saved.") jmclient.storage.StorageError: Read-only storage cannot be saved. Amp server or network failure unhandled by client application. Dropping connection! To avoid, add errbacks to ALL remote commands! Traceback (most recent call last): --- <exception caught here> --- File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 654, in _runCallbacks current.result = callback(current.result, *args, **kw) File "/home/nv01/joinmarket-clientserver/jmdaemon/jmdaemon/daemon_protocol.py", line 114, in defaultErrback ConnectionDone, ConnectionLost) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 460, in trap self.raiseException() File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 488, in raiseException raise self.value.with_traceback(self.tb) twisted.protocols.amp.UnknownRemoteError: Code<UNKNOWN>: Unknown Error 2020-08-20 13:52:45,357 [DEBUG] Found a new channel, setting to: JXXX,('nXXX.onion', 6667) 2020-08-20 13:52:45,434 [DEBUG] Nick: JXXX has left. 2020-08-20 13:53:43,052 [DEBUG] Dynamic switch nick: JXXX 2020-08-20 13:55:25,035 [DEBUG] JXXX has dusty minsize, capping at 2730 2020-08-20 13:55:25,155 [DEBUG] JXXX has dusty minsize, capping at 2730 (...)
jmclient.storage.StorageError
def __init__(self, wallet): # The two principal member variables # are the blockchaininterface instance, # which is currently global in JM but # could be more flexible in future, and # the JM wallet object. self.bci = jm_single().bc_interface # main loop used to check for transactions, instantiated # after wallet is synced: self.monitor_loop = None self.wallet = wallet self.synced = False # keep track of the quasi-real-time blockheight # (updated in main monitor loop) self.current_blockheight = None if self.bci is not None: if not self.update_blockheight(): # this accounts for the unusual case # where the application started up with # a functioning blockchain interface, but # that bci is now failing when we are starting # the wallet service. jlog.error( "Failure of RPC connection to Bitcoin Core in " "wallet service startup. Application cannot " "continue, shutting down." ) stop_reactor() else: jlog.warning( "No blockchain source available, " + "wallet tools will not show correct balances." ) # Dicts of registered callbacks, by type # and then by txinfo, for events # on transactions. self.callbacks = {} self.callbacks["all"] = [] self.callbacks["unconfirmed"] = {} self.callbacks["confirmed"] = {} self.restart_callback = None # transactions we are actively monitoring, # i.e. they are not new but we want to track: self.active_txids = [] # to ensure transactions are only processed once: self.processed_txids = [] self.set_autofreeze_warning_cb()
def __init__(self, wallet): # The two principal member variables # are the blockchaininterface instance, # which is currently global in JM but # could be more flexible in future, and # the JM wallet object. self.bci = jm_single().bc_interface # main loop used to check for transactions, instantiated # after wallet is synced: self.monitor_loop = None self.wallet = wallet self.synced = False # keep track of the quasi-real-time blockheight # (updated in main monitor loop) self.current_blockheight = None if self.bci is not None: if not self.update_blockheight(): # this accounts for the unusual case # where the application started up with # a functioning blockchain interface, but # that bci is now failing when we are starting # the wallet service. raise Exception( "WalletService failed to start due to inability to query block height." ) else: jlog.warning( "No blockchain source available, " + "wallet tools will not show correct balances." ) # Dicts of registered callbacks, by type # and then by txinfo, for events # on transactions. self.callbacks = {} self.callbacks["all"] = [] self.callbacks["unconfirmed"] = {} self.callbacks["confirmed"] = {} self.restart_callback = None # transactions we are actively monitoring, # i.e. they are not new but we want to track: self.active_txids = [] # to ensure transactions are only processed once: self.processed_txids = [] self.set_autofreeze_warning_cb()
https://github.com/JoinMarket-Org/joinmarket-clientserver/issues/673
2020-08-20 13:51:53,349 [DEBUG] >>privmsg on darkscience: nick=JXXX cmd=pubkey msg=8XXX 2020-08-20 13:52:02,337 [DEBUG] mix depths that have enough = {0: XXX} 2020-08-20 13:52:02,338 [INFO] filling offer, mixdepth=0, amount=2XXX 2020-08-20 13:52:02,893 [INFO] sending output to address=3XXX Unhandled Error Traceback (most recent call last): File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1041, in _commandReceived deferred = self.dispatchCommand(box) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1099, in dispatchCommand return maybeDeferred(responder, box) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 151, in maybeDeferred result = f(*args, **kw) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1186, in doit return maybeDeferred(aCallable, **kw).addCallback( --- <exception caught here> --- File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 654, in _runCallbacks current.result = callback(current.result, *args, **kw) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1169, in checkKnownErrors key = error.trap(*command.allErrors) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 460, in trap self.raiseException() File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 488, in raiseException raise self.value.with_traceback(self.tb) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 151, in maybeDeferred result = f(*args, **kw) File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/client_protocol.py", line 242, in on_JM_AUTH_RECEIVED commitment, revelation, amount, kphex) File "/home/nv01/joinmarket-clientserver/jmbase/jmbase/support.py", line 280, in func_wrapper return func(inst, *newargs, **kwargs) File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/maker.py", line 105, in on_auth_received self.wallet_service.save_wallet() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet_service.py", line 769, in save_wallet self.wallet.save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 1531, in save super().save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 1838, in save super().save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 385, in save self._utxos.save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 182, in save self.storage.save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/storage.py", line 134, in save raise StorageError("Read-only storage cannot be saved.") jmclient.storage.StorageError: Read-only storage cannot be saved. Amp server or network failure unhandled by client application. Dropping connection! To avoid, add errbacks to ALL remote commands! Traceback (most recent call last): --- <exception caught here> --- File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 654, in _runCallbacks current.result = callback(current.result, *args, **kw) File "/home/nv01/joinmarket-clientserver/jmdaemon/jmdaemon/daemon_protocol.py", line 114, in defaultErrback ConnectionDone, ConnectionLost) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 460, in trap self.raiseException() File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 488, in raiseException raise self.value.with_traceback(self.tb) twisted.protocols.amp.UnknownRemoteError: Code<UNKNOWN>: Unknown Error 2020-08-20 13:52:45,357 [DEBUG] Found a new channel, setting to: JXXX,('nXXX.onion', 6667) 2020-08-20 13:52:45,434 [DEBUG] Nick: JXXX has left. 2020-08-20 13:53:43,052 [DEBUG] Dynamic switch nick: JXXX 2020-08-20 13:55:25,035 [DEBUG] JXXX has dusty minsize, capping at 2730 2020-08-20 13:55:25,155 [DEBUG] JXXX has dusty minsize, capping at 2730 (...)
jmclient.storage.StorageError
def update_blockheight(self): """Can be called manually (on startup, or for tests) but will be called as part of main monitoring loop to ensure new transactions are added at the right height. Any failure of the RPC call must result in this returning False, otherwise return True (means self.current_blockheight has been correctly updated). """ def critical_error(): jlog.error("Critical error updating blockheight.") # this cleanup (a) closes the wallet, removing the lock # and (b) signals to clients that the service is no longer # in a running state, both of which can be useful # post reactor shutdown. self.stopService() stop_reactor() return False if self.current_blockheight: old_blockheight = self.current_blockheight else: old_blockheight = -1 try: self.current_blockheight = self.bci.get_current_block_height() except Exception as e: # This should never happen now, as we are catching every # possible Exception in jsonrpc or bci.rpc: return critical_error() if not self.current_blockheight: return critical_error() # We have received a new blockheight from Core, sanity check it: assert isinstance(self.current_blockheight, Integral) assert self.current_blockheight >= 0 if self.current_blockheight < old_blockheight: jlog.warn("Bitcoin Core is reporting a lower blockheight, possibly a reorg.") return True
def update_blockheight(self): """Can be called manually (on startup, or for tests) but will be called as part of main monitoring loop to ensure new transactions are added at the right height. Any failure of the RPC call must result in this returning False, otherwise return True (means self.current_blockheight has been correctly updated). """ def critical_error(): jlog.error("Failure to get blockheight from Bitcoin Core.") self.stopService() return False if self.current_blockheight: old_blockheight = self.current_blockheight else: old_blockheight = -1 try: self.current_blockheight = self.bci.get_current_block_height() except Exception as e: # This should never happen now, as we are catching every # possible Exception in jsonrpc or bci.rpc: return critical_error() if not self.current_blockheight: return critical_error() # We have received a new blockheight from Core, sanity check it: assert isinstance(self.current_blockheight, Integral) assert self.current_blockheight >= 0 if self.current_blockheight < old_blockheight: jlog.warn("Bitcoin Core is reporting a lower blockheight, possibly a reorg.") return True
https://github.com/JoinMarket-Org/joinmarket-clientserver/issues/673
2020-08-20 13:51:53,349 [DEBUG] >>privmsg on darkscience: nick=JXXX cmd=pubkey msg=8XXX 2020-08-20 13:52:02,337 [DEBUG] mix depths that have enough = {0: XXX} 2020-08-20 13:52:02,338 [INFO] filling offer, mixdepth=0, amount=2XXX 2020-08-20 13:52:02,893 [INFO] sending output to address=3XXX Unhandled Error Traceback (most recent call last): File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1041, in _commandReceived deferred = self.dispatchCommand(box) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1099, in dispatchCommand return maybeDeferred(responder, box) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 151, in maybeDeferred result = f(*args, **kw) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1186, in doit return maybeDeferred(aCallable, **kw).addCallback( --- <exception caught here> --- File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 654, in _runCallbacks current.result = callback(current.result, *args, **kw) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1169, in checkKnownErrors key = error.trap(*command.allErrors) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 460, in trap self.raiseException() File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 488, in raiseException raise self.value.with_traceback(self.tb) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 151, in maybeDeferred result = f(*args, **kw) File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/client_protocol.py", line 242, in on_JM_AUTH_RECEIVED commitment, revelation, amount, kphex) File "/home/nv01/joinmarket-clientserver/jmbase/jmbase/support.py", line 280, in func_wrapper return func(inst, *newargs, **kwargs) File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/maker.py", line 105, in on_auth_received self.wallet_service.save_wallet() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet_service.py", line 769, in save_wallet self.wallet.save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 1531, in save super().save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 1838, in save super().save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 385, in save self._utxos.save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 182, in save self.storage.save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/storage.py", line 134, in save raise StorageError("Read-only storage cannot be saved.") jmclient.storage.StorageError: Read-only storage cannot be saved. Amp server or network failure unhandled by client application. Dropping connection! To avoid, add errbacks to ALL remote commands! Traceback (most recent call last): --- <exception caught here> --- File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 654, in _runCallbacks current.result = callback(current.result, *args, **kw) File "/home/nv01/joinmarket-clientserver/jmdaemon/jmdaemon/daemon_protocol.py", line 114, in defaultErrback ConnectionDone, ConnectionLost) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 460, in trap self.raiseException() File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 488, in raiseException raise self.value.with_traceback(self.tb) twisted.protocols.amp.UnknownRemoteError: Code<UNKNOWN>: Unknown Error 2020-08-20 13:52:45,357 [DEBUG] Found a new channel, setting to: JXXX,('nXXX.onion', 6667) 2020-08-20 13:52:45,434 [DEBUG] Nick: JXXX has left. 2020-08-20 13:53:43,052 [DEBUG] Dynamic switch nick: JXXX 2020-08-20 13:55:25,035 [DEBUG] JXXX has dusty minsize, capping at 2730 2020-08-20 13:55:25,155 [DEBUG] JXXX has dusty minsize, capping at 2730 (...)
jmclient.storage.StorageError
def critical_error(): jlog.error("Critical error updating blockheight.") # this cleanup (a) closes the wallet, removing the lock # and (b) signals to clients that the service is no longer # in a running state, both of which can be useful # post reactor shutdown. self.stopService() stop_reactor() return False
def critical_error(): jlog.error("Failure to get blockheight from Bitcoin Core.") self.stopService() return False
https://github.com/JoinMarket-Org/joinmarket-clientserver/issues/673
2020-08-20 13:51:53,349 [DEBUG] >>privmsg on darkscience: nick=JXXX cmd=pubkey msg=8XXX 2020-08-20 13:52:02,337 [DEBUG] mix depths that have enough = {0: XXX} 2020-08-20 13:52:02,338 [INFO] filling offer, mixdepth=0, amount=2XXX 2020-08-20 13:52:02,893 [INFO] sending output to address=3XXX Unhandled Error Traceback (most recent call last): File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1041, in _commandReceived deferred = self.dispatchCommand(box) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1099, in dispatchCommand return maybeDeferred(responder, box) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 151, in maybeDeferred result = f(*args, **kw) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1186, in doit return maybeDeferred(aCallable, **kw).addCallback( --- <exception caught here> --- File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 654, in _runCallbacks current.result = callback(current.result, *args, **kw) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1169, in checkKnownErrors key = error.trap(*command.allErrors) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 460, in trap self.raiseException() File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 488, in raiseException raise self.value.with_traceback(self.tb) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 151, in maybeDeferred result = f(*args, **kw) File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/client_protocol.py", line 242, in on_JM_AUTH_RECEIVED commitment, revelation, amount, kphex) File "/home/nv01/joinmarket-clientserver/jmbase/jmbase/support.py", line 280, in func_wrapper return func(inst, *newargs, **kwargs) File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/maker.py", line 105, in on_auth_received self.wallet_service.save_wallet() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet_service.py", line 769, in save_wallet self.wallet.save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 1531, in save super().save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 1838, in save super().save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 385, in save self._utxos.save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 182, in save self.storage.save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/storage.py", line 134, in save raise StorageError("Read-only storage cannot be saved.") jmclient.storage.StorageError: Read-only storage cannot be saved. Amp server or network failure unhandled by client application. Dropping connection! To avoid, add errbacks to ALL remote commands! Traceback (most recent call last): --- <exception caught here> --- File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 654, in _runCallbacks current.result = callback(current.result, *args, **kw) File "/home/nv01/joinmarket-clientserver/jmdaemon/jmdaemon/daemon_protocol.py", line 114, in defaultErrback ConnectionDone, ConnectionLost) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 460, in trap self.raiseException() File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 488, in raiseException raise self.value.with_traceback(self.tb) twisted.protocols.amp.UnknownRemoteError: Code<UNKNOWN>: Unknown Error 2020-08-20 13:52:45,357 [DEBUG] Found a new channel, setting to: JXXX,('nXXX.onion', 6667) 2020-08-20 13:52:45,434 [DEBUG] Nick: JXXX has left. 2020-08-20 13:53:43,052 [DEBUG] Dynamic switch nick: JXXX 2020-08-20 13:55:25,035 [DEBUG] JXXX has dusty minsize, capping at 2730 2020-08-20 13:55:25,155 [DEBUG] JXXX has dusty minsize, capping at 2730 (...)
jmclient.storage.StorageError
def sync_unspent(self): st = time.time() # block height needs to be real time for addition to our utxos: current_blockheight = self.bci.get_current_block_height() if not current_blockheight: # this failure will shut down the application elsewhere, here # just give up: return wallet_name = self.get_wallet_name() self.reset_utxos() listunspent_args = [] if "listunspent_args" in jm_single().config.options("POLICY"): listunspent_args = ast.literal_eval( jm_single().config.get("POLICY", "listunspent_args") ) unspent_list = self.bci.rpc("listunspent", listunspent_args) # filter on label, but note (a) in certain circumstances (in- # wallet transfer) it is possible for the utxo to be labeled # with the external label, and (b) the wallet will know if it # belongs or not anyway (is_known_addr): our_unspent_list = [ x for x in unspent_list if ( self.bci.is_address_labeled(x, wallet_name) or self.bci.is_address_labeled(x, self.EXTERNAL_WALLET_LABEL) ) ] for utxo in our_unspent_list: if not self.is_known_addr(utxo["address"]): continue # The result of bitcoin core's listunspent RPC call does not have # a "height" field, only "confirmations". # But the result of scantxoutset used in no-history sync does # have "height". if "height" in utxo: height = utxo["height"] else: height = None # wallet's utxo database needs to store an absolute rather # than relative height measure: confs = int(utxo["confirmations"]) if confs < 0: jlog.warning("Utxo not added, has a conflict: " + str(utxo)) continue if confs >= 1: height = current_blockheight - confs + 1 self._add_unspent_txo(utxo, height) et = time.time() jlog.debug("bitcoind sync_unspent took " + str((et - st)) + "sec")
def sync_unspent(self): st = time.time() # block height needs to be real time for addition to our utxos: current_blockheight = self.bci.get_current_block_height() wallet_name = self.get_wallet_name() self.reset_utxos() listunspent_args = [] if "listunspent_args" in jm_single().config.options("POLICY"): listunspent_args = ast.literal_eval( jm_single().config.get("POLICY", "listunspent_args") ) unspent_list = self.bci.rpc("listunspent", listunspent_args) # filter on label, but note (a) in certain circumstances (in- # wallet transfer) it is possible for the utxo to be labeled # with the external label, and (b) the wallet will know if it # belongs or not anyway (is_known_addr): our_unspent_list = [ x for x in unspent_list if ( self.bci.is_address_labeled(x, wallet_name) or self.bci.is_address_labeled(x, self.EXTERNAL_WALLET_LABEL) ) ] for utxo in our_unspent_list: if not self.is_known_addr(utxo["address"]): continue # The result of bitcoin core's listunspent RPC call does not have # a "height" field, only "confirmations". # But the result of scantxoutset used in no-history sync does # have "height". if "height" in utxo: height = utxo["height"] else: height = None # wallet's utxo database needs to store an absolute rather # than relative height measure: confs = int(utxo["confirmations"]) if confs < 0: jlog.warning("Utxo not added, has a conflict: " + str(utxo)) continue if confs >= 1: height = current_blockheight - confs + 1 self._add_unspent_txo(utxo, height) et = time.time() jlog.debug("bitcoind sync_unspent took " + str((et - st)) + "sec")
https://github.com/JoinMarket-Org/joinmarket-clientserver/issues/673
2020-08-20 13:51:53,349 [DEBUG] >>privmsg on darkscience: nick=JXXX cmd=pubkey msg=8XXX 2020-08-20 13:52:02,337 [DEBUG] mix depths that have enough = {0: XXX} 2020-08-20 13:52:02,338 [INFO] filling offer, mixdepth=0, amount=2XXX 2020-08-20 13:52:02,893 [INFO] sending output to address=3XXX Unhandled Error Traceback (most recent call last): File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1041, in _commandReceived deferred = self.dispatchCommand(box) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1099, in dispatchCommand return maybeDeferred(responder, box) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 151, in maybeDeferred result = f(*args, **kw) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1186, in doit return maybeDeferred(aCallable, **kw).addCallback( --- <exception caught here> --- File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 654, in _runCallbacks current.result = callback(current.result, *args, **kw) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1169, in checkKnownErrors key = error.trap(*command.allErrors) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 460, in trap self.raiseException() File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 488, in raiseException raise self.value.with_traceback(self.tb) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 151, in maybeDeferred result = f(*args, **kw) File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/client_protocol.py", line 242, in on_JM_AUTH_RECEIVED commitment, revelation, amount, kphex) File "/home/nv01/joinmarket-clientserver/jmbase/jmbase/support.py", line 280, in func_wrapper return func(inst, *newargs, **kwargs) File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/maker.py", line 105, in on_auth_received self.wallet_service.save_wallet() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet_service.py", line 769, in save_wallet self.wallet.save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 1531, in save super().save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 1838, in save super().save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 385, in save self._utxos.save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 182, in save self.storage.save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/storage.py", line 134, in save raise StorageError("Read-only storage cannot be saved.") jmclient.storage.StorageError: Read-only storage cannot be saved. Amp server or network failure unhandled by client application. Dropping connection! To avoid, add errbacks to ALL remote commands! Traceback (most recent call last): --- <exception caught here> --- File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 654, in _runCallbacks current.result = callback(current.result, *args, **kw) File "/home/nv01/joinmarket-clientserver/jmdaemon/jmdaemon/daemon_protocol.py", line 114, in defaultErrback ConnectionDone, ConnectionLost) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 460, in trap self.raiseException() File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 488, in raiseException raise self.value.with_traceback(self.tb) twisted.protocols.amp.UnknownRemoteError: Code<UNKNOWN>: Unknown Error 2020-08-20 13:52:45,357 [DEBUG] Found a new channel, setting to: JXXX,('nXXX.onion', 6667) 2020-08-20 13:52:45,434 [DEBUG] Nick: JXXX has left. 2020-08-20 13:53:43,052 [DEBUG] Dynamic switch nick: JXXX 2020-08-20 13:55:25,035 [DEBUG] JXXX has dusty minsize, capping at 2730 2020-08-20 13:55:25,155 [DEBUG] JXXX has dusty minsize, capping at 2730 (...)
jmclient.storage.StorageError
def closeEvent(self, event): quit_msg = "Are you sure you want to quit?" reply = JMQtMessageBox(self, quit_msg, mbtype="question") if reply == QMessageBox.Yes: event.accept() if self.reactor.threadpool is not None: self.reactor.threadpool.stop() stop_reactor() else: event.ignore()
def closeEvent(self, event): quit_msg = "Are you sure you want to quit?" reply = JMQtMessageBox(self, quit_msg, mbtype="question") if reply == QMessageBox.Yes: event.accept() if self.reactor.threadpool is not None: self.reactor.threadpool.stop() if reactor.running: self.reactor.stop() else: event.ignore()
https://github.com/JoinMarket-Org/joinmarket-clientserver/issues/673
2020-08-20 13:51:53,349 [DEBUG] >>privmsg on darkscience: nick=JXXX cmd=pubkey msg=8XXX 2020-08-20 13:52:02,337 [DEBUG] mix depths that have enough = {0: XXX} 2020-08-20 13:52:02,338 [INFO] filling offer, mixdepth=0, amount=2XXX 2020-08-20 13:52:02,893 [INFO] sending output to address=3XXX Unhandled Error Traceback (most recent call last): File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1041, in _commandReceived deferred = self.dispatchCommand(box) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1099, in dispatchCommand return maybeDeferred(responder, box) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 151, in maybeDeferred result = f(*args, **kw) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1186, in doit return maybeDeferred(aCallable, **kw).addCallback( --- <exception caught here> --- File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 654, in _runCallbacks current.result = callback(current.result, *args, **kw) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1169, in checkKnownErrors key = error.trap(*command.allErrors) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 460, in trap self.raiseException() File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 488, in raiseException raise self.value.with_traceback(self.tb) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 151, in maybeDeferred result = f(*args, **kw) File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/client_protocol.py", line 242, in on_JM_AUTH_RECEIVED commitment, revelation, amount, kphex) File "/home/nv01/joinmarket-clientserver/jmbase/jmbase/support.py", line 280, in func_wrapper return func(inst, *newargs, **kwargs) File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/maker.py", line 105, in on_auth_received self.wallet_service.save_wallet() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet_service.py", line 769, in save_wallet self.wallet.save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 1531, in save super().save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 1838, in save super().save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 385, in save self._utxos.save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 182, in save self.storage.save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/storage.py", line 134, in save raise StorageError("Read-only storage cannot be saved.") jmclient.storage.StorageError: Read-only storage cannot be saved. Amp server or network failure unhandled by client application. Dropping connection! To avoid, add errbacks to ALL remote commands! Traceback (most recent call last): --- <exception caught here> --- File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 654, in _runCallbacks current.result = callback(current.result, *args, **kw) File "/home/nv01/joinmarket-clientserver/jmdaemon/jmdaemon/daemon_protocol.py", line 114, in defaultErrback ConnectionDone, ConnectionLost) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 460, in trap self.raiseException() File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 488, in raiseException raise self.value.with_traceback(self.tb) twisted.protocols.amp.UnknownRemoteError: Code<UNKNOWN>: Unknown Error 2020-08-20 13:52:45,357 [DEBUG] Found a new channel, setting to: JXXX,('nXXX.onion', 6667) 2020-08-20 13:52:45,434 [DEBUG] Nick: JXXX has left. 2020-08-20 13:53:43,052 [DEBUG] Dynamic switch nick: JXXX 2020-08-20 13:55:25,035 [DEBUG] JXXX has dusty minsize, capping at 2730 2020-08-20 13:55:25,155 [DEBUG] JXXX has dusty minsize, capping at 2730 (...)
jmclient.storage.StorageError
def wallet_tool_main(wallet_root_path): """Main wallet tool script function; returned is a string (output or error)""" parser = get_wallettool_parser() (options, args) = parser.parse_args() load_program_config(config_path=options.datadir) check_regtest(blockchain_start=False) # full path to the wallets/ subdirectory in the user data area: wallet_root_path = os.path.join(jm_single().datadir, wallet_root_path) noseed_methods = ["generate", "recover", "createwatchonly"] methods = [ "display", "displayall", "summary", "showseed", "importprivkey", "history", "showutxos", "freeze", "gettimelockaddress", "addtxoutproof", "changepass", ] methods.extend(noseed_methods) noscan_methods = [ "showseed", "importprivkey", "dumpprivkey", "signmessage", "changepass", ] readonly_methods = [ "display", "displayall", "summary", "showseed", "history", "showutxos", "dumpprivkey", "signmessage", "gettimelockaddress", ] if len(args) < 1: parser.error("Needs a wallet file or method") sys.exit(EXIT_ARGERROR) if options.mixdepth is not None and options.mixdepth < 0: parser.error("Must have at least one mixdepth.") sys.exit(EXIT_ARGERROR) if args[0] in noseed_methods: method = args[0] if options.mixdepth is None: options.mixdepth = DEFAULT_MIXDEPTH else: seed = args[0] wallet_path = get_wallet_path(seed, wallet_root_path) method = "display" if len(args) == 1 else args[1].lower() read_only = method in readonly_methods # special case needed for fidelity bond burner outputs # maybe theres a better way to do this if options.recoversync: read_only = False wallet = open_test_wallet_maybe( wallet_path, seed, options.mixdepth, read_only=read_only, wallet_password_stdin=options.wallet_password_stdin, gap_limit=options.gaplimit, ) # this object is only to respect the layering, # the service will not be started since this is a synchronous script: wallet_service = WalletService(wallet) if wallet_service.rpc_error: sys.exit(EXIT_FAILURE) if method not in noscan_methods and jm_single().bc_interface is not None: # if nothing was configured, we override bitcoind's options so that # unconfirmed balance is included in the wallet display by default if "listunspent_args" not in jm_single().config.options("POLICY"): jm_single().config.set("POLICY", "listunspent_args", "[0]") while True: if wallet_service.sync_wallet(fast=not options.recoversync): break # Now the wallet/data is prepared, execute the script according to the method if method == "display": return wallet_display(wallet_service, options.showprivkey) elif method == "displayall": return wallet_display(wallet_service, options.showprivkey, displayall=True) elif method == "summary": return wallet_display(wallet_service, options.showprivkey, summarized=True) elif method == "history": if not isinstance(jm_single().bc_interface, BitcoinCoreInterface): jmprint( "showing history only available when using the Bitcoin Core " + "blockchain interface", "error", ) sys.exit(EXIT_ARGERROR) else: return wallet_fetch_history(wallet_service, options) elif method == "generate": retval = wallet_generate_recover( "generate", wallet_root_path, mixdepth=options.mixdepth ) return "Generated wallet OK" if retval else "Failed" elif method == "recover": retval = wallet_generate_recover( "recover", wallet_root_path, mixdepth=options.mixdepth ) return "Recovered wallet OK" if retval else "Failed" elif method == "changepass": retval = wallet_change_passphrase(wallet_service) return "Changed encryption passphrase OK" if retval else "Failed" elif method == "showutxos": return wallet_showutxos(wallet_service, options.showprivkey) elif method == "showseed": return wallet_showseed(wallet_service) elif method == "dumpprivkey": return wallet_dumpprivkey(wallet_service, options.hd_path) elif method == "importprivkey": # note: must be interactive (security) if options.mixdepth is None: parser.error("You need to specify a mixdepth with -m") wallet_importprivkey( wallet_service, options.mixdepth, map_key_type(options.key_type) ) return "Key import completed." elif method == "signmessage": if len(args) < 3: jmprint("Must provide message to sign", "error") sys.exit(EXIT_ARGERROR) return wallet_signmessage(wallet_service, options.hd_path, args[2]) elif method == "freeze": return wallet_freezeutxo(wallet_service, options.mixdepth) elif method == "gettimelockaddress": if len(args) < 3: jmprint("Must have locktime value yyyy-mm. For example 2021-03", "error") sys.exit(EXIT_ARGERROR) return wallet_gettimelockaddress(wallet_service.wallet, args[2]) elif method == "addtxoutproof": if len(args) < 3: jmprint( "Must have txout proof, which is the output of Bitcoin " + "Core's RPC call gettxoutproof", "error", ) sys.exit(EXIT_ARGERROR) return wallet_addtxoutproof(wallet_service, options.hd_path, args[2]) elif method == "createwatchonly": if len(args) < 2: jmprint("args: [master public key]", "error") sys.exit(EXIT_ARGERROR) return wallet_createwatchonly(wallet_root_path, args[1]) else: parser.error("Unknown wallet-tool method: " + method) sys.exit(EXIT_ARGERROR)
def wallet_tool_main(wallet_root_path): """Main wallet tool script function; returned is a string (output or error)""" parser = get_wallettool_parser() (options, args) = parser.parse_args() load_program_config(config_path=options.datadir) check_regtest(blockchain_start=False) # full path to the wallets/ subdirectory in the user data area: wallet_root_path = os.path.join(jm_single().datadir, wallet_root_path) noseed_methods = ["generate", "recover", "createwatchonly"] methods = [ "display", "displayall", "summary", "showseed", "importprivkey", "history", "showutxos", "freeze", "gettimelockaddress", "addtxoutproof", "changepass", ] methods.extend(noseed_methods) noscan_methods = [ "showseed", "importprivkey", "dumpprivkey", "signmessage", "changepass", ] readonly_methods = [ "display", "displayall", "summary", "showseed", "history", "showutxos", "dumpprivkey", "signmessage", "gettimelockaddress", ] if len(args) < 1: parser.error("Needs a wallet file or method") sys.exit(EXIT_ARGERROR) if options.mixdepth is not None and options.mixdepth < 0: parser.error("Must have at least one mixdepth.") sys.exit(EXIT_ARGERROR) if args[0] in noseed_methods: method = args[0] if options.mixdepth is None: options.mixdepth = DEFAULT_MIXDEPTH else: seed = args[0] wallet_path = get_wallet_path(seed, wallet_root_path) method = "display" if len(args) == 1 else args[1].lower() read_only = method in readonly_methods # special case needed for fidelity bond burner outputs # maybe theres a better way to do this if options.recoversync: read_only = False wallet = open_test_wallet_maybe( wallet_path, seed, options.mixdepth, read_only=read_only, wallet_password_stdin=options.wallet_password_stdin, gap_limit=options.gaplimit, ) # this object is only to respect the layering, # the service will not be started since this is a synchronous script: wallet_service = WalletService(wallet) if method not in noscan_methods and jm_single().bc_interface is not None: # if nothing was configured, we override bitcoind's options so that # unconfirmed balance is included in the wallet display by default if "listunspent_args" not in jm_single().config.options("POLICY"): jm_single().config.set("POLICY", "listunspent_args", "[0]") while True: if wallet_service.sync_wallet(fast=not options.recoversync): break # Now the wallet/data is prepared, execute the script according to the method if method == "display": return wallet_display(wallet_service, options.showprivkey) elif method == "displayall": return wallet_display(wallet_service, options.showprivkey, displayall=True) elif method == "summary": return wallet_display(wallet_service, options.showprivkey, summarized=True) elif method == "history": if not isinstance(jm_single().bc_interface, BitcoinCoreInterface): jmprint( "showing history only available when using the Bitcoin Core " + "blockchain interface", "error", ) sys.exit(EXIT_ARGERROR) else: return wallet_fetch_history(wallet_service, options) elif method == "generate": retval = wallet_generate_recover( "generate", wallet_root_path, mixdepth=options.mixdepth ) return "Generated wallet OK" if retval else "Failed" elif method == "recover": retval = wallet_generate_recover( "recover", wallet_root_path, mixdepth=options.mixdepth ) return "Recovered wallet OK" if retval else "Failed" elif method == "changepass": retval = wallet_change_passphrase(wallet_service) return "Changed encryption passphrase OK" if retval else "Failed" elif method == "showutxos": return wallet_showutxos(wallet_service, options.showprivkey) elif method == "showseed": return wallet_showseed(wallet_service) elif method == "dumpprivkey": return wallet_dumpprivkey(wallet_service, options.hd_path) elif method == "importprivkey": # note: must be interactive (security) if options.mixdepth is None: parser.error("You need to specify a mixdepth with -m") wallet_importprivkey( wallet_service, options.mixdepth, map_key_type(options.key_type) ) return "Key import completed." elif method == "signmessage": if len(args) < 3: jmprint("Must provide message to sign", "error") sys.exit(EXIT_ARGERROR) return wallet_signmessage(wallet_service, options.hd_path, args[2]) elif method == "freeze": return wallet_freezeutxo(wallet_service, options.mixdepth) elif method == "gettimelockaddress": if len(args) < 3: jmprint("Must have locktime value yyyy-mm. For example 2021-03", "error") sys.exit(EXIT_ARGERROR) return wallet_gettimelockaddress(wallet_service.wallet, args[2]) elif method == "addtxoutproof": if len(args) < 3: jmprint( "Must have txout proof, which is the output of Bitcoin " + "Core's RPC call gettxoutproof", "error", ) sys.exit(EXIT_ARGERROR) return wallet_addtxoutproof(wallet_service, options.hd_path, args[2]) elif method == "createwatchonly": if len(args) < 2: jmprint("args: [master public key]", "error") sys.exit(EXIT_ARGERROR) return wallet_createwatchonly(wallet_root_path, args[1]) else: parser.error("Unknown wallet-tool method: " + method) sys.exit(EXIT_ARGERROR)
https://github.com/JoinMarket-Org/joinmarket-clientserver/issues/673
2020-08-20 13:51:53,349 [DEBUG] >>privmsg on darkscience: nick=JXXX cmd=pubkey msg=8XXX 2020-08-20 13:52:02,337 [DEBUG] mix depths that have enough = {0: XXX} 2020-08-20 13:52:02,338 [INFO] filling offer, mixdepth=0, amount=2XXX 2020-08-20 13:52:02,893 [INFO] sending output to address=3XXX Unhandled Error Traceback (most recent call last): File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1041, in _commandReceived deferred = self.dispatchCommand(box) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1099, in dispatchCommand return maybeDeferred(responder, box) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 151, in maybeDeferred result = f(*args, **kw) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1186, in doit return maybeDeferred(aCallable, **kw).addCallback( --- <exception caught here> --- File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 654, in _runCallbacks current.result = callback(current.result, *args, **kw) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1169, in checkKnownErrors key = error.trap(*command.allErrors) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 460, in trap self.raiseException() File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 488, in raiseException raise self.value.with_traceback(self.tb) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 151, in maybeDeferred result = f(*args, **kw) File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/client_protocol.py", line 242, in on_JM_AUTH_RECEIVED commitment, revelation, amount, kphex) File "/home/nv01/joinmarket-clientserver/jmbase/jmbase/support.py", line 280, in func_wrapper return func(inst, *newargs, **kwargs) File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/maker.py", line 105, in on_auth_received self.wallet_service.save_wallet() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet_service.py", line 769, in save_wallet self.wallet.save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 1531, in save super().save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 1838, in save super().save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 385, in save self._utxos.save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 182, in save self.storage.save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/storage.py", line 134, in save raise StorageError("Read-only storage cannot be saved.") jmclient.storage.StorageError: Read-only storage cannot be saved. Amp server or network failure unhandled by client application. Dropping connection! To avoid, add errbacks to ALL remote commands! Traceback (most recent call last): --- <exception caught here> --- File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 654, in _runCallbacks current.result = callback(current.result, *args, **kw) File "/home/nv01/joinmarket-clientserver/jmdaemon/jmdaemon/daemon_protocol.py", line 114, in defaultErrback ConnectionDone, ConnectionLost) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 460, in trap self.raiseException() File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 488, in raiseException raise self.value.with_traceback(self.tb) twisted.protocols.amp.UnknownRemoteError: Code<UNKNOWN>: Unknown Error 2020-08-20 13:52:45,357 [DEBUG] Found a new channel, setting to: JXXX,('nXXX.onion', 6667) 2020-08-20 13:52:45,434 [DEBUG] Nick: JXXX has left. 2020-08-20 13:53:43,052 [DEBUG] Dynamic switch nick: JXXX 2020-08-20 13:55:25,035 [DEBUG] JXXX has dusty minsize, capping at 2730 2020-08-20 13:55:25,155 [DEBUG] JXXX has dusty minsize, capping at 2730 (...)
jmclient.storage.StorageError
def main(): parser = OptionParser( usage="usage: %prog [options] [txid:n]", description="Adds one or more utxos to the list that can be used to make " "commitments for anti-snooping. Note that this utxo, and its " "PUBkey, will be revealed to makers, so consider the privacy " "implication. " "It may be useful to those who are having trouble making " "coinjoins due to several unsuccessful attempts (especially " "if your joinmarket wallet is new). " "'Utxo' means unspent transaction output, it must not " "already be spent. " "The options -w, -r and -R offer ways to load these utxos " "from a file or wallet. " "If you enter a single utxo without these options, you will be " "prompted to enter the private key here - it must be in " "WIF compressed format. " "BE CAREFUL about handling private keys! " "Don't do this in insecure environments. " "Also note this ONLY works for standard (p2pkh or p2sh-p2wpkh) utxos.", ) add_base_options(parser) parser.add_option( "-r", "--read-from-file", action="store", type="str", dest="in_file", help="name of plain text csv file containing utxos, one per line, format: " "txid:N, WIF-compressed-privkey", ) parser.add_option( "-R", "--read-from-json", action="store", type="str", dest="in_json", help="name of json formatted file containing utxos with private keys, as " 'output from "python wallet-tool.py -p walletname showutxos"', ) parser.add_option( "-w", "--load-wallet", action="store", type="str", dest="loadwallet", help="name of wallet from which to load utxos and use as commitments.", ) parser.add_option( "-g", "--gap-limit", action="store", type="int", dest="gaplimit", default=6, help="Only to be used with -w; gap limit for Joinmarket wallet, default 6.", ) parser.add_option( "-M", "--max-mixdepth", action="store", type="int", dest="maxmixdepth", default=5, help="Only to be used with -w; number of mixdepths for wallet, default 5.", ) parser.add_option( "-d", "--delete-external", action="store_true", dest="delete_ext", help="deletes the current list of external commitment utxos", default=False, ) parser.add_option( "-v", "--validate-utxos", action="store_true", dest="validate", help="validate the utxos and pubkeys provided against the blockchain", default=False, ) parser.add_option( "-o", "--validate-only", action="store_true", dest="vonly", help="only validate the provided utxos (file or command line), not add", default=False, ) (options, args) = parser.parse_args() load_program_config(config_path=options.datadir) # TODO; sort out "commit file location" global so this script can # run without this hardcoding: utxo_data = [] if options.delete_ext: other = options.in_file or options.in_json or options.loadwallet if len(args) > 0 or other: if ( input( "You have chosen to delete commitments, other arguments " "will be ignored; continue? (y/n)" ) != "y" ): jmprint("Quitting", "warning") sys.exit(EXIT_SUCCESS) c, e = get_podle_commitments() jmprint(pformat(e), "info") if input("You will remove the above commitments; are you sure? (y/n): ") != "y": jmprint("Quitting", "warning") sys.exit(EXIT_SUCCESS) update_commitments(external_to_remove=e) jmprint("Commitments deleted.", "important") sys.exit(EXIT_SUCCESS) # Three options (-w, -r, -R) for loading utxo and privkey pairs from a wallet, # csv file or json file. if options.loadwallet: wallet_path = get_wallet_path(options.loadwallet) wallet = open_wallet(wallet_path, gap_limit=options.gaplimit) wallet_service = WalletService(wallet) if wallet_service.rpc_error: sys.exit(EXIT_FAILURE) while True: if wallet_service.sync_wallet(fast=not options.recoversync): break # minor note: adding a utxo from an external wallet for commitments, we # default to not allowing disabled utxos to avoid a privacy leak, so the # user would have to explicitly enable. for md, utxos in wallet_service.get_utxos_by_mixdepth(hexfmt=False).items(): for (txid, index), utxo in utxos.items(): txhex = binascii.hexlify(txid).decode("ascii") + ":" + str(index) wif = wallet_service.get_wif_path(utxo["path"]) utxo_data.append((txhex, wif)) elif options.in_file: with open(options.in_file, "rb") as f: utxo_info = f.readlines() for ul in utxo_info: ul = ul.rstrip() if ul: u, priv = get_utxo_info(ul) if not u: quit(parser, "Failed to parse utxo info: " + str(ul)) utxo_data.append((u, priv)) elif options.in_json: if not os.path.isfile(options.in_json): jmprint("File: " + options.in_json + " not found.", "error") sys.exit(EXIT_FAILURE) with open(options.in_json, "rb") as f: try: utxo_json = json.loads(f.read()) except: jmprint("Failed to read json from " + options.in_json, "error") sys.exit(EXIT_FAILURE) for u, pva in iteritems(utxo_json): utxo_data.append((u, pva["privkey"])) elif len(args) == 1: u = args[0] priv = input("input private key for " + u + ", in WIF compressed format : ") u, priv = get_utxo_info(",".join([u, priv])) if not u: quit(parser, "Failed to parse utxo info: " + u) utxo_data.append((u, priv)) else: quit(parser, "Invalid syntax") if options.validate or options.vonly: sw = False if jm_single().config.get("POLICY", "segwit") == "false" else True if not validate_utxo_data(utxo_data, segwit=sw): quit(parser, "Utxos did not validate, quitting") if options.vonly: sys.exit(EXIT_ARGERROR) # We are adding utxos to the external list assert len(utxo_data) add_ext_commitments(utxo_data)
def main(): parser = OptionParser( usage="usage: %prog [options] [txid:n]", description="Adds one or more utxos to the list that can be used to make " "commitments for anti-snooping. Note that this utxo, and its " "PUBkey, will be revealed to makers, so consider the privacy " "implication. " "It may be useful to those who are having trouble making " "coinjoins due to several unsuccessful attempts (especially " "if your joinmarket wallet is new). " "'Utxo' means unspent transaction output, it must not " "already be spent. " "The options -w, -r and -R offer ways to load these utxos " "from a file or wallet. " "If you enter a single utxo without these options, you will be " "prompted to enter the private key here - it must be in " "WIF compressed format. " "BE CAREFUL about handling private keys! " "Don't do this in insecure environments. " "Also note this ONLY works for standard (p2pkh or p2sh-p2wpkh) utxos.", ) add_base_options(parser) parser.add_option( "-r", "--read-from-file", action="store", type="str", dest="in_file", help="name of plain text csv file containing utxos, one per line, format: " "txid:N, WIF-compressed-privkey", ) parser.add_option( "-R", "--read-from-json", action="store", type="str", dest="in_json", help="name of json formatted file containing utxos with private keys, as " 'output from "python wallet-tool.py -p walletname showutxos"', ) parser.add_option( "-w", "--load-wallet", action="store", type="str", dest="loadwallet", help="name of wallet from which to load utxos and use as commitments.", ) parser.add_option( "-g", "--gap-limit", action="store", type="int", dest="gaplimit", default=6, help="Only to be used with -w; gap limit for Joinmarket wallet, default 6.", ) parser.add_option( "-M", "--max-mixdepth", action="store", type="int", dest="maxmixdepth", default=5, help="Only to be used with -w; number of mixdepths for wallet, default 5.", ) parser.add_option( "-d", "--delete-external", action="store_true", dest="delete_ext", help="deletes the current list of external commitment utxos", default=False, ) parser.add_option( "-v", "--validate-utxos", action="store_true", dest="validate", help="validate the utxos and pubkeys provided against the blockchain", default=False, ) parser.add_option( "-o", "--validate-only", action="store_true", dest="vonly", help="only validate the provided utxos (file or command line), not add", default=False, ) (options, args) = parser.parse_args() load_program_config(config_path=options.datadir) # TODO; sort out "commit file location" global so this script can # run without this hardcoding: utxo_data = [] if options.delete_ext: other = options.in_file or options.in_json or options.loadwallet if len(args) > 0 or other: if ( input( "You have chosen to delete commitments, other arguments " "will be ignored; continue? (y/n)" ) != "y" ): jmprint("Quitting", "warning") sys.exit(EXIT_SUCCESS) c, e = get_podle_commitments() jmprint(pformat(e), "info") if input("You will remove the above commitments; are you sure? (y/n): ") != "y": jmprint("Quitting", "warning") sys.exit(EXIT_SUCCESS) update_commitments(external_to_remove=e) jmprint("Commitments deleted.", "important") sys.exit(EXIT_SUCCESS) # Three options (-w, -r, -R) for loading utxo and privkey pairs from a wallet, # csv file or json file. if options.loadwallet: wallet_path = get_wallet_path(options.loadwallet) wallet = open_wallet(wallet_path, gap_limit=options.gaplimit) wallet_service = WalletService(wallet) while True: if wallet_service.sync_wallet(fast=not options.recoversync): break # minor note: adding a utxo from an external wallet for commitments, we # default to not allowing disabled utxos to avoid a privacy leak, so the # user would have to explicitly enable. for md, utxos in wallet_service.get_utxos_by_mixdepth(hexfmt=False).items(): for (txid, index), utxo in utxos.items(): txhex = binascii.hexlify(txid).decode("ascii") + ":" + str(index) wif = wallet_service.get_wif_path(utxo["path"]) utxo_data.append((txhex, wif)) elif options.in_file: with open(options.in_file, "rb") as f: utxo_info = f.readlines() for ul in utxo_info: ul = ul.rstrip() if ul: u, priv = get_utxo_info(ul) if not u: quit(parser, "Failed to parse utxo info: " + str(ul)) utxo_data.append((u, priv)) elif options.in_json: if not os.path.isfile(options.in_json): jmprint("File: " + options.in_json + " not found.", "error") sys.exit(EXIT_FAILURE) with open(options.in_json, "rb") as f: try: utxo_json = json.loads(f.read()) except: jmprint("Failed to read json from " + options.in_json, "error") sys.exit(EXIT_FAILURE) for u, pva in iteritems(utxo_json): utxo_data.append((u, pva["privkey"])) elif len(args) == 1: u = args[0] priv = input("input private key for " + u + ", in WIF compressed format : ") u, priv = get_utxo_info(",".join([u, priv])) if not u: quit(parser, "Failed to parse utxo info: " + u) utxo_data.append((u, priv)) else: quit(parser, "Invalid syntax") if options.validate or options.vonly: sw = False if jm_single().config.get("POLICY", "segwit") == "false" else True if not validate_utxo_data(utxo_data, segwit=sw): quit(parser, "Utxos did not validate, quitting") if options.vonly: sys.exit(EXIT_ARGERROR) # We are adding utxos to the external list assert len(utxo_data) add_ext_commitments(utxo_data)
https://github.com/JoinMarket-Org/joinmarket-clientserver/issues/673
2020-08-20 13:51:53,349 [DEBUG] >>privmsg on darkscience: nick=JXXX cmd=pubkey msg=8XXX 2020-08-20 13:52:02,337 [DEBUG] mix depths that have enough = {0: XXX} 2020-08-20 13:52:02,338 [INFO] filling offer, mixdepth=0, amount=2XXX 2020-08-20 13:52:02,893 [INFO] sending output to address=3XXX Unhandled Error Traceback (most recent call last): File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1041, in _commandReceived deferred = self.dispatchCommand(box) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1099, in dispatchCommand return maybeDeferred(responder, box) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 151, in maybeDeferred result = f(*args, **kw) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1186, in doit return maybeDeferred(aCallable, **kw).addCallback( --- <exception caught here> --- File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 654, in _runCallbacks current.result = callback(current.result, *args, **kw) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1169, in checkKnownErrors key = error.trap(*command.allErrors) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 460, in trap self.raiseException() File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 488, in raiseException raise self.value.with_traceback(self.tb) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 151, in maybeDeferred result = f(*args, **kw) File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/client_protocol.py", line 242, in on_JM_AUTH_RECEIVED commitment, revelation, amount, kphex) File "/home/nv01/joinmarket-clientserver/jmbase/jmbase/support.py", line 280, in func_wrapper return func(inst, *newargs, **kwargs) File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/maker.py", line 105, in on_auth_received self.wallet_service.save_wallet() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet_service.py", line 769, in save_wallet self.wallet.save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 1531, in save super().save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 1838, in save super().save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 385, in save self._utxos.save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 182, in save self.storage.save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/storage.py", line 134, in save raise StorageError("Read-only storage cannot be saved.") jmclient.storage.StorageError: Read-only storage cannot be saved. Amp server or network failure unhandled by client application. Dropping connection! To avoid, add errbacks to ALL remote commands! Traceback (most recent call last): --- <exception caught here> --- File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 654, in _runCallbacks current.result = callback(current.result, *args, **kw) File "/home/nv01/joinmarket-clientserver/jmdaemon/jmdaemon/daemon_protocol.py", line 114, in defaultErrback ConnectionDone, ConnectionLost) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 460, in trap self.raiseException() File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 488, in raiseException raise self.value.with_traceback(self.tb) twisted.protocols.amp.UnknownRemoteError: Code<UNKNOWN>: Unknown Error 2020-08-20 13:52:45,357 [DEBUG] Found a new channel, setting to: JXXX,('nXXX.onion', 6667) 2020-08-20 13:52:45,434 [DEBUG] Nick: JXXX has left. 2020-08-20 13:53:43,052 [DEBUG] Dynamic switch nick: JXXX 2020-08-20 13:55:25,035 [DEBUG] JXXX has dusty minsize, capping at 2730 2020-08-20 13:55:25,155 [DEBUG] JXXX has dusty minsize, capping at 2730 (...)
jmclient.storage.StorageError
def selectWallet(self, testnet_seed=None): if jm_single().config.get("BLOCKCHAIN", "blockchain_source") != "regtest": # guaranteed to exist as load_program_config was called on startup: wallets_path = os.path.join(jm_single().datadir, "wallets") firstarg = QFileDialog.getOpenFileName( self, "Choose Wallet File", wallets_path, options=QFileDialog.DontUseNativeDialog, ) # TODO validate the file looks vaguely like a wallet file log.debug("Looking for wallet in: " + str(firstarg)) if not firstarg or not firstarg[0]: return decrypted = False while not decrypted: text, ok = QInputDialog.getText( self, "Decrypt wallet", "Enter your password:", echo=QLineEdit.Password ) if not ok: return pwd = str(text).strip() try: decrypted = self.loadWalletFromBlockchain(firstarg[0], pwd) except Exception as e: JMQtMessageBox(self, str(e), mbtype="warn", title="Error") return if decrypted == "error": # special case, not a failure to decrypt the file but # a failure of wallet loading, give up: self.close() else: if not testnet_seed: testnet_seed, ok = QInputDialog.getText( self, "Load Testnet wallet", "Enter a testnet seed:", QLineEdit.Normal ) if not ok: return firstarg = str(testnet_seed) pwd = None # ignore return value as there is no decryption failure possible self.loadWalletFromBlockchain(firstarg, pwd)
def selectWallet(self, testnet_seed=None): if jm_single().config.get("BLOCKCHAIN", "blockchain_source") != "regtest": # guaranteed to exist as load_program_config was called on startup: wallets_path = os.path.join(jm_single().datadir, "wallets") firstarg = QFileDialog.getOpenFileName( self, "Choose Wallet File", wallets_path, options=QFileDialog.DontUseNativeDialog, ) # TODO validate the file looks vaguely like a wallet file log.debug("Looking for wallet in: " + str(firstarg)) if not firstarg or not firstarg[0]: return decrypted = False while not decrypted: text, ok = QInputDialog.getText( self, "Decrypt wallet", "Enter your password:", echo=QLineEdit.Password ) if not ok: return pwd = str(text).strip() try: decrypted = self.loadWalletFromBlockchain(firstarg[0], pwd) except Exception as e: JMQtMessageBox(self, str(e), mbtype="warn", title="Error") return else: if not testnet_seed: testnet_seed, ok = QInputDialog.getText( self, "Load Testnet wallet", "Enter a testnet seed:", QLineEdit.Normal ) if not ok: return firstarg = str(testnet_seed) pwd = None # ignore return value as there is no decryption failure possible self.loadWalletFromBlockchain(firstarg, pwd)
https://github.com/JoinMarket-Org/joinmarket-clientserver/issues/673
2020-08-20 13:51:53,349 [DEBUG] >>privmsg on darkscience: nick=JXXX cmd=pubkey msg=8XXX 2020-08-20 13:52:02,337 [DEBUG] mix depths that have enough = {0: XXX} 2020-08-20 13:52:02,338 [INFO] filling offer, mixdepth=0, amount=2XXX 2020-08-20 13:52:02,893 [INFO] sending output to address=3XXX Unhandled Error Traceback (most recent call last): File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1041, in _commandReceived deferred = self.dispatchCommand(box) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1099, in dispatchCommand return maybeDeferred(responder, box) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 151, in maybeDeferred result = f(*args, **kw) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1186, in doit return maybeDeferred(aCallable, **kw).addCallback( --- <exception caught here> --- File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 654, in _runCallbacks current.result = callback(current.result, *args, **kw) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1169, in checkKnownErrors key = error.trap(*command.allErrors) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 460, in trap self.raiseException() File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 488, in raiseException raise self.value.with_traceback(self.tb) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 151, in maybeDeferred result = f(*args, **kw) File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/client_protocol.py", line 242, in on_JM_AUTH_RECEIVED commitment, revelation, amount, kphex) File "/home/nv01/joinmarket-clientserver/jmbase/jmbase/support.py", line 280, in func_wrapper return func(inst, *newargs, **kwargs) File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/maker.py", line 105, in on_auth_received self.wallet_service.save_wallet() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet_service.py", line 769, in save_wallet self.wallet.save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 1531, in save super().save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 1838, in save super().save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 385, in save self._utxos.save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 182, in save self.storage.save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/storage.py", line 134, in save raise StorageError("Read-only storage cannot be saved.") jmclient.storage.StorageError: Read-only storage cannot be saved. Amp server or network failure unhandled by client application. Dropping connection! To avoid, add errbacks to ALL remote commands! Traceback (most recent call last): --- <exception caught here> --- File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 654, in _runCallbacks current.result = callback(current.result, *args, **kw) File "/home/nv01/joinmarket-clientserver/jmdaemon/jmdaemon/daemon_protocol.py", line 114, in defaultErrback ConnectionDone, ConnectionLost) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 460, in trap self.raiseException() File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 488, in raiseException raise self.value.with_traceback(self.tb) twisted.protocols.amp.UnknownRemoteError: Code<UNKNOWN>: Unknown Error 2020-08-20 13:52:45,357 [DEBUG] Found a new channel, setting to: JXXX,('nXXX.onion', 6667) 2020-08-20 13:52:45,434 [DEBUG] Nick: JXXX has left. 2020-08-20 13:53:43,052 [DEBUG] Dynamic switch nick: JXXX 2020-08-20 13:55:25,035 [DEBUG] JXXX has dusty minsize, capping at 2730 2020-08-20 13:55:25,155 [DEBUG] JXXX has dusty minsize, capping at 2730 (...)
jmclient.storage.StorageError
def loadWalletFromBlockchain(self, firstarg=None, pwd=None): if firstarg: wallet_path = get_wallet_path(str(firstarg), None) try: wallet = open_test_wallet_maybe( wallet_path, str(firstarg), None, ask_for_password=False, password=pwd.encode("utf-8") if pwd else None, gap_limit=jm_single().config.getint("GUI", "gaplimit"), ) except RetryableStorageError as e: JMQtMessageBox(self, str(e), mbtype="warn", title="Error") return False # only used for GUI display on regtest: self.testwalletname = wallet.seed = str(firstarg) if isinstance(wallet, FidelityBondMixin): raise Exception("Fidelity bond wallets not supported by Qt") if "listunspent_args" not in jm_single().config.options("POLICY"): jm_single().config.set("POLICY", "listunspent_args", "[0]") assert wallet, "No wallet loaded" # shut down any existing wallet service # monitoring loops if self.wallet_service is not None: if self.wallet_service.isRunning(): self.wallet_service.stopService() if self.walletRefresh is not None: self.walletRefresh.stop() self.wallet_service = WalletService(wallet) # in case an RPC error occurs in the constructor: if self.wallet_service.rpc_error: JMQtMessageBox( self, self.wallet_service.rpc_error, mbtype="warn", title="Error" ) return "error" if jm_single().bc_interface is None: self.centralWidget().widget(0).updateWalletInfo( get_wallet_printout(self.wallet_service) ) return True # add information callbacks: self.wallet_service.add_restart_callback(self.restartWithMsg) self.wallet_service.autofreeze_warning_cb = self.autofreeze_warning_cb self.wallet_service.startService() self.syncmsg = "" self.walletRefresh = task.LoopingCall(self.updateWalletInfo) self.walletRefresh.start(5.0) self.statusBar().showMessage("Reading wallet from blockchain ...") return True
def loadWalletFromBlockchain(self, firstarg=None, pwd=None): if firstarg: wallet_path = get_wallet_path(str(firstarg), None) try: wallet = open_test_wallet_maybe( wallet_path, str(firstarg), None, ask_for_password=False, password=pwd.encode("utf-8") if pwd else None, gap_limit=jm_single().config.getint("GUI", "gaplimit"), ) except RetryableStorageError as e: JMQtMessageBox(self, str(e), mbtype="warn", title="Error") return False # only used for GUI display on regtest: self.testwalletname = wallet.seed = str(firstarg) if isinstance(wallet, FidelityBondMixin): raise Exception("Fidelity bond wallets not supported by Qt") if "listunspent_args" not in jm_single().config.options("POLICY"): jm_single().config.set("POLICY", "listunspent_args", "[0]") assert wallet, "No wallet loaded" # shut down any existing wallet service # monitoring loops if self.wallet_service is not None: if self.wallet_service.isRunning(): self.wallet_service.stopService() if self.walletRefresh is not None: self.walletRefresh.stop() self.wallet_service = WalletService(wallet) if jm_single().bc_interface is None: self.centralWidget().widget(0).updateWalletInfo( get_wallet_printout(self.wallet_service) ) return True # add information callbacks: self.wallet_service.add_restart_callback(self.restartWithMsg) self.wallet_service.autofreeze_warning_cb = self.autofreeze_warning_cb self.wallet_service.startService() self.syncmsg = "" self.walletRefresh = task.LoopingCall(self.updateWalletInfo) self.walletRefresh.start(5.0) self.statusBar().showMessage("Reading wallet from blockchain ...") return True
https://github.com/JoinMarket-Org/joinmarket-clientserver/issues/673
2020-08-20 13:51:53,349 [DEBUG] >>privmsg on darkscience: nick=JXXX cmd=pubkey msg=8XXX 2020-08-20 13:52:02,337 [DEBUG] mix depths that have enough = {0: XXX} 2020-08-20 13:52:02,338 [INFO] filling offer, mixdepth=0, amount=2XXX 2020-08-20 13:52:02,893 [INFO] sending output to address=3XXX Unhandled Error Traceback (most recent call last): File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1041, in _commandReceived deferred = self.dispatchCommand(box) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1099, in dispatchCommand return maybeDeferred(responder, box) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 151, in maybeDeferred result = f(*args, **kw) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1186, in doit return maybeDeferred(aCallable, **kw).addCallback( --- <exception caught here> --- File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 654, in _runCallbacks current.result = callback(current.result, *args, **kw) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1169, in checkKnownErrors key = error.trap(*command.allErrors) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 460, in trap self.raiseException() File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 488, in raiseException raise self.value.with_traceback(self.tb) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 151, in maybeDeferred result = f(*args, **kw) File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/client_protocol.py", line 242, in on_JM_AUTH_RECEIVED commitment, revelation, amount, kphex) File "/home/nv01/joinmarket-clientserver/jmbase/jmbase/support.py", line 280, in func_wrapper return func(inst, *newargs, **kwargs) File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/maker.py", line 105, in on_auth_received self.wallet_service.save_wallet() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet_service.py", line 769, in save_wallet self.wallet.save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 1531, in save super().save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 1838, in save super().save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 385, in save self._utxos.save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 182, in save self.storage.save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/storage.py", line 134, in save raise StorageError("Read-only storage cannot be saved.") jmclient.storage.StorageError: Read-only storage cannot be saved. Amp server or network failure unhandled by client application. Dropping connection! To avoid, add errbacks to ALL remote commands! Traceback (most recent call last): --- <exception caught here> --- File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 654, in _runCallbacks current.result = callback(current.result, *args, **kw) File "/home/nv01/joinmarket-clientserver/jmdaemon/jmdaemon/daemon_protocol.py", line 114, in defaultErrback ConnectionDone, ConnectionLost) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 460, in trap self.raiseException() File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 488, in raiseException raise self.value.with_traceback(self.tb) twisted.protocols.amp.UnknownRemoteError: Code<UNKNOWN>: Unknown Error 2020-08-20 13:52:45,357 [DEBUG] Found a new channel, setting to: JXXX,('nXXX.onion', 6667) 2020-08-20 13:52:45,434 [DEBUG] Nick: JXXX has left. 2020-08-20 13:53:43,052 [DEBUG] Dynamic switch nick: JXXX 2020-08-20 13:55:25,035 [DEBUG] JXXX has dusty minsize, capping at 2730 2020-08-20 13:55:25,155 [DEBUG] JXXX has dusty minsize, capping at 2730 (...)
jmclient.storage.StorageError
def main(): parser = get_sendpayment_parser() (options, args) = parser.parse_args() load_program_config(config_path=options.datadir) if options.schedule == "": if ( (len(args) < 2) or (btc.is_bip21_uri(args[1]) and len(args) != 2) or (not btc.is_bip21_uri(args[1]) and len(args) != 3) ): parser.error( "Joinmarket sendpayment (coinjoin) needs arguments:" " wallet, amount, destination address or wallet, bitcoin_uri." ) sys.exit(EXIT_ARGERROR) # without schedule file option, use the arguments to create a schedule # of a single transaction sweeping = False bip78url = None if options.schedule == "": if btc.is_bip21_uri(args[1]): parsed = btc.decode_bip21_uri(args[1]) try: amount = parsed["amount"] except KeyError: parser.error("Given BIP21 URI does not contain amount.") sys.exit(EXIT_ARGERROR) destaddr = parsed["address"] if "pj" in parsed: # note that this is a URL; its validity # checking is deferred to twisted.web.client.Agent bip78url = parsed["pj"] # setting makercount only for fee sanity check. # note we ignore any user setting and enforce N=0, # as this is a flag in the code for a non-JM coinjoin; # for the fee sanity check, note that BIP78 currently # will only allow small fee changes, so N=0 won't # be very inaccurate. jmprint("Attempting to pay via payjoin.", "info") options.makercount = 0 else: amount = btc.amount_to_sat(args[1]) if amount == 0: sweeping = True destaddr = args[2] mixdepth = options.mixdepth addr_valid, errormsg = validate_address(destaddr) command_to_burn = ( is_burn_destination(destaddr) and sweeping and options.makercount == 0 ) if not addr_valid and not command_to_burn: jmprint("ERROR: Address invalid. " + errormsg, "error") if is_burn_destination(destaddr): jmprint( "The required options for burning coins are zero makers" + " (-N 0), sweeping (amount = 0) and not using BIP78 Payjoin", "info", ) sys.exit(EXIT_ARGERROR) if sweeping == False and amount < DUST_THRESHOLD: jmprint( "ERROR: Amount " + btc.amount_to_str(amount) + " is below dust threshold " + btc.amount_to_str(DUST_THRESHOLD) + ".", "error", ) sys.exit(EXIT_ARGERROR) if options.makercount != 0 and options.makercount < jm_single().config.getint( "POLICY", "minimum_makers" ): jmprint( "ERROR: Maker count " + str(options.makercount) + " below minimum_makers (" + str(jm_single().config.getint("POLICY", "minimum_makers")) + ") in joinmarket.cfg.", "error", ) sys.exit(EXIT_ARGERROR) schedule = [ [ options.mixdepth, amount, options.makercount, destaddr, 0.0, NO_ROUNDING, 0, ] ] else: if btc.is_bip21_uri(args[1]): parser.error("Schedule files are not compatible with bip21 uris.") sys.exit(EXIT_ARGERROR) result, schedule = get_schedule(options.schedule) if not result: log.error("Failed to load schedule file, quitting. Check the syntax.") log.error("Error was: " + str(schedule)) sys.exit(EXIT_FAILURE) mixdepth = 0 for s in schedule: if s[1] == 0: sweeping = True # only used for checking the maximum mixdepth required mixdepth = max([mixdepth, s[0]]) wallet_name = args[0] check_regtest() if options.pickorders: chooseOrdersFunc = pick_order if sweeping: jmprint("WARNING: You may have to pick offers multiple times", "warning") jmprint("WARNING: due to manual offer picking while sweeping", "warning") else: chooseOrdersFunc = options.order_choose_fn # If tx_fees are set manually by CLI argument, override joinmarket.cfg: if int(options.txfee) > 0: jm_single().config.set("POLICY", "tx_fees", str(options.txfee)) # Dynamically estimate a realistic fee. # At this point we do not know even the number of our own inputs, so # we guess conservatively with 2 inputs and 2 outputs each. fee_per_cp_guess = estimate_tx_fee(2, 2, txtype="p2sh-p2wpkh") log.debug( "Estimated miner/tx fee for each cj participant: " + str(fee_per_cp_guess) ) maxcjfee = (1, float("inf")) if not options.pickorders and options.makercount != 0: maxcjfee = get_max_cj_fee_values(jm_single().config, options) log.info( "Using maximum coinjoin fee limits per maker of {:.4%}, {} ".format( maxcjfee[0], btc.amount_to_str(maxcjfee[1]) ) ) log.info("starting sendpayment") max_mix_depth = max([mixdepth, options.amtmixdepths - 1]) wallet_path = get_wallet_path(wallet_name, None) wallet = open_test_wallet_maybe( wallet_path, wallet_name, max_mix_depth, wallet_password_stdin=options.wallet_password_stdin, gap_limit=options.gaplimit, ) wallet_service = WalletService(wallet) if wallet_service.rpc_error: sys.exit(EXIT_FAILURE) # in this script, we need the wallet synced before # logic processing for some paths, so do it now: while not wallet_service.synced: wallet_service.sync_wallet(fast=not options.recoversync) # the sync call here will now be a no-op: wallet_service.startService() # From the estimated tx fees, check if the expected amount is a # significant value compared the the cj amount; currently enabled # only for single join (the predominant, non-advanced case) if options.schedule == "": total_cj_amount = amount if total_cj_amount == 0: total_cj_amount = wallet_service.get_balance_by_mixdepth()[options.mixdepth] if total_cj_amount == 0: raise ValueError( "No confirmed coins in the selected mixdepth. Quitting" ) exp_tx_fees_ratio = ( (1 + options.makercount) * fee_per_cp_guess ) / total_cj_amount if exp_tx_fees_ratio > 0.05: jmprint( "WARNING: Expected bitcoin network miner fees for this coinjoin" " amount are roughly {:.1%}".format(exp_tx_fees_ratio), "warning", ) if ( input( "You might want to modify your tx_fee" " settings in joinmarket.cfg. Still continue? (y/n):" )[0] != "y" ): sys.exit("Aborted by user.") else: log.info( "Estimated miner/tx fees for this coinjoin amount: {:.1%}".format( exp_tx_fees_ratio ) ) if options.makercount == 0 and not bip78url: tx = direct_send( wallet_service, amount, mixdepth, destaddr, options.answeryes, with_final_psbt=options.with_psbt, ) if options.with_psbt: log.info( "This PSBT is fully signed and can be sent externally for broadcasting:" ) log.info(tx.to_base64()) return if wallet.get_txtype() == "p2pkh": jmprint( "Only direct sends (use -N 0) are supported for " "legacy (non-segwit) wallets.", "error", ) sys.exit(EXIT_ARGERROR) def filter_orders_callback(orders_fees, cjamount): orders, total_cj_fee = orders_fees log.info("Chose these orders: " + pprint.pformat(orders)) log.info("total cj fee = " + str(total_cj_fee)) total_fee_pc = 1.0 * total_cj_fee / cjamount log.info( "total coinjoin fee = " + str(float("%.3g" % (100.0 * total_fee_pc))) + "%" ) WARNING_THRESHOLD = 0.02 # 2% if total_fee_pc > WARNING_THRESHOLD: log.info("\n".join(["=" * 60] * 3)) log.info("WARNING " * 6) log.info("\n".join(["=" * 60] * 1)) log.info("OFFERED COINJOIN FEE IS UNUSUALLY HIGH. DOUBLE/TRIPLE CHECK.") log.info("\n".join(["=" * 60] * 1)) log.info("WARNING " * 6) log.info("\n".join(["=" * 60] * 3)) if not options.answeryes: if input("send with these orders? (y/n):")[0] != "y": return False return True def taker_finished(res, fromtx=False, waittime=0.0, txdetails=None): if fromtx == "unconfirmed": # If final entry, stop *here*, don't wait for confirmation if taker.schedule_index + 1 == len(taker.schedule): reactor.stop() return if fromtx: if res: txd, txid = txdetails reactor.callLater(waittime * 60, clientfactory.getClient().clientStart) else: # a transaction failed; we'll try to repeat without the # troublemakers. # If this error condition is reached from Phase 1 processing, # and there are less than minimum_makers honest responses, we # just give up (note that in tumbler we tweak and retry, but # for sendpayment the user is "online" and so can manually # try again). # However if the error is in Phase 2 and we have minimum_makers # or more responses, we do try to restart with the honest set, here. if taker.latest_tx is None: # can only happen with < minimum_makers; see above. log.info( "A transaction failed but there are insufficient " "honest respondants to continue; giving up." ) reactor.stop() return # This is Phase 2; do we have enough to try again? taker.add_honest_makers( list( set(taker.maker_utxo_data.keys()).symmetric_difference( set(taker.nonrespondants) ) ) ) if len(taker.honest_makers) < jm_single().config.getint( "POLICY", "minimum_makers" ): log.info( "Too few makers responded honestly; giving up this attempt." ) reactor.stop() return jmprint( "We failed to complete the transaction. The following " "makers responded honestly: " + str(taker.honest_makers) + ", so we will retry with them.", "warning", ) # Now we have to set the specific group we want to use, and hopefully # they will respond again as they showed honesty last time. # we must reset the number of counterparties, as well as fix who they # are; this is because the number is used to e.g. calculate fees. # cleanest way is to reset the number in the schedule before restart. taker.schedule[taker.schedule_index][2] = len(taker.honest_makers) log.info( "Retrying with: " + str(taker.schedule[taker.schedule_index][2]) + " counterparties." ) # rewind to try again (index is incremented in Taker.initialize()) taker.schedule_index -= 1 taker.set_honest_only(True) reactor.callLater(5.0, clientfactory.getClient().clientStart) else: if not res: log.info("Did not complete successfully, shutting down") # Should usually be unreachable, unless conf received out of order; # because we should stop on 'unconfirmed' for last (see above) else: log.info("All transactions completed correctly") reactor.stop() if bip78url: # TODO sanity check wallet type is segwit manager = parse_payjoin_setup(args[1], wallet_service, options.mixdepth) reactor.callWhenRunning(send_payjoin, manager) reactor.run() return else: taker = Taker( wallet_service, schedule, order_chooser=chooseOrdersFunc, max_cj_fee=maxcjfee, callbacks=(filter_orders_callback, None, taker_finished), ) clientfactory = JMClientProtocolFactory(taker) nodaemon = jm_single().config.getint("DAEMON", "no_daemon") daemon = True if nodaemon == 1 else False if jm_single().config.get("BLOCKCHAIN", "network") in ["regtest", "testnet"]: startLogging(sys.stdout) start_reactor( jm_single().config.get("DAEMON", "daemon_host"), jm_single().config.getint("DAEMON", "daemon_port"), clientfactory, daemon=daemon, )
def main(): parser = get_sendpayment_parser() (options, args) = parser.parse_args() load_program_config(config_path=options.datadir) if options.schedule == "": if ( (len(args) < 2) or (btc.is_bip21_uri(args[1]) and len(args) != 2) or (not btc.is_bip21_uri(args[1]) and len(args) != 3) ): parser.error( "Joinmarket sendpayment (coinjoin) needs arguments:" " wallet, amount, destination address or wallet, bitcoin_uri." ) sys.exit(EXIT_ARGERROR) # without schedule file option, use the arguments to create a schedule # of a single transaction sweeping = False bip78url = None if options.schedule == "": if btc.is_bip21_uri(args[1]): parsed = btc.decode_bip21_uri(args[1]) try: amount = parsed["amount"] except KeyError: parser.error("Given BIP21 URI does not contain amount.") sys.exit(EXIT_ARGERROR) destaddr = parsed["address"] if "pj" in parsed: # note that this is a URL; its validity # checking is deferred to twisted.web.client.Agent bip78url = parsed["pj"] # setting makercount only for fee sanity check. # note we ignore any user setting and enforce N=0, # as this is a flag in the code for a non-JM coinjoin; # for the fee sanity check, note that BIP78 currently # will only allow small fee changes, so N=0 won't # be very inaccurate. jmprint("Attempting to pay via payjoin.", "info") options.makercount = 0 else: amount = btc.amount_to_sat(args[1]) if amount == 0: sweeping = True destaddr = args[2] mixdepth = options.mixdepth addr_valid, errormsg = validate_address(destaddr) command_to_burn = ( is_burn_destination(destaddr) and sweeping and options.makercount == 0 ) if not addr_valid and not command_to_burn: jmprint("ERROR: Address invalid. " + errormsg, "error") if is_burn_destination(destaddr): jmprint( "The required options for burning coins are zero makers" + " (-N 0), sweeping (amount = 0) and not using BIP78 Payjoin", "info", ) sys.exit(EXIT_ARGERROR) if sweeping == False and amount < DUST_THRESHOLD: jmprint( "ERROR: Amount " + btc.amount_to_str(amount) + " is below dust threshold " + btc.amount_to_str(DUST_THRESHOLD) + ".", "error", ) sys.exit(EXIT_ARGERROR) if options.makercount != 0 and options.makercount < jm_single().config.getint( "POLICY", "minimum_makers" ): jmprint( "ERROR: Maker count " + str(options.makercount) + " below minimum_makers (" + str(jm_single().config.getint("POLICY", "minimum_makers")) + ") in joinmarket.cfg.", "error", ) sys.exit(EXIT_ARGERROR) schedule = [ [ options.mixdepth, amount, options.makercount, destaddr, 0.0, NO_ROUNDING, 0, ] ] else: if btc.is_bip21_uri(args[1]): parser.error("Schedule files are not compatible with bip21 uris.") sys.exit(EXIT_ARGERROR) result, schedule = get_schedule(options.schedule) if not result: log.error("Failed to load schedule file, quitting. Check the syntax.") log.error("Error was: " + str(schedule)) sys.exit(EXIT_FAILURE) mixdepth = 0 for s in schedule: if s[1] == 0: sweeping = True # only used for checking the maximum mixdepth required mixdepth = max([mixdepth, s[0]]) wallet_name = args[0] check_regtest() if options.pickorders: chooseOrdersFunc = pick_order if sweeping: jmprint("WARNING: You may have to pick offers multiple times", "warning") jmprint("WARNING: due to manual offer picking while sweeping", "warning") else: chooseOrdersFunc = options.order_choose_fn # If tx_fees are set manually by CLI argument, override joinmarket.cfg: if int(options.txfee) > 0: jm_single().config.set("POLICY", "tx_fees", str(options.txfee)) # Dynamically estimate a realistic fee. # At this point we do not know even the number of our own inputs, so # we guess conservatively with 2 inputs and 2 outputs each. fee_per_cp_guess = estimate_tx_fee(2, 2, txtype="p2sh-p2wpkh") log.debug( "Estimated miner/tx fee for each cj participant: " + str(fee_per_cp_guess) ) maxcjfee = (1, float("inf")) if not options.pickorders and options.makercount != 0: maxcjfee = get_max_cj_fee_values(jm_single().config, options) log.info( "Using maximum coinjoin fee limits per maker of {:.4%}, {} ".format( maxcjfee[0], btc.amount_to_str(maxcjfee[1]) ) ) log.info("starting sendpayment") max_mix_depth = max([mixdepth, options.amtmixdepths - 1]) wallet_path = get_wallet_path(wallet_name, None) wallet = open_test_wallet_maybe( wallet_path, wallet_name, max_mix_depth, wallet_password_stdin=options.wallet_password_stdin, gap_limit=options.gaplimit, ) wallet_service = WalletService(wallet) # in this script, we need the wallet synced before # logic processing for some paths, so do it now: while not wallet_service.synced: wallet_service.sync_wallet(fast=not options.recoversync) # the sync call here will now be a no-op: wallet_service.startService() # From the estimated tx fees, check if the expected amount is a # significant value compared the the cj amount; currently enabled # only for single join (the predominant, non-advanced case) if options.schedule == "": total_cj_amount = amount if total_cj_amount == 0: total_cj_amount = wallet_service.get_balance_by_mixdepth()[options.mixdepth] if total_cj_amount == 0: raise ValueError( "No confirmed coins in the selected mixdepth. Quitting" ) exp_tx_fees_ratio = ( (1 + options.makercount) * fee_per_cp_guess ) / total_cj_amount if exp_tx_fees_ratio > 0.05: jmprint( "WARNING: Expected bitcoin network miner fees for this coinjoin" " amount are roughly {:.1%}".format(exp_tx_fees_ratio), "warning", ) if ( input( "You might want to modify your tx_fee" " settings in joinmarket.cfg. Still continue? (y/n):" )[0] != "y" ): sys.exit("Aborted by user.") else: log.info( "Estimated miner/tx fees for this coinjoin amount: {:.1%}".format( exp_tx_fees_ratio ) ) if options.makercount == 0 and not bip78url: tx = direct_send( wallet_service, amount, mixdepth, destaddr, options.answeryes, with_final_psbt=options.with_psbt, ) if options.with_psbt: log.info( "This PSBT is fully signed and can be sent externally for broadcasting:" ) log.info(tx.to_base64()) return if wallet.get_txtype() == "p2pkh": jmprint( "Only direct sends (use -N 0) are supported for " "legacy (non-segwit) wallets.", "error", ) sys.exit(EXIT_ARGERROR) def filter_orders_callback(orders_fees, cjamount): orders, total_cj_fee = orders_fees log.info("Chose these orders: " + pprint.pformat(orders)) log.info("total cj fee = " + str(total_cj_fee)) total_fee_pc = 1.0 * total_cj_fee / cjamount log.info( "total coinjoin fee = " + str(float("%.3g" % (100.0 * total_fee_pc))) + "%" ) WARNING_THRESHOLD = 0.02 # 2% if total_fee_pc > WARNING_THRESHOLD: log.info("\n".join(["=" * 60] * 3)) log.info("WARNING " * 6) log.info("\n".join(["=" * 60] * 1)) log.info("OFFERED COINJOIN FEE IS UNUSUALLY HIGH. DOUBLE/TRIPLE CHECK.") log.info("\n".join(["=" * 60] * 1)) log.info("WARNING " * 6) log.info("\n".join(["=" * 60] * 3)) if not options.answeryes: if input("send with these orders? (y/n):")[0] != "y": return False return True def taker_finished(res, fromtx=False, waittime=0.0, txdetails=None): if fromtx == "unconfirmed": # If final entry, stop *here*, don't wait for confirmation if taker.schedule_index + 1 == len(taker.schedule): reactor.stop() return if fromtx: if res: txd, txid = txdetails reactor.callLater(waittime * 60, clientfactory.getClient().clientStart) else: # a transaction failed; we'll try to repeat without the # troublemakers. # If this error condition is reached from Phase 1 processing, # and there are less than minimum_makers honest responses, we # just give up (note that in tumbler we tweak and retry, but # for sendpayment the user is "online" and so can manually # try again). # However if the error is in Phase 2 and we have minimum_makers # or more responses, we do try to restart with the honest set, here. if taker.latest_tx is None: # can only happen with < minimum_makers; see above. log.info( "A transaction failed but there are insufficient " "honest respondants to continue; giving up." ) reactor.stop() return # This is Phase 2; do we have enough to try again? taker.add_honest_makers( list( set(taker.maker_utxo_data.keys()).symmetric_difference( set(taker.nonrespondants) ) ) ) if len(taker.honest_makers) < jm_single().config.getint( "POLICY", "minimum_makers" ): log.info( "Too few makers responded honestly; giving up this attempt." ) reactor.stop() return jmprint( "We failed to complete the transaction. The following " "makers responded honestly: " + str(taker.honest_makers) + ", so we will retry with them.", "warning", ) # Now we have to set the specific group we want to use, and hopefully # they will respond again as they showed honesty last time. # we must reset the number of counterparties, as well as fix who they # are; this is because the number is used to e.g. calculate fees. # cleanest way is to reset the number in the schedule before restart. taker.schedule[taker.schedule_index][2] = len(taker.honest_makers) log.info( "Retrying with: " + str(taker.schedule[taker.schedule_index][2]) + " counterparties." ) # rewind to try again (index is incremented in Taker.initialize()) taker.schedule_index -= 1 taker.set_honest_only(True) reactor.callLater(5.0, clientfactory.getClient().clientStart) else: if not res: log.info("Did not complete successfully, shutting down") # Should usually be unreachable, unless conf received out of order; # because we should stop on 'unconfirmed' for last (see above) else: log.info("All transactions completed correctly") reactor.stop() if bip78url: # TODO sanity check wallet type is segwit manager = parse_payjoin_setup(args[1], wallet_service, options.mixdepth) reactor.callWhenRunning(send_payjoin, manager) reactor.run() return else: taker = Taker( wallet_service, schedule, order_chooser=chooseOrdersFunc, max_cj_fee=maxcjfee, callbacks=(filter_orders_callback, None, taker_finished), ) clientfactory = JMClientProtocolFactory(taker) nodaemon = jm_single().config.getint("DAEMON", "no_daemon") daemon = True if nodaemon == 1 else False if jm_single().config.get("BLOCKCHAIN", "network") in ["regtest", "testnet"]: startLogging(sys.stdout) start_reactor( jm_single().config.get("DAEMON", "daemon_host"), jm_single().config.getint("DAEMON", "daemon_port"), clientfactory, daemon=daemon, )
https://github.com/JoinMarket-Org/joinmarket-clientserver/issues/673
2020-08-20 13:51:53,349 [DEBUG] >>privmsg on darkscience: nick=JXXX cmd=pubkey msg=8XXX 2020-08-20 13:52:02,337 [DEBUG] mix depths that have enough = {0: XXX} 2020-08-20 13:52:02,338 [INFO] filling offer, mixdepth=0, amount=2XXX 2020-08-20 13:52:02,893 [INFO] sending output to address=3XXX Unhandled Error Traceback (most recent call last): File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1041, in _commandReceived deferred = self.dispatchCommand(box) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1099, in dispatchCommand return maybeDeferred(responder, box) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 151, in maybeDeferred result = f(*args, **kw) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1186, in doit return maybeDeferred(aCallable, **kw).addCallback( --- <exception caught here> --- File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 654, in _runCallbacks current.result = callback(current.result, *args, **kw) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1169, in checkKnownErrors key = error.trap(*command.allErrors) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 460, in trap self.raiseException() File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 488, in raiseException raise self.value.with_traceback(self.tb) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 151, in maybeDeferred result = f(*args, **kw) File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/client_protocol.py", line 242, in on_JM_AUTH_RECEIVED commitment, revelation, amount, kphex) File "/home/nv01/joinmarket-clientserver/jmbase/jmbase/support.py", line 280, in func_wrapper return func(inst, *newargs, **kwargs) File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/maker.py", line 105, in on_auth_received self.wallet_service.save_wallet() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet_service.py", line 769, in save_wallet self.wallet.save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 1531, in save super().save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 1838, in save super().save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 385, in save self._utxos.save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 182, in save self.storage.save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/storage.py", line 134, in save raise StorageError("Read-only storage cannot be saved.") jmclient.storage.StorageError: Read-only storage cannot be saved. Amp server or network failure unhandled by client application. Dropping connection! To avoid, add errbacks to ALL remote commands! Traceback (most recent call last): --- <exception caught here> --- File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 654, in _runCallbacks current.result = callback(current.result, *args, **kw) File "/home/nv01/joinmarket-clientserver/jmdaemon/jmdaemon/daemon_protocol.py", line 114, in defaultErrback ConnectionDone, ConnectionLost) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 460, in trap self.raiseException() File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 488, in raiseException raise self.value.with_traceback(self.tb) twisted.protocols.amp.UnknownRemoteError: Code<UNKNOWN>: Unknown Error 2020-08-20 13:52:45,357 [DEBUG] Found a new channel, setting to: JXXX,('nXXX.onion', 6667) 2020-08-20 13:52:45,434 [DEBUG] Nick: JXXX has left. 2020-08-20 13:53:43,052 [DEBUG] Dynamic switch nick: JXXX 2020-08-20 13:55:25,035 [DEBUG] JXXX has dusty minsize, capping at 2730 2020-08-20 13:55:25,155 [DEBUG] JXXX has dusty minsize, capping at 2730 (...)
jmclient.storage.StorageError
def main(): tumble_log = get_tumble_log(logsdir) (options, args) = get_tumbler_parser().parse_args() options_org = options options = vars(options) if len(args) < 1: jmprint("Error: Needs a wallet file", "error") sys.exit(EXIT_ARGERROR) load_program_config(config_path=options["datadir"]) if jm_single().bc_interface is None: jmprint("Error: Needs a blockchain source", "error") sys.exit(EXIT_FAILURE) check_regtest() # Load the wallet wallet_name = args[0] max_mix_depth = options["mixdepthsrc"] + options["mixdepthcount"] if options["amtmixdepths"] > max_mix_depth: max_mix_depth = options["amtmixdepths"] wallet_path = get_wallet_path(wallet_name, None) wallet = open_test_wallet_maybe( wallet_path, wallet_name, max_mix_depth, wallet_password_stdin=options_org.wallet_password_stdin, ) wallet_service = WalletService(wallet) if wallet_service.rpc_error: sys.exit(EXIT_FAILURE) # in this script, we need the wallet synced before # logic processing for some paths, so do it now: while not wallet_service.synced: wallet_service.sync_wallet(fast=not options["recoversync"]) # the sync call here will now be a no-op: wallet_service.startService() maxcjfee = get_max_cj_fee_values(jm_single().config, options_org) log.info( "Using maximum coinjoin fee limits per maker of {:.4%}, {} sat".format( *maxcjfee ) ) # Parse options and generate schedule # Output information to log files jm_single().mincjamount = options["mincjamount"] destaddrs = args[1:] for daddr in destaddrs: success, errmsg = validate_address(daddr) if not success: jmprint("Invalid destination address: " + daddr, "error") sys.exit(EXIT_ARGERROR) jmprint("Destination addresses: " + str(destaddrs), "important") # If the --restart flag is set we read the schedule # from the file, and filter out entries that are # already complete if options["restart"]: res, schedule = get_schedule(os.path.join(logsdir, options["schedulefile"])) if not res: jmprint( "Failed to load schedule, name: " + str(options["schedulefile"]), "error", ) jmprint("Error was: " + str(schedule), "error") sys.exit(EXIT_FAILURE) # This removes all entries that are marked as done schedule = [s for s in schedule if s[-1] != 1] # remaining destination addresses must be stored in Taker.tdestaddrs # in case of tweaks; note we can't change, so any passed on command # line must be ignored: if len(destaddrs) > 0: jmprint( "For restarts, destinations are taken from schedule file," " so passed destinations on the command line were ignored.", "important", ) if input("OK? (y/n)") != "y": sys.exit(EXIT_SUCCESS) destaddrs = [s[3] for s in schedule if s[3] not in ["INTERNAL", "addrask"]] jmprint( "Remaining destination addresses in restart: " + ",".join(destaddrs), "important", ) if isinstance(schedule[0][-1], str) and len(schedule[0][-1]) == 64: # ensure last transaction is confirmed before restart tumble_log.info("WAITING TO RESTART...") txid = schedule[0][-1] restart_waiter(txid) # remove the already-done entry (this connects to the other TODO, # probably better *not* to truncate the done-already txs from file, # but simplest for now. schedule = schedule[1:] elif schedule[0][-1] != 0: print("Error: first schedule entry is invalid.") sys.exit(EXIT_FAILURE) with open(os.path.join(logsdir, options["schedulefile"]), "wb") as f: f.write(schedule_to_text(schedule)) tumble_log.info("TUMBLE RESTARTING") else: # Create a new schedule from scratch schedule = get_tumble_schedule( options, destaddrs, wallet.get_balance_by_mixdepth() ) tumble_log.info("TUMBLE STARTING") with open(os.path.join(logsdir, options["schedulefile"]), "wb") as f: f.write(schedule_to_text(schedule)) print("Schedule written to logs/" + options["schedulefile"]) tumble_log.info("With this schedule: ") tumble_log.info(pprint.pformat(schedule)) # If tx_fees are set manually by CLI argument, override joinmarket.cfg: if int(options["txfee"]) > 0: jm_single().config.set("POLICY", "tx_fees", str(options["txfee"])) # Dynamically estimate an expected tx fee for the whole tumbling run. # This is very rough: we guess with 2 inputs and 2 outputs each. fee_per_cp_guess = estimate_tx_fee(2, 2, txtype="p2sh-p2wpkh") log.debug( "Estimated miner/tx fee for each cj participant: " + str(fee_per_cp_guess) ) # From the estimated tx fees, check if the expected amount is a # significant value compared the the cj amount involved_parties = len(schedule) # own participation in each CJ for item in schedule: involved_parties += item[2] # number of total tumble counterparties total_tumble_amount = int(0) max_mix_to_tumble = min( options["mixdepthsrc"] + options["mixdepthcount"], max_mix_depth ) for i in range(options["mixdepthsrc"], max_mix_to_tumble): total_tumble_amount += wallet_service.get_balance_by_mixdepth()[i] if total_tumble_amount == 0: raise ValueError("No confirmed coins in the selected mixdepth(s). Quitting") exp_tx_fees_ratio = (involved_parties * fee_per_cp_guess) / total_tumble_amount if exp_tx_fees_ratio > 0.05: jmprint( "WARNING: Expected bitcoin network miner fees for the whole " "tumbling run are roughly {:.1%}".format(exp_tx_fees_ratio), "warning", ) if ( not options["restart"] and input( "You might want to modify your tx_fee" " settings in joinmarket.cfg. Still continue? (y/n):" )[0] != "y" ): sys.exit("Aborted by user.") else: log.info( "Estimated miner/tx fees for this coinjoin amount for the " "whole tumbling run: {:.1%}".format(exp_tx_fees_ratio) ) print("Progress logging to logs/TUMBLE.log") def filter_orders_callback(orders_fees, cjamount): """Decide whether to accept fees""" return tumbler_filter_orders_callback(orders_fees, cjamount, taker) def taker_finished(res, fromtx=False, waittime=0.0, txdetails=None): """on_finished_callback for tumbler; processing is almost entirely deferred to generic taker_finished in tumbler_support module, except here reactor signalling. """ sfile = os.path.join(logsdir, options["schedulefile"]) tumbler_taker_finished_update( taker, sfile, tumble_log, options, res, fromtx, waittime, txdetails ) if not fromtx: reactor.stop() elif fromtx != "unconfirmed": reactor.callLater(waittime * 60, clientfactory.getClient().clientStart) # instantiate Taker with given schedule and run taker = Taker( wallet_service, schedule, maxcjfee, order_chooser=options["order_choose_fn"], callbacks=(filter_orders_callback, None, taker_finished), tdestaddrs=destaddrs, ) clientfactory = JMClientProtocolFactory(taker) nodaemon = jm_single().config.getint("DAEMON", "no_daemon") daemon = True if nodaemon == 1 else False if jm_single().config.get("BLOCKCHAIN", "network") in ["regtest", "testnet"]: startLogging(sys.stdout) start_reactor( jm_single().config.get("DAEMON", "daemon_host"), jm_single().config.getint("DAEMON", "daemon_port"), clientfactory, daemon=daemon, )
def main(): tumble_log = get_tumble_log(logsdir) (options, args) = get_tumbler_parser().parse_args() options_org = options options = vars(options) if len(args) < 1: jmprint("Error: Needs a wallet file", "error") sys.exit(EXIT_ARGERROR) load_program_config(config_path=options["datadir"]) if jm_single().bc_interface is None: jmprint("Error: Needs a blockchain source", "error") sys.exit(EXIT_FAILURE) check_regtest() # Load the wallet wallet_name = args[0] max_mix_depth = options["mixdepthsrc"] + options["mixdepthcount"] if options["amtmixdepths"] > max_mix_depth: max_mix_depth = options["amtmixdepths"] wallet_path = get_wallet_path(wallet_name, None) wallet = open_test_wallet_maybe( wallet_path, wallet_name, max_mix_depth, wallet_password_stdin=options_org.wallet_password_stdin, ) wallet_service = WalletService(wallet) # in this script, we need the wallet synced before # logic processing for some paths, so do it now: while not wallet_service.synced: wallet_service.sync_wallet(fast=not options["recoversync"]) # the sync call here will now be a no-op: wallet_service.startService() maxcjfee = get_max_cj_fee_values(jm_single().config, options_org) log.info( "Using maximum coinjoin fee limits per maker of {:.4%}, {} sat".format( *maxcjfee ) ) # Parse options and generate schedule # Output information to log files jm_single().mincjamount = options["mincjamount"] destaddrs = args[1:] for daddr in destaddrs: success, errmsg = validate_address(daddr) if not success: jmprint("Invalid destination address: " + daddr, "error") sys.exit(EXIT_ARGERROR) jmprint("Destination addresses: " + str(destaddrs), "important") # If the --restart flag is set we read the schedule # from the file, and filter out entries that are # already complete if options["restart"]: res, schedule = get_schedule(os.path.join(logsdir, options["schedulefile"])) if not res: jmprint( "Failed to load schedule, name: " + str(options["schedulefile"]), "error", ) jmprint("Error was: " + str(schedule), "error") sys.exit(EXIT_FAILURE) # This removes all entries that are marked as done schedule = [s for s in schedule if s[-1] != 1] # remaining destination addresses must be stored in Taker.tdestaddrs # in case of tweaks; note we can't change, so any passed on command # line must be ignored: if len(destaddrs) > 0: jmprint( "For restarts, destinations are taken from schedule file," " so passed destinations on the command line were ignored.", "important", ) if input("OK? (y/n)") != "y": sys.exit(EXIT_SUCCESS) destaddrs = [s[3] for s in schedule if s[3] not in ["INTERNAL", "addrask"]] jmprint( "Remaining destination addresses in restart: " + ",".join(destaddrs), "important", ) if isinstance(schedule[0][-1], str) and len(schedule[0][-1]) == 64: # ensure last transaction is confirmed before restart tumble_log.info("WAITING TO RESTART...") txid = schedule[0][-1] restart_waiter(txid) # remove the already-done entry (this connects to the other TODO, # probably better *not* to truncate the done-already txs from file, # but simplest for now. schedule = schedule[1:] elif schedule[0][-1] != 0: print("Error: first schedule entry is invalid.") sys.exit(EXIT_FAILURE) with open(os.path.join(logsdir, options["schedulefile"]), "wb") as f: f.write(schedule_to_text(schedule)) tumble_log.info("TUMBLE RESTARTING") else: # Create a new schedule from scratch schedule = get_tumble_schedule( options, destaddrs, wallet.get_balance_by_mixdepth() ) tumble_log.info("TUMBLE STARTING") with open(os.path.join(logsdir, options["schedulefile"]), "wb") as f: f.write(schedule_to_text(schedule)) print("Schedule written to logs/" + options["schedulefile"]) tumble_log.info("With this schedule: ") tumble_log.info(pprint.pformat(schedule)) # If tx_fees are set manually by CLI argument, override joinmarket.cfg: if int(options["txfee"]) > 0: jm_single().config.set("POLICY", "tx_fees", str(options["txfee"])) # Dynamically estimate an expected tx fee for the whole tumbling run. # This is very rough: we guess with 2 inputs and 2 outputs each. fee_per_cp_guess = estimate_tx_fee(2, 2, txtype="p2sh-p2wpkh") log.debug( "Estimated miner/tx fee for each cj participant: " + str(fee_per_cp_guess) ) # From the estimated tx fees, check if the expected amount is a # significant value compared the the cj amount involved_parties = len(schedule) # own participation in each CJ for item in schedule: involved_parties += item[2] # number of total tumble counterparties total_tumble_amount = int(0) max_mix_to_tumble = min( options["mixdepthsrc"] + options["mixdepthcount"], max_mix_depth ) for i in range(options["mixdepthsrc"], max_mix_to_tumble): total_tumble_amount += wallet_service.get_balance_by_mixdepth()[i] if total_tumble_amount == 0: raise ValueError("No confirmed coins in the selected mixdepth(s). Quitting") exp_tx_fees_ratio = (involved_parties * fee_per_cp_guess) / total_tumble_amount if exp_tx_fees_ratio > 0.05: jmprint( "WARNING: Expected bitcoin network miner fees for the whole " "tumbling run are roughly {:.1%}".format(exp_tx_fees_ratio), "warning", ) if ( not options["restart"] and input( "You might want to modify your tx_fee" " settings in joinmarket.cfg. Still continue? (y/n):" )[0] != "y" ): sys.exit("Aborted by user.") else: log.info( "Estimated miner/tx fees for this coinjoin amount for the " "whole tumbling run: {:.1%}".format(exp_tx_fees_ratio) ) print("Progress logging to logs/TUMBLE.log") def filter_orders_callback(orders_fees, cjamount): """Decide whether to accept fees""" return tumbler_filter_orders_callback(orders_fees, cjamount, taker) def taker_finished(res, fromtx=False, waittime=0.0, txdetails=None): """on_finished_callback for tumbler; processing is almost entirely deferred to generic taker_finished in tumbler_support module, except here reactor signalling. """ sfile = os.path.join(logsdir, options["schedulefile"]) tumbler_taker_finished_update( taker, sfile, tumble_log, options, res, fromtx, waittime, txdetails ) if not fromtx: reactor.stop() elif fromtx != "unconfirmed": reactor.callLater(waittime * 60, clientfactory.getClient().clientStart) # instantiate Taker with given schedule and run taker = Taker( wallet_service, schedule, maxcjfee, order_chooser=options["order_choose_fn"], callbacks=(filter_orders_callback, None, taker_finished), tdestaddrs=destaddrs, ) clientfactory = JMClientProtocolFactory(taker) nodaemon = jm_single().config.getint("DAEMON", "no_daemon") daemon = True if nodaemon == 1 else False if jm_single().config.get("BLOCKCHAIN", "network") in ["regtest", "testnet"]: startLogging(sys.stdout) start_reactor( jm_single().config.get("DAEMON", "daemon_host"), jm_single().config.getint("DAEMON", "daemon_port"), clientfactory, daemon=daemon, )
https://github.com/JoinMarket-Org/joinmarket-clientserver/issues/673
2020-08-20 13:51:53,349 [DEBUG] >>privmsg on darkscience: nick=JXXX cmd=pubkey msg=8XXX 2020-08-20 13:52:02,337 [DEBUG] mix depths that have enough = {0: XXX} 2020-08-20 13:52:02,338 [INFO] filling offer, mixdepth=0, amount=2XXX 2020-08-20 13:52:02,893 [INFO] sending output to address=3XXX Unhandled Error Traceback (most recent call last): File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1041, in _commandReceived deferred = self.dispatchCommand(box) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1099, in dispatchCommand return maybeDeferred(responder, box) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 151, in maybeDeferred result = f(*args, **kw) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1186, in doit return maybeDeferred(aCallable, **kw).addCallback( --- <exception caught here> --- File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 654, in _runCallbacks current.result = callback(current.result, *args, **kw) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/protocols/amp.py", line 1169, in checkKnownErrors key = error.trap(*command.allErrors) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 460, in trap self.raiseException() File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 488, in raiseException raise self.value.with_traceback(self.tb) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 151, in maybeDeferred result = f(*args, **kw) File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/client_protocol.py", line 242, in on_JM_AUTH_RECEIVED commitment, revelation, amount, kphex) File "/home/nv01/joinmarket-clientserver/jmbase/jmbase/support.py", line 280, in func_wrapper return func(inst, *newargs, **kwargs) File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/maker.py", line 105, in on_auth_received self.wallet_service.save_wallet() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet_service.py", line 769, in save_wallet self.wallet.save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 1531, in save super().save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 1838, in save super().save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 385, in save self._utxos.save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/wallet.py", line 182, in save self.storage.save() File "/home/nv01/joinmarket-clientserver/jmclient/jmclient/storage.py", line 134, in save raise StorageError("Read-only storage cannot be saved.") jmclient.storage.StorageError: Read-only storage cannot be saved. Amp server or network failure unhandled by client application. Dropping connection! To avoid, add errbacks to ALL remote commands! Traceback (most recent call last): --- <exception caught here> --- File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/internet/defer.py", line 654, in _runCallbacks current.result = callback(current.result, *args, **kw) File "/home/nv01/joinmarket-clientserver/jmdaemon/jmdaemon/daemon_protocol.py", line 114, in defaultErrback ConnectionDone, ConnectionLost) File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 460, in trap self.raiseException() File "/home/nv01/joinmarket-clientserver/jmvenv/lib/python3.7/site-packages/twisted/python/failure.py", line 488, in raiseException raise self.value.with_traceback(self.tb) twisted.protocols.amp.UnknownRemoteError: Code<UNKNOWN>: Unknown Error 2020-08-20 13:52:45,357 [DEBUG] Found a new channel, setting to: JXXX,('nXXX.onion', 6667) 2020-08-20 13:52:45,434 [DEBUG] Nick: JXXX has left. 2020-08-20 13:53:43,052 [DEBUG] Dynamic switch nick: JXXX 2020-08-20 13:55:25,035 [DEBUG] JXXX has dusty minsize, capping at 2730 2020-08-20 13:55:25,155 [DEBUG] JXXX has dusty minsize, capping at 2730 (...)
jmclient.storage.StorageError
def flush_nicks(self): """Any message channel which is not active must wipe any state information on peers connected for that message channel. If a peer is available on another chan, switch the active_channel for that nick to (an)(the) other, to make failure to communicate as unlikely as possible. """ for mc in self.unavailable_channels(): self.nicks_seen[mc] = set() ac = self.active_channels for peer in [x for x in ac if ac[x] == mc]: for mc2 in self.available_channels(): if peer in self.nicks_seen[mc2]: log.debug( "Dynamically switching: " + peer + " to: " + str(mc2.hostid) ) self.active_channels[peer] = mc2 break # Remove all entries for the newly unavailable channel self.active_channels = dict([(a, ac[a]) for a in ac if ac[a] != mc])
def flush_nicks(self): """Any message channel which is not active must wipe any state information on peers connected for that message channel. If a peer is available on another chan, switch the active_channel for that nick to (an)(the) other, to make failure to communicate as unlikely as possible. """ for mc in self.unavailable_channels(): self.nicks_seen[mc] = set() ac = self.active_channels for peer in [x for x in ac if ac[x] == mc]: for mc2 in self.available_channels(): if peer in self.nicks_seen[mc2]: log.debug( "Dynamically switching: " + peer + " to: " + str(mc2.serverport) ) self.active_channels[peer] = mc2 break # Remove all entries for the newly unavailable channel self.active_channels = dict([(a, ac[a]) for a in ac if ac[a] != mc])
https://github.com/JoinMarket-Org/joinmarket-clientserver/issues/105
Unhandled Error Traceback (most recent call last): File "/lib/python2.7/site-packages/twisted/protocols/amp.py", line 1043, in _commandReceived deferred = self.dispatchCommand(box) File "/lib/python2.7/site-packages/twisted/protocols/amp.py", line 1101, in dispatchCommand return maybeDeferred(responder, box) File "/lib/python2.7/site-packages/twisted/internet/defer.py", line 150, in maybeDeferred result = f(*args, **kw) File "/lib/python2.7/site-packages/twisted/protocols/amp.py", line 1188, in doit return maybeDeferred(aCallable, **kw).addCallback( --- <exception caught here> --- File "/lib/python2.7/site-packages/twisted/internet/defer.py", line 150, in maybeDeferred result = f(*args, **kw) File "/lib/python2.7/site-packages/jmdaemon/daemon_protocol.py", line 202, in on_JM_MSGSIGNATURE self.mcc.privmsg(nick, cmd, msg_to_return, mc=hostid) File "/lib/python2.7/site-packages/jmdaemon/message_channel.py", line 257, in privmsg "Tried to privmsg on an unavailable message channel.") exceptions.Exception: Tried to privmsg on an unavailable message channel.
exceptions.Exception
def prepare_privmsg(self, nick, cmd, message, mc=None): # should we encrypt? box, encrypt = self.get_encryption_box(cmd, nick) if encrypt: if not box: log.debug( "error, dont have encryption box object for " + nick + ", dropping message" ) return message = encrypt_encode(message.encode("ascii"), box) # Anti-replay measure: append the message channel identifier # to the signature; this prevents cross-channel replay but NOT # same-channel replay (in case of snooper after dropped connection # on this channel). if mc is None: if nick in self.active_channels: hostid = self.active_channels[nick].hostid else: log.info( "Failed to send message to: " + str(nick) + "; cannot find on any message channel." ) return else: hostid = mc.hostid msg_to_be_signed = message + str(hostid) self.daemon.request_signed_message(nick, cmd, message, msg_to_be_signed, hostid)
def prepare_privmsg(self, nick, cmd, message, mc=None): # should we encrypt? box, encrypt = self.get_encryption_box(cmd, nick) if encrypt: if not box: log.debug( "error, dont have encryption box object for " + nick + ", dropping message" ) return message = encrypt_encode(message.encode("ascii"), box) # Anti-replay measure: append the message channel identifier # to the signature; this prevents cross-channel replay but NOT # same-channel replay (in case of snooper after dropped connection # on this channel). if nick in self.active_channels: hostid = self.active_channels[nick].hostid else: log.info( "Failed to send message to: " + str(nick) + "; cannot find on any message channel." ) return msg_to_be_signed = message + str(hostid) self.daemon.request_signed_message(nick, cmd, message, msg_to_be_signed, hostid)
https://github.com/JoinMarket-Org/joinmarket-clientserver/issues/105
Unhandled Error Traceback (most recent call last): File "/lib/python2.7/site-packages/twisted/protocols/amp.py", line 1043, in _commandReceived deferred = self.dispatchCommand(box) File "/lib/python2.7/site-packages/twisted/protocols/amp.py", line 1101, in dispatchCommand return maybeDeferred(responder, box) File "/lib/python2.7/site-packages/twisted/internet/defer.py", line 150, in maybeDeferred result = f(*args, **kw) File "/lib/python2.7/site-packages/twisted/protocols/amp.py", line 1188, in doit return maybeDeferred(aCallable, **kw).addCallback( --- <exception caught here> --- File "/lib/python2.7/site-packages/twisted/internet/defer.py", line 150, in maybeDeferred result = f(*args, **kw) File "/lib/python2.7/site-packages/jmdaemon/daemon_protocol.py", line 202, in on_JM_MSGSIGNATURE self.mcc.privmsg(nick, cmd, msg_to_return, mc=hostid) File "/lib/python2.7/site-packages/jmdaemon/message_channel.py", line 257, in privmsg "Tried to privmsg on an unavailable message channel.") exceptions.Exception: Tried to privmsg on an unavailable message channel.
exceptions.Exception
def on_disconnect_trigger(self, mc): """Mark the specified message channel as disconnected. Track loss of private connections to individual nicks. If no message channels are now connected, fire on_disconnect to calling code. """ self.mc_status[mc] = 2 self.flush_nicks() # construct a readable nicks seen: readablens = dict([(k.hostid, self.nicks_seen[k]) for k in self.nicks_seen]) log.debug( "On disconnect fired, nicks_seen is now: " + str(readablens) + " " + mc.hostid ) if not any([x == 1 for x in self.mc_status.values()]): if self.on_disconnect: self.on_disconnect()
def on_disconnect_trigger(self, mc): """Mark the specified message channel as disconnected. Track loss of private connections to individual nicks. If no message channels are now connected, fire on_disconnect to calling code. """ self.mc_status[mc] = 2 self.flush_nicks() log.debug( "On disconnect fired, nicks_seen is now: " + str(self.nicks_seen) + " " + mc.hostid ) if not any([x == 1 for x in self.mc_status.values()]): if self.on_disconnect: self.on_disconnect()
https://github.com/JoinMarket-Org/joinmarket-clientserver/issues/105
Unhandled Error Traceback (most recent call last): File "/lib/python2.7/site-packages/twisted/protocols/amp.py", line 1043, in _commandReceived deferred = self.dispatchCommand(box) File "/lib/python2.7/site-packages/twisted/protocols/amp.py", line 1101, in dispatchCommand return maybeDeferred(responder, box) File "/lib/python2.7/site-packages/twisted/internet/defer.py", line 150, in maybeDeferred result = f(*args, **kw) File "/lib/python2.7/site-packages/twisted/protocols/amp.py", line 1188, in doit return maybeDeferred(aCallable, **kw).addCallback( --- <exception caught here> --- File "/lib/python2.7/site-packages/twisted/internet/defer.py", line 150, in maybeDeferred result = f(*args, **kw) File "/lib/python2.7/site-packages/jmdaemon/daemon_protocol.py", line 202, in on_JM_MSGSIGNATURE self.mcc.privmsg(nick, cmd, msg_to_return, mc=hostid) File "/lib/python2.7/site-packages/jmdaemon/message_channel.py", line 257, in privmsg "Tried to privmsg on an unavailable message channel.") exceptions.Exception: Tried to privmsg on an unavailable message channel.
exceptions.Exception
def on_auth_received(self, nick, offer, commitment, cr, amount, kphex): """Receives data on proposed transaction offer from daemon, verifies commitment, returns necessary data to send ioauth message (utxos etc) """ # check the validity of the proof of discrete log equivalence tries = jm_single().config.getint("POLICY", "taker_utxo_retries") def reject(msg): jlog.info("Counterparty commitment not accepted, reason: " + msg) return (False,) # deserialize the commitment revelation try: cr_dict = PoDLE.deserialize_revelation(cr) except PoDLEError as e: reason = repr(e) return reject(reason) if not verify_podle( str(cr_dict["P"]), str(cr_dict["P2"]), str(cr_dict["sig"]), str(cr_dict["e"]), str(commitment), index_range=range(tries), ): reason = "verify_podle failed" return reject(reason) # finally, check that the proffered utxo is real, old enough, large enough, # and corresponds to the pubkey res = jm_single().bc_interface.query_utxo_set([cr_dict["utxo"]], includeconf=True) if len(res) != 1 or not res[0]: reason = "authorizing utxo is not valid" return reject(reason) age = jm_single().config.getint("POLICY", "taker_utxo_age") if res[0]["confirms"] < age: reason = "commitment utxo not old enough: " + str(res[0]["confirms"]) return reject(reason) reqd_amt = int( amount * jm_single().config.getint("POLICY", "taker_utxo_amtpercent") / 100.0 ) if res[0]["value"] < reqd_amt: reason = "commitment utxo too small: " + str(res[0]["value"]) return reject(reason) # FIXME: This only works if taker's commitment address is of same type # as our wallet. if res[0]["address"] != self.wallet.pubkey_to_addr(unhexlify(cr_dict["P"])): reason = "Invalid podle pubkey: " + str(cr_dict["P"]) return reject(reason) # authorisation of taker passed # Find utxos for the transaction now: utxos, cj_addr, change_addr = self.oid_to_order(offer, amount) if not utxos: # could not find funds return (False,) self.wallet.update_cache_index() # Construct data for auth request back to taker. # Need to choose an input utxo pubkey to sign with # (no longer using the coinjoin pubkey from 0.2.0) # Just choose the first utxo in self.utxos and retrieve key from wallet. auth_address = utxos[utxos.keys()[0]]["address"] auth_key = self.wallet.get_key_from_addr(auth_address) auth_pub = btc.privtopub(auth_key) btc_sig = btc.ecdsa_sign(kphex, auth_key) return (True, utxos, auth_pub, cj_addr, change_addr, btc_sig)
def on_auth_received(self, nick, offer, commitment, cr, amount, kphex): """Receives data on proposed transaction offer from daemon, verifies commitment, returns necessary data to send ioauth message (utxos etc) """ # deserialize the commitment revelation cr_dict = PoDLE.deserialize_revelation(cr) # check the validity of the proof of discrete log equivalence tries = jm_single().config.getint("POLICY", "taker_utxo_retries") def reject(msg): jlog.info("Counterparty commitment not accepted, reason: " + msg) return (False,) if not verify_podle( str(cr_dict["P"]), str(cr_dict["P2"]), str(cr_dict["sig"]), str(cr_dict["e"]), str(commitment), index_range=range(tries), ): reason = "verify_podle failed" return reject(reason) # finally, check that the proffered utxo is real, old enough, large enough, # and corresponds to the pubkey res = jm_single().bc_interface.query_utxo_set([cr_dict["utxo"]], includeconf=True) if len(res) != 1 or not res[0]: reason = "authorizing utxo is not valid" return reject(reason) age = jm_single().config.getint("POLICY", "taker_utxo_age") if res[0]["confirms"] < age: reason = "commitment utxo not old enough: " + str(res[0]["confirms"]) return reject(reason) reqd_amt = int( amount * jm_single().config.getint("POLICY", "taker_utxo_amtpercent") / 100.0 ) if res[0]["value"] < reqd_amt: reason = "commitment utxo too small: " + str(res[0]["value"]) return reject(reason) # FIXME: This only works if taker's commitment address is of same type # as our wallet. if res[0]["address"] != self.wallet.pubkey_to_addr(unhexlify(cr_dict["P"])): reason = "Invalid podle pubkey: " + str(cr_dict["P"]) return reject(reason) # authorisation of taker passed # Find utxos for the transaction now: utxos, cj_addr, change_addr = self.oid_to_order(offer, amount) if not utxos: # could not find funds return (False,) self.wallet.update_cache_index() # Construct data for auth request back to taker. # Need to choose an input utxo pubkey to sign with # (no longer using the coinjoin pubkey from 0.2.0) # Just choose the first utxo in self.utxos and retrieve key from wallet. auth_address = utxos[utxos.keys()[0]]["address"] auth_key = self.wallet.get_key_from_addr(auth_address) auth_pub = btc.privtopub(auth_key) btc_sig = btc.ecdsa_sign(kphex, auth_key) return (True, utxos, auth_pub, cj_addr, change_addr, btc_sig)
https://github.com/JoinMarket-Org/joinmarket-clientserver/issues/225
Unhandled Error Traceback (most recent call last): File "XXX/joinmarket-clientserver/jmvenv/lib/python2.7/site-packages/twisted/protocols/amp.py", line 1043, in _commandReceived deferred = self.dispatchCommand(box) File "XXX/joinmarket-clientserver/jmvenv/lib/python2.7/site-packages/twisted/protocols/amp.py", line 1101, in dispatchCommand return maybeDeferred(responder, box) File "XXX/joinmarket-clientserver/jmvenv/lib/python2.7/site-packages/twisted/internet/defer.py", line 150, in maybeDeferred result = f(*args, **kw) File "XXX/joinmarket-clientserver/jmvenv/lib/python2.7/site-packages/twisted/protocols/amp.py", line 1188, in doit return maybeDeferred(aCallable, **kw).addCallback( --- <exception caught here> --- File "XXX/joinmarket-clientserver/jmvenv/lib/python2.7/site-packages/twisted/internet/defer.py", line 150, in maybeDeferred result = f(*args, **kw) File "XXX/joinmarket-clientserver/jmvenv/lib/python2.7/site-packages/jmclient/client_protocol.py", line 194, in on_JM_AUTH_RECEIVED commitment, revelation, amount, kphex) File "XXX/joinmarket-clientserver/jmvenv/lib/python2.7/site-packages/jmclient/maker.py", line 51, in on_auth_received cr_dict = PoDLE.deserialize_revelation(cr) File "XXX/joinmarket-clientserver/jmvenv/lib/python2.7/site-packages/jmclient/podle.py", line 211, in deserialize_revelation raise PoDLEError("Failed to deserialize, wrong format") jmclient.podle.PoDLEError: Failed to deserialize, wrong format Amp server or network failure unhandled by client application. Dropping connection! To avoid, add errbacks to ALL remote commands! Traceback (most recent call last): Failure: twisted.protocols.amp.UnknownRemoteError: Code<UNKNOWN>: Unknown Error
jmclient.podle.PoDLEError
def on_JM_FILL_RESPONSE(self, success, ioauth_data): """Receives the entire set of phase 1 data (principally utxos) from the counterparties and passes through to the Taker for tx construction. If there were sufficient makers, data is passed over for exactly those makers that responded. If not, the list of non-responsive makers is added to the permanent "ignored_makers" list, but the Taker processing is bypassed and the transaction is abandoned here (so will be picked up as stalled in multi-join schedules). In the first of the above two cases, after the Taker processes the ioauth data and returns the proposed transaction, passes the phase 2 initiating data to the daemon. """ ioauth_data = json.loads(ioauth_data) if not success: jlog.info("Makers who didnt respond: " + str(ioauth_data)) self.client.add_ignored_makers(ioauth_data) return {"accepted": True} else: jlog.info("Makers responded with: " + json.dumps(ioauth_data)) retval = self.client.receive_utxos(ioauth_data) if not retval[0]: jlog.info("Taker is not continuing, phase 2 abandoned.") jlog.info("Reason: " + str(retval[1])) return {"accepted": False} else: nick_list, txhex = retval[1:] reactor.callLater(0, self.make_tx, nick_list, txhex) return {"accepted": True}
def on_JM_FILL_RESPONSE(self, success, ioauth_data): """Receives the entire set of phase 1 data (principally utxos) from the counterparties and passes through to the Taker for tx construction, if successful. Then passes back the phase 2 initiating data to the daemon. """ ioauth_data = json.loads(ioauth_data) if not success: nonresponders = ioauth_data jlog.info("Makers didnt respond: " + str(nonresponders)) self.client.add_ignored_makers(nonresponders) return {"accepted": True} else: jlog.info("Makers responded with: " + json.dumps(ioauth_data)) retval = self.client.receive_utxos(ioauth_data) if not retval[0]: jlog.info("Taker is not continuing, phase 2 abandoned.") jlog.info("Reason: " + str(retval[1])) return {"accepted": False} else: nick_list, txhex = retval[1:] reactor.callLater(0, self.make_tx, nick_list, txhex) return {"accepted": True}
https://github.com/JoinMarket-Org/joinmarket-clientserver/issues/169
2018-07-21 00:03:59,900 [MainThread ] [INFO ] Makers didnt respond: [u'J57XBPc4Ub5b3xxO', u'J54nByhefebjZFkB'] 2018-07-21 00:21:32,779 [MainThread ] [INFO ] STALL MONITOR: 2018-07-21 00:21:32,779 [MainThread ] [INFO ] Stall detected. Regenerating transactions and retrying. Unhandled Error Traceback (most recent call last): File "sendpayment.py", line 233, in main clientfactory, daemon=daemon) File "/home/alex/Documents/joinmarket-dev/test_ranr-under-max/joinmarket-clientserver/jmvenv/local/lib/python2.7/site-packages/jmclient/client_protocol.py", line 495, in start_reactor reactor.run(installSignalHandlers=ish) File "/home/alex/Documents/joinmarket-dev/test_ranr-under-max/joinmarket-clientserver/jmvenv/local/lib/python2.7/site-packages/twisted/internet/base.py", line 1199, in run self.mainLoop() File "/home/alex/Documents/joinmarket-dev/test_ranr-under-max/joinmarket-clientserver/jmvenv/local/lib/python2.7/site-packages/twisted/internet/base.py", line 1208, in mainLoop self.runUntilCurrent() --- <exception caught here> --- File "/home/alex/Documents/joinmarket-dev/test_ranr-under-max/joinmarket-clientserver/jmvenv/local/lib/python2.7/site-packages/twisted/internet/base.py", line 828, in runUntilCurrent call.func(*call.args, **call.kw) File "/home/alex/Documents/joinmarket-dev/test_ranr-under-max/joinmarket-clientserver/jmvenv/local/lib/python2.7/site-packages/jmclient/client_protocol.py", line 346, in stallMonitor self.client.on_finished_callback(False, True, 0.0) File "sendpayment.py", line 189, in taker_finished "makers didn't respond: ", taker.nonrespondants, exceptions.AttributeError: 'Taker' object has no attribute 'nonrespondants'
exceptions.AttributeError
def __init__( self, wallet, schedule, order_chooser=weighted_order_choose, sign_method=None, callbacks=None, tdestaddrs=None, ignored_makers=None, ): """Schedule must be a list of tuples: (see sample_schedule_for_testnet for explanation of syntax, also schedule.py module in this directory), which will be a sequence of joins to do. Callbacks: External callers set the 3 callbacks for filtering orders, sending info messages to client, and action on completion. "None" is allowable for taker_info_callback, defaults to log msg. Callback function definitions: ===================== filter_orders_callback ===================== args: 1. orders_fees - a list of two items 1. orders dict 2 total cjfee 2. cjamount - coinjoin amount in satoshis returns: False - offers rejected OR True - offers accepted OR 'retry' - offers not accepted but try again ======================= on_finished_callback ======================= args: 1. res - True means tx successful, False means tx unsucessful 2. fromtx - True means not the final transaction, False means final (end of schedule), 'unconfirmed' means tx seen on the network only. 3. waittime - passed in minutes, time to wait after confirmation before continuing to next tx (thus, only used if fromtx is True). 4. txdetails - a tuple (txd, txid) - only to be used when fromtx is 'unconfirmed', used for monitoring. returns: None ======================== taker_info_callback ======================== args: 1. type - one of 'ABORT' or 'INFO', the former signals the client that processing of this transaction is aborted, the latter is only an update. 2. message - an information message. returns: None """ self.aborted = False self.wallet = wallet self.schedule = schedule self.order_chooser = order_chooser # List (which persists between transactions) of makers # who have not responded or behaved maliciously at any # stage of the protocol. self.ignored_makers = [] if not ignored_makers else ignored_makers # Used in attempts to complete with subset after second round failure: self.honest_makers = [] # Toggle: if set, only honest makers will be used from orderbook self.honest_only = False # Temporary (per transaction) list of makers that keeps track of # which have responded, both in Stage 1 and Stage 2. Before each # stage, the list is set to the full set of expected responders, # and entries are removed when honest responses are received; # emptiness of the list can be used to trigger completion of # processing. self.nonrespondants = [] self.waiting_for_conf = False self.txid = None self.schedule_index = -1 self.tdestaddrs = [] if not tdestaddrs else tdestaddrs # allow custom wallet-based clients to use their own signing code; # currently only setting "wallet" is allowed, calls wallet.sign_tx(tx) self.sign_method = sign_method self.filter_orders_callback = callbacks[0] self.taker_info_callback = callbacks[1] if not self.taker_info_callback: self.taker_info_callback = self.default_taker_info_callback self.on_finished_callback = callbacks[2]
def __init__( self, wallet, schedule, order_chooser=weighted_order_choose, sign_method=None, callbacks=None, tdestaddrs=None, ignored_makers=None, ): """Schedule must be a list of tuples: (see sample_schedule_for_testnet for explanation of syntax, also schedule.py module in this directory), which will be a sequence of joins to do. Callbacks: External callers set the 3 callbacks for filtering orders, sending info messages to client, and action on completion. "None" is allowable for taker_info_callback, defaults to log msg. Callback function definitions: ===================== filter_orders_callback ===================== args: 1. orders_fees - a list of two items 1. orders dict 2 total cjfee 2. cjamount - coinjoin amount in satoshis returns: False - offers rejected OR True - offers accepted OR 'retry' - offers not accepted but try again ======================= on_finished_callback ======================= args: 1. res - True means tx successful, False means tx unsucessful 2. fromtx - True means not the final transaction, False means final (end of schedule), 'unconfirmed' means tx seen on the network only. 3. waittime - passed in minutes, time to wait after confirmation before continuing to next tx (thus, only used if fromtx is True). 4. txdetails - a tuple (txd, txid) - only to be used when fromtx is 'unconfirmed', used for monitoring. returns: None ======================== taker_info_callback ======================== args: 1. type - one of 'ABORT' or 'INFO', the former signals the client that processing of this transaction is aborted, the latter is only an update. 2. message - an information message. returns: None """ self.aborted = False self.wallet = wallet self.schedule = schedule self.order_chooser = order_chooser self.ignored_makers = [] if not ignored_makers else ignored_makers # Used in attempts to complete with subset after second round failure: self.honest_makers = [] # Toggle: if set, only honest makers will be used from orderbook self.honest_only = False self.waiting_for_conf = False self.txid = None self.schedule_index = -1 self.tdestaddrs = [] if not tdestaddrs else tdestaddrs # allow custom wallet-based clients to use their own signing code; # currently only setting "wallet" is allowed, calls wallet.sign_tx(tx) self.sign_method = sign_method self.filter_orders_callback = callbacks[0] self.taker_info_callback = callbacks[1] if not self.taker_info_callback: self.taker_info_callback = self.default_taker_info_callback self.on_finished_callback = callbacks[2]
https://github.com/JoinMarket-Org/joinmarket-clientserver/issues/169
2018-07-21 00:03:59,900 [MainThread ] [INFO ] Makers didnt respond: [u'J57XBPc4Ub5b3xxO', u'J54nByhefebjZFkB'] 2018-07-21 00:21:32,779 [MainThread ] [INFO ] STALL MONITOR: 2018-07-21 00:21:32,779 [MainThread ] [INFO ] Stall detected. Regenerating transactions and retrying. Unhandled Error Traceback (most recent call last): File "sendpayment.py", line 233, in main clientfactory, daemon=daemon) File "/home/alex/Documents/joinmarket-dev/test_ranr-under-max/joinmarket-clientserver/jmvenv/local/lib/python2.7/site-packages/jmclient/client_protocol.py", line 495, in start_reactor reactor.run(installSignalHandlers=ish) File "/home/alex/Documents/joinmarket-dev/test_ranr-under-max/joinmarket-clientserver/jmvenv/local/lib/python2.7/site-packages/twisted/internet/base.py", line 1199, in run self.mainLoop() File "/home/alex/Documents/joinmarket-dev/test_ranr-under-max/joinmarket-clientserver/jmvenv/local/lib/python2.7/site-packages/twisted/internet/base.py", line 1208, in mainLoop self.runUntilCurrent() --- <exception caught here> --- File "/home/alex/Documents/joinmarket-dev/test_ranr-under-max/joinmarket-clientserver/jmvenv/local/lib/python2.7/site-packages/twisted/internet/base.py", line 828, in runUntilCurrent call.func(*call.args, **call.kw) File "/home/alex/Documents/joinmarket-dev/test_ranr-under-max/joinmarket-clientserver/jmvenv/local/lib/python2.7/site-packages/jmclient/client_protocol.py", line 346, in stallMonitor self.client.on_finished_callback(False, True, 0.0) File "sendpayment.py", line 189, in taker_finished "makers didn't respond: ", taker.nonrespondants, exceptions.AttributeError: 'Taker' object has no attribute 'nonrespondants'
exceptions.AttributeError
def add_ignored_makers(self, makers): """Makers should be added to this list when they have refused to complete the protocol honestly, and should remain in this set for the duration of the Taker run (so, the whole schedule). """ self.ignored_makers.extend(makers) self.ignored_makers = list(set(self.ignored_makers))
def add_ignored_makers(self, makers): """Makers should be added to this list when they have refused to complete the protocol honestly, and should remain in this set for the duration of the Taker run (so, the whole schedule). """ self.ignored_makers.extend(makers)
https://github.com/JoinMarket-Org/joinmarket-clientserver/issues/169
2018-07-21 00:03:59,900 [MainThread ] [INFO ] Makers didnt respond: [u'J57XBPc4Ub5b3xxO', u'J54nByhefebjZFkB'] 2018-07-21 00:21:32,779 [MainThread ] [INFO ] STALL MONITOR: 2018-07-21 00:21:32,779 [MainThread ] [INFO ] Stall detected. Regenerating transactions and retrying. Unhandled Error Traceback (most recent call last): File "sendpayment.py", line 233, in main clientfactory, daemon=daemon) File "/home/alex/Documents/joinmarket-dev/test_ranr-under-max/joinmarket-clientserver/jmvenv/local/lib/python2.7/site-packages/jmclient/client_protocol.py", line 495, in start_reactor reactor.run(installSignalHandlers=ish) File "/home/alex/Documents/joinmarket-dev/test_ranr-under-max/joinmarket-clientserver/jmvenv/local/lib/python2.7/site-packages/twisted/internet/base.py", line 1199, in run self.mainLoop() File "/home/alex/Documents/joinmarket-dev/test_ranr-under-max/joinmarket-clientserver/jmvenv/local/lib/python2.7/site-packages/twisted/internet/base.py", line 1208, in mainLoop self.runUntilCurrent() --- <exception caught here> --- File "/home/alex/Documents/joinmarket-dev/test_ranr-under-max/joinmarket-clientserver/jmvenv/local/lib/python2.7/site-packages/twisted/internet/base.py", line 828, in runUntilCurrent call.func(*call.args, **call.kw) File "/home/alex/Documents/joinmarket-dev/test_ranr-under-max/joinmarket-clientserver/jmvenv/local/lib/python2.7/site-packages/jmclient/client_protocol.py", line 346, in stallMonitor self.client.on_finished_callback(False, True, 0.0) File "sendpayment.py", line 189, in taker_finished "makers didn't respond: ", taker.nonrespondants, exceptions.AttributeError: 'Taker' object has no attribute 'nonrespondants'
exceptions.AttributeError
def add_honest_makers(self, makers): """A maker who has shown willigness to complete the protocol by returning a valid signature for a coinjoin can be added to this list, the taker can optionally choose to only source offers from thus-defined "honest" makers. """ self.honest_makers.extend(makers) self.honest_makers = list(set(self.honest_makers))
def add_honest_makers(self, makers): """A maker who has shown willigness to complete the protocol by returning a valid signature for a coinjoin can be added to this list, the taker can optionally choose to only source offers from thus-defined "honest" makers. """ self.honest_makers.extend(makers)
https://github.com/JoinMarket-Org/joinmarket-clientserver/issues/169
2018-07-21 00:03:59,900 [MainThread ] [INFO ] Makers didnt respond: [u'J57XBPc4Ub5b3xxO', u'J54nByhefebjZFkB'] 2018-07-21 00:21:32,779 [MainThread ] [INFO ] STALL MONITOR: 2018-07-21 00:21:32,779 [MainThread ] [INFO ] Stall detected. Regenerating transactions and retrying. Unhandled Error Traceback (most recent call last): File "sendpayment.py", line 233, in main clientfactory, daemon=daemon) File "/home/alex/Documents/joinmarket-dev/test_ranr-under-max/joinmarket-clientserver/jmvenv/local/lib/python2.7/site-packages/jmclient/client_protocol.py", line 495, in start_reactor reactor.run(installSignalHandlers=ish) File "/home/alex/Documents/joinmarket-dev/test_ranr-under-max/joinmarket-clientserver/jmvenv/local/lib/python2.7/site-packages/twisted/internet/base.py", line 1199, in run self.mainLoop() File "/home/alex/Documents/joinmarket-dev/test_ranr-under-max/joinmarket-clientserver/jmvenv/local/lib/python2.7/site-packages/twisted/internet/base.py", line 1208, in mainLoop self.runUntilCurrent() --- <exception caught here> --- File "/home/alex/Documents/joinmarket-dev/test_ranr-under-max/joinmarket-clientserver/jmvenv/local/lib/python2.7/site-packages/twisted/internet/base.py", line 828, in runUntilCurrent call.func(*call.args, **call.kw) File "/home/alex/Documents/joinmarket-dev/test_ranr-under-max/joinmarket-clientserver/jmvenv/local/lib/python2.7/site-packages/jmclient/client_protocol.py", line 346, in stallMonitor self.client.on_finished_callback(False, True, 0.0) File "sendpayment.py", line 189, in taker_finished "makers didn't respond: ", taker.nonrespondants, exceptions.AttributeError: 'Taker' object has no attribute 'nonrespondants'
exceptions.AttributeError
def initialize(self, orderbook): """Once the daemon is active and has returned the current orderbook, select offers, re-initialize variables and prepare a commitment, then send it to the protocol to fill offers. """ if self.aborted: return (False,) self.taker_info_callback("INFO", "Received offers from joinmarket pit") # choose the next item in the schedule self.schedule_index += 1 if self.schedule_index == len(self.schedule): self.taker_info_callback("INFO", "Finished all scheduled transactions") self.on_finished_callback(True) return (False,) else: # read the settings from the schedule entry si = self.schedule[self.schedule_index] self.mixdepth = si[0] self.cjamount = si[1] # non-integer coinjoin amounts are treated as fractions # this is currently used by the tumbler algo if isinstance(self.cjamount, float): # the mixdepth balance is fixed at the *start* of each new # mixdepth in tumble schedules: if ( self.schedule_index == 0 or si[0] != self.schedule[self.schedule_index - 1] ): self.mixdepthbal = self.wallet.get_balance_by_mixdepth()[self.mixdepth] # reset to satoshis self.cjamount = int(self.cjamount * self.mixdepthbal) if self.cjamount < jm_single().mincjamount: jlog.info( "Coinjoin amount too low, bringing up to: " + str(jm_single().mincjamount) ) self.cjamount = jm_single().mincjamount self.n_counterparties = si[2] self.my_cj_addr = si[3] # if destination is flagged "INTERNAL", choose a destination # from the next mixdepth modulo the maxmixdepth if self.my_cj_addr == "INTERNAL": next_mixdepth = (self.mixdepth + 1) % self.wallet.max_mix_depth jlog.info("Choosing a destination from mixdepth: " + str(next_mixdepth)) self.my_cj_addr = self.wallet.get_internal_addr(next_mixdepth) jlog.info("Chose destination address: " + self.my_cj_addr) self.outputs = [] self.cjfee_total = 0 self.maker_txfee_contributions = 0 self.txfee_default = 5000 self.latest_tx = None self.txid = None sweep = True if self.cjamount == 0 else False if not self.filter_orderbook(orderbook, sweep): return (False,) # choose coins to spend self.taker_info_callback("INFO", "Preparing bitcoin data..") if not self.prepare_my_bitcoin_data(): return (False,) # Prepare a commitment commitment, revelation, errmsg = self.make_commitment() if not commitment: utxo_pairs, to, ts = revelation if len(to) == 0: # If any utxos are too new, then we can continue retrying # until they get old enough; otherwise, we have to abort # (TODO, it's possible for user to dynamically add more coins, # consider if this option means we should stay alive). self.taker_info_callback("ABORT", errmsg) self.on_finished_callback(False) else: self.taker_info_callback("INFO", errmsg) return (False,) else: self.taker_info_callback("INFO", errmsg) # Initialization has been successful. We must set the nonrespondants # now to keep track of what changed when we receive the utxo data self.nonrespondants = self.orderbook.keys() return (True, self.cjamount, commitment, revelation, self.orderbook)
def initialize(self, orderbook): """Once the daemon is active and has returned the current orderbook, select offers, re-initialize variables and prepare a commitment, then send it to the protocol to fill offers. """ if self.aborted: return (False,) self.taker_info_callback("INFO", "Received offers from joinmarket pit") # choose the next item in the schedule self.schedule_index += 1 if self.schedule_index == len(self.schedule): self.taker_info_callback("INFO", "Finished all scheduled transactions") self.on_finished_callback(True) return (False,) else: # read the settings from the schedule entry si = self.schedule[self.schedule_index] self.mixdepth = si[0] self.cjamount = si[1] # non-integer coinjoin amounts are treated as fractions # this is currently used by the tumbler algo if isinstance(self.cjamount, float): # the mixdepth balance is fixed at the *start* of each new # mixdepth in tumble schedules: if ( self.schedule_index == 0 or si[0] != self.schedule[self.schedule_index - 1] ): self.mixdepthbal = self.wallet.get_balance_by_mixdepth()[self.mixdepth] # reset to satoshis self.cjamount = int(self.cjamount * self.mixdepthbal) if self.cjamount < jm_single().mincjamount: jlog.info( "Coinjoin amount too low, bringing up to: " + str(jm_single().mincjamount) ) self.cjamount = jm_single().mincjamount self.n_counterparties = si[2] self.my_cj_addr = si[3] # if destination is flagged "INTERNAL", choose a destination # from the next mixdepth modulo the maxmixdepth if self.my_cj_addr == "INTERNAL": next_mixdepth = (self.mixdepth + 1) % self.wallet.max_mix_depth jlog.info("Choosing a destination from mixdepth: " + str(next_mixdepth)) self.my_cj_addr = self.wallet.get_internal_addr(next_mixdepth) jlog.info("Chose destination address: " + self.my_cj_addr) self.outputs = [] self.cjfee_total = 0 self.maker_txfee_contributions = 0 self.txfee_default = 5000 self.txid = None sweep = True if self.cjamount == 0 else False if not self.filter_orderbook(orderbook, sweep): return (False,) # choose coins to spend self.taker_info_callback("INFO", "Preparing bitcoin data..") if not self.prepare_my_bitcoin_data(): return (False,) # Prepare a commitment commitment, revelation, errmsg = self.make_commitment() if not commitment: utxo_pairs, to, ts = revelation if len(to) == 0: # If any utxos are too new, then we can continue retrying # until they get old enough; otherwise, we have to abort # (TODO, it's possible for user to dynamically add more coins, # consider if this option means we should stay alive). self.taker_info_callback("ABORT", errmsg) self.on_finished_callback(False) else: self.taker_info_callback("INFO", errmsg) return (False,) else: self.taker_info_callback("INFO", errmsg) return (True, self.cjamount, commitment, revelation, self.orderbook)
https://github.com/JoinMarket-Org/joinmarket-clientserver/issues/169
2018-07-21 00:03:59,900 [MainThread ] [INFO ] Makers didnt respond: [u'J57XBPc4Ub5b3xxO', u'J54nByhefebjZFkB'] 2018-07-21 00:21:32,779 [MainThread ] [INFO ] STALL MONITOR: 2018-07-21 00:21:32,779 [MainThread ] [INFO ] Stall detected. Regenerating transactions and retrying. Unhandled Error Traceback (most recent call last): File "sendpayment.py", line 233, in main clientfactory, daemon=daemon) File "/home/alex/Documents/joinmarket-dev/test_ranr-under-max/joinmarket-clientserver/jmvenv/local/lib/python2.7/site-packages/jmclient/client_protocol.py", line 495, in start_reactor reactor.run(installSignalHandlers=ish) File "/home/alex/Documents/joinmarket-dev/test_ranr-under-max/joinmarket-clientserver/jmvenv/local/lib/python2.7/site-packages/twisted/internet/base.py", line 1199, in run self.mainLoop() File "/home/alex/Documents/joinmarket-dev/test_ranr-under-max/joinmarket-clientserver/jmvenv/local/lib/python2.7/site-packages/twisted/internet/base.py", line 1208, in mainLoop self.runUntilCurrent() --- <exception caught here> --- File "/home/alex/Documents/joinmarket-dev/test_ranr-under-max/joinmarket-clientserver/jmvenv/local/lib/python2.7/site-packages/twisted/internet/base.py", line 828, in runUntilCurrent call.func(*call.args, **call.kw) File "/home/alex/Documents/joinmarket-dev/test_ranr-under-max/joinmarket-clientserver/jmvenv/local/lib/python2.7/site-packages/jmclient/client_protocol.py", line 346, in stallMonitor self.client.on_finished_callback(False, True, 0.0) File "sendpayment.py", line 189, in taker_finished "makers didn't respond: ", taker.nonrespondants, exceptions.AttributeError: 'Taker' object has no attribute 'nonrespondants'
exceptions.AttributeError
def receive_utxos(self, ioauth_data): """Triggered when the daemon returns utxo data from makers who responded; this is the completion of phase 1 of the protocol """ if self.aborted: return (False, "User aborted") # Temporary list used to aggregate all ioauth data that must be removed rejected_counterparties = [] # Need to authorize against the btc pubkey first. for nick, nickdata in ioauth_data.iteritems(): utxo_list, auth_pub, cj_addr, change_addr, btc_sig, maker_pk = nickdata if not self.auth_counterparty(btc_sig, auth_pub, maker_pk): jlog.debug("Counterparty encryption verification failed, aborting: " + nick) # This counterparty must be rejected rejected_counterparties.append(nick) for rc in rejected_counterparties: del ioauth_data[rc] self.maker_utxo_data = {} for nick, nickdata in ioauth_data.iteritems(): utxo_list, auth_pub, cj_addr, change_addr, btc_sig, maker_pk = nickdata self.utxos[nick] = utxo_list utxo_data = jm_single().bc_interface.query_utxo_set(self.utxos[nick]) if None in utxo_data: jlog.warn( ("ERROR outputs unconfirmed or already spent. utxo_data={}").format( pprint.pformat(utxo_data) ) ) # when internal reviewing of makers is created, add it here to # immediately quit; currently, the timeout thread suffices. continue # Complete maker authorization: # Extract the address fields from the utxos # Construct the Bitcoin address for the auth_pub field # Ensure that at least one address from utxos corresponds. input_addresses = [d["address"] for d in utxo_data] auth_address = self.wallet.pubkey_to_address(auth_pub) if not auth_address in input_addresses: jlog.warn( "ERROR maker's (" + nick + ")" " authorising pubkey is not included " "in the transaction: " + str(auth_address) ) # this will not be added to the transaction, so we will have # to recheck if we have enough continue total_input = sum([d["value"] for d in utxo_data]) real_cjfee = calc_cj_fee( self.orderbook[nick]["ordertype"], self.orderbook[nick]["cjfee"], self.cjamount, ) change_amount = ( total_input - self.cjamount - self.orderbook[nick]["txfee"] + real_cjfee ) # certain malicious and/or incompetent liquidity providers send # inputs totalling less than the coinjoin amount! this leads to # a change output of zero satoshis; this counterparty must be removed. if change_amount < jm_single().DUST_THRESHOLD: fmt = ( "ERROR counterparty requires sub-dust change. nick={}" "totalin={:d} cjamount={:d} change={:d}" ).format jlog.warn(fmt(nick, total_input, self.cjamount, change_amount)) jlog.warn("Invalid change, too small, nick= " + nick) continue self.outputs.append({"address": change_addr, "value": change_amount}) fmt = ( "fee breakdown for {} totalin={:d} cjamount={:d} txfee={:d} realcjfee={:d}" ).format jlog.info( fmt( nick, total_input, self.cjamount, self.orderbook[nick]["txfee"], real_cjfee, ) ) self.outputs.append({"address": cj_addr, "value": self.cjamount}) self.cjfee_total += real_cjfee self.maker_txfee_contributions += self.orderbook[nick]["txfee"] self.maker_utxo_data[nick] = utxo_data # We have succesfully processed the data from this nick: try: self.nonrespondants.remove(nick) except Exception as e: jlog.warn( "Failure to remove counterparty from nonrespondants list: " + str(nick) + ", error message: " + repr(e) ) # Apply business logic of how many counterparties are enough; note that # this must occur after the above ioauth data processing, since we only now # know for sure that the data meets all business-logic requirements. if len(self.maker_utxo_data.keys()) < jm_single().config.getint( "POLICY", "minimum_makers" ): self.taker_info_callback("INFO", "Not enough counterparties, aborting.") return (False, "Not enough counterparties responded to fill, giving up") self.taker_info_callback("INFO", "Got all parts, enough to build a tx") # The list self.nonrespondants is now reset and # used to track return of signatures for phase 2 self.nonrespondants = list(self.maker_utxo_data.keys()) my_total_in = sum([va["value"] for u, va in self.input_utxos.iteritems()]) if self.my_change_addr: # Estimate fee per choice of next/3/6 blocks targetting. estimated_fee = estimate_tx_fee( len(sum(self.utxos.values(), [])), len(self.outputs) + 2, txtype=self.wallet.get_txtype(), ) jlog.info( "Based on initial guess: " + str(self.total_txfee) + ", we estimated a miner fee of: " + str(estimated_fee) ) # reset total self.total_txfee = estimated_fee my_txfee = max(self.total_txfee - self.maker_txfee_contributions, 0) my_change_value = my_total_in - self.cjamount - self.cjfee_total - my_txfee # Since we could not predict the maker's inputs, we may end up needing # too much such that the change value is negative or small. Note that # we have tried to avoid this based on over-estimating the needed amount # in SendPayment.create_tx(), but it is still a possibility if one maker # uses a *lot* of inputs. if self.my_change_addr and my_change_value <= 0: raise ValueError( "Calculated transaction fee of: " + str(self.total_txfee) + " is too large for our inputs;Please try again." ) elif self.my_change_addr and my_change_value <= jm_single().BITCOIN_DUST_THRESHOLD: jlog.info( "Dynamically calculated change lower than dust: " + str(my_change_value) + "; dropping." ) self.my_change_addr = None my_change_value = 0 jlog.info( "fee breakdown for me totalin=%d my_txfee=%d makers_txfee=%d cjfee_total=%d => changevalue=%d" % ( my_total_in, my_txfee, self.maker_txfee_contributions, self.cjfee_total, my_change_value, ) ) if self.my_change_addr is None: if my_change_value != 0 and abs(my_change_value) != 1: # seems you wont always get exactly zero because of integer # rounding so 1 satoshi extra or fewer being spent as miner # fees is acceptable jlog.info( ("WARNING CHANGE NOT BEING USED\nCHANGEVALUE = {}").format( my_change_value ) ) else: self.outputs.append({"address": self.my_change_addr, "value": my_change_value}) self.utxo_tx = [dict([("output", u)]) for u in sum(self.utxos.values(), [])] self.outputs.append({"address": self.coinjoin_address(), "value": self.cjamount}) random.shuffle(self.utxo_tx) random.shuffle(self.outputs) tx = btc.mktx(self.utxo_tx, self.outputs) jlog.info("obtained tx\n" + pprint.pformat(btc.deserialize(tx))) self.latest_tx = btc.deserialize(tx) for index, ins in enumerate(self.latest_tx["ins"]): utxo = ins["outpoint"]["hash"] + ":" + str(ins["outpoint"]["index"]) if utxo not in self.input_utxos.keys(): continue # placeholders required ins["script"] = "deadbeef" self.taker_info_callback("INFO", "Built tx, sending to counterparties.") return (True, self.maker_utxo_data.keys(), tx)
def receive_utxos(self, ioauth_data): """Triggered when the daemon returns utxo data from makers who responded; this is the completion of phase 1 of the protocol """ if self.aborted: return (False, "User aborted") rejected_counterparties = [] # Enough data, but need to authorize against the btc pubkey first. for nick, nickdata in ioauth_data.iteritems(): utxo_list, auth_pub, cj_addr, change_addr, btc_sig, maker_pk = nickdata if not self.auth_counterparty(btc_sig, auth_pub, maker_pk): jlog.debug("Counterparty encryption verification failed, aborting: " + nick) # This counterparty must be rejected rejected_counterparties.append(nick) for rc in rejected_counterparties: del ioauth_data[rc] self.maker_utxo_data = {} for nick, nickdata in ioauth_data.iteritems(): utxo_list, auth_pub, cj_addr, change_addr, btc_sig, maker_pk = nickdata self.utxos[nick] = utxo_list utxo_data = jm_single().bc_interface.query_utxo_set(self.utxos[nick]) if None in utxo_data: jlog.warn( ("ERROR outputs unconfirmed or already spent. utxo_data={}").format( pprint.pformat(utxo_data) ) ) # when internal reviewing of makers is created, add it here to # immediately quit; currently, the timeout thread suffices. continue # Complete maker authorization: # Extract the address fields from the utxos # Construct the Bitcoin address for the auth_pub field # Ensure that at least one address from utxos corresponds. input_addresses = [d["address"] for d in utxo_data] auth_address = self.wallet.pubkey_to_address(auth_pub) if not auth_address in input_addresses: jlog.warn( "ERROR maker's (" + nick + ")" " authorising pubkey is not included " "in the transaction: " + str(auth_address) ) # this will not be added to the transaction, so we will have # to recheck if we have enough continue total_input = sum([d["value"] for d in utxo_data]) real_cjfee = calc_cj_fee( self.orderbook[nick]["ordertype"], self.orderbook[nick]["cjfee"], self.cjamount, ) change_amount = ( total_input - self.cjamount - self.orderbook[nick]["txfee"] + real_cjfee ) # certain malicious and/or incompetent liquidity providers send # inputs totalling less than the coinjoin amount! this leads to # a change output of zero satoshis; this counterparty must be removed. if change_amount < jm_single().DUST_THRESHOLD: fmt = ( "ERROR counterparty requires sub-dust change. nick={}" "totalin={:d} cjamount={:d} change={:d}" ).format jlog.warn(fmt(nick, total_input, self.cjamount, change_amount)) jlog.warn("Invalid change, too small, nick= " + nick) continue self.outputs.append({"address": change_addr, "value": change_amount}) fmt = ( "fee breakdown for {} totalin={:d} cjamount={:d} txfee={:d} realcjfee={:d}" ).format jlog.info( fmt( nick, total_input, self.cjamount, self.orderbook[nick]["txfee"], real_cjfee, ) ) self.outputs.append({"address": cj_addr, "value": self.cjamount}) self.cjfee_total += real_cjfee self.maker_txfee_contributions += self.orderbook[nick]["txfee"] self.maker_utxo_data[nick] = utxo_data # Apply business logic of how many counterparties are enough: if len(self.maker_utxo_data.keys()) < jm_single().config.getint( "POLICY", "minimum_makers" ): self.taker_info_callback("INFO", "Not enough counterparties, aborting.") return (False, "Not enough counterparties responded to fill, giving up") self.taker_info_callback("INFO", "Got all parts, enough to build a tx") self.nonrespondants = list(self.maker_utxo_data.keys()) my_total_in = sum([va["value"] for u, va in self.input_utxos.iteritems()]) if self.my_change_addr: # Estimate fee per choice of next/3/6 blocks targetting. estimated_fee = estimate_tx_fee( len(sum(self.utxos.values(), [])), len(self.outputs) + 2, txtype=self.wallet.get_txtype(), ) jlog.info( "Based on initial guess: " + str(self.total_txfee) + ", we estimated a miner fee of: " + str(estimated_fee) ) # reset total self.total_txfee = estimated_fee my_txfee = max(self.total_txfee - self.maker_txfee_contributions, 0) my_change_value = my_total_in - self.cjamount - self.cjfee_total - my_txfee # Since we could not predict the maker's inputs, we may end up needing # too much such that the change value is negative or small. Note that # we have tried to avoid this based on over-estimating the needed amount # in SendPayment.create_tx(), but it is still a possibility if one maker # uses a *lot* of inputs. if self.my_change_addr and my_change_value <= 0: raise ValueError( "Calculated transaction fee of: " + str(self.total_txfee) + " is too large for our inputs;Please try again." ) elif self.my_change_addr and my_change_value <= jm_single().BITCOIN_DUST_THRESHOLD: jlog.info( "Dynamically calculated change lower than dust: " + str(my_change_value) + "; dropping." ) self.my_change_addr = None my_change_value = 0 jlog.info( "fee breakdown for me totalin=%d my_txfee=%d makers_txfee=%d cjfee_total=%d => changevalue=%d" % ( my_total_in, my_txfee, self.maker_txfee_contributions, self.cjfee_total, my_change_value, ) ) if self.my_change_addr is None: if my_change_value != 0 and abs(my_change_value) != 1: # seems you wont always get exactly zero because of integer # rounding so 1 satoshi extra or fewer being spent as miner # fees is acceptable jlog.info( ("WARNING CHANGE NOT BEING USED\nCHANGEVALUE = {}").format( my_change_value ) ) else: self.outputs.append({"address": self.my_change_addr, "value": my_change_value}) self.utxo_tx = [dict([("output", u)]) for u in sum(self.utxos.values(), [])] self.outputs.append({"address": self.coinjoin_address(), "value": self.cjamount}) random.shuffle(self.utxo_tx) random.shuffle(self.outputs) tx = btc.mktx(self.utxo_tx, self.outputs) jlog.info("obtained tx\n" + pprint.pformat(btc.deserialize(tx))) self.latest_tx = btc.deserialize(tx) for index, ins in enumerate(self.latest_tx["ins"]): utxo = ins["outpoint"]["hash"] + ":" + str(ins["outpoint"]["index"]) if utxo not in self.input_utxos.keys(): continue # placeholders required ins["script"] = "deadbeef" self.taker_info_callback("INFO", "Built tx, sending to counterparties.") return (True, self.maker_utxo_data.keys(), tx)
https://github.com/JoinMarket-Org/joinmarket-clientserver/issues/169
2018-07-21 00:03:59,900 [MainThread ] [INFO ] Makers didnt respond: [u'J57XBPc4Ub5b3xxO', u'J54nByhefebjZFkB'] 2018-07-21 00:21:32,779 [MainThread ] [INFO ] STALL MONITOR: 2018-07-21 00:21:32,779 [MainThread ] [INFO ] Stall detected. Regenerating transactions and retrying. Unhandled Error Traceback (most recent call last): File "sendpayment.py", line 233, in main clientfactory, daemon=daemon) File "/home/alex/Documents/joinmarket-dev/test_ranr-under-max/joinmarket-clientserver/jmvenv/local/lib/python2.7/site-packages/jmclient/client_protocol.py", line 495, in start_reactor reactor.run(installSignalHandlers=ish) File "/home/alex/Documents/joinmarket-dev/test_ranr-under-max/joinmarket-clientserver/jmvenv/local/lib/python2.7/site-packages/twisted/internet/base.py", line 1199, in run self.mainLoop() File "/home/alex/Documents/joinmarket-dev/test_ranr-under-max/joinmarket-clientserver/jmvenv/local/lib/python2.7/site-packages/twisted/internet/base.py", line 1208, in mainLoop self.runUntilCurrent() --- <exception caught here> --- File "/home/alex/Documents/joinmarket-dev/test_ranr-under-max/joinmarket-clientserver/jmvenv/local/lib/python2.7/site-packages/twisted/internet/base.py", line 828, in runUntilCurrent call.func(*call.args, **call.kw) File "/home/alex/Documents/joinmarket-dev/test_ranr-under-max/joinmarket-clientserver/jmvenv/local/lib/python2.7/site-packages/jmclient/client_protocol.py", line 346, in stallMonitor self.client.on_finished_callback(False, True, 0.0) File "sendpayment.py", line 189, in taker_finished "makers didn't respond: ", taker.nonrespondants, exceptions.AttributeError: 'Taker' object has no attribute 'nonrespondants'
exceptions.AttributeError
def tumbler_taker_finished_update( taker, schedulefile, tumble_log, options, res, fromtx=False, waittime=0.0, txdetails=None, ): """on_finished_callback processing for tumbler. Note that this is *not* the full callback, but provides common processing across command line and other GUI versions. """ if fromtx == "unconfirmed": # unconfirmed event means transaction has been propagated, # we update state to prevent accidentally re-creating it in # any crash/restart condition unconf_update(taker, schedulefile, tumble_log, True) return if fromtx: if res: # this has no effect except in the rare case that confirmation # is immediate; also it does not repeat the log entry. unconf_update(taker, schedulefile, tumble_log, False) # note that Qt does not yet support 'addrask', so this is only # for command line script TODO if taker.schedule[taker.schedule_index + 1][3] == "addrask": jm_single().debug_silence[0] = True print("\n".join(["=" * 60] * 3)) print("Tumbler requires more addresses to stop amount correlation") print("Obtain a new destination address from your bitcoin recipient") print(" for example click the button that gives a new deposit address") print("\n".join(["=" * 60] * 1)) while True: destaddr = raw_input("insert new address: ") addr_valid, errormsg = validate_address(destaddr) if addr_valid: break print( "Address " + destaddr + " invalid. " + errormsg + " try again" ) jm_single().debug_silence[0] = False taker.schedule[taker.schedule_index + 1][3] = destaddr taker.tdestaddrs.append(destaddr) waiting_message = "Waiting for: " + str(waittime) + " minutes." tumble_log.info(waiting_message) log.info(waiting_message) txd, txid = txdetails taker.wallet.remove_old_utxos(txd) taker.wallet.add_new_utxos(txd, txid) else: # a transaction failed, either because insufficient makers # (acording to minimum_makers) responded in Phase 1, or not all # makers responded in Phase 2. We'll first try to repeat without the # troublemakers. log.info( "Schedule entry: " + str(taker.schedule[taker.schedule_index]) + " failed after timeout, trying again" ) taker.add_ignored_makers(taker.nonrespondants) # Is the failure in Phase 2? if not taker.latest_tx is None: # Now we have to set the specific group we want to use, and hopefully # they will respond again as they showed honesty last time. # Note that we must wipe the list first; other honest makers needn't # have the right settings (e.g. max cjamount), so can't be carried # over from earlier transactions. taker.honest_makers = [] taker.add_honest_makers( list( set(taker.maker_utxo_data.keys()).symmetric_difference( set(taker.nonrespondants) ) ) ) # If insufficient makers were honest, we can only tweak the schedule. # If enough were, we prefer the restart with them only: log.info( "Inside a Phase 2 failure; number of honest respondants was: " + str(len(taker.honest_makers)) ) log.info("They were: " + str(taker.honest_makers)) if len(taker.honest_makers) >= jm_single().config.getint( "POLICY", "minimum_makers" ): tumble_log.info( "Transaction attempt failed, attempting to restart with subset." ) tumble_log.info("The paramaters of the failed attempt: ") tumble_log.info(str(taker.schedule[taker.schedule_index])) # we must reset the number of counterparties, as well as fix who they # are; this is because the number is used to e.g. calculate fees. # cleanest way is to reset the number in the schedule before restart. taker.schedule[taker.schedule_index][2] = len(taker.honest_makers) retry_str = ( "Retrying with: " + str(taker.schedule[taker.schedule_index][2]) + " counterparties." ) tumble_log.info(retry_str) log.info(retry_str) taker.set_honest_only(True) taker.schedule_index -= 1 return # There were not enough honest counterparties. # Tumbler is aggressive in trying to complete; we tweak the schedule # from this point in the mixdepth, then try again. tumble_log.info( "Transaction attempt failed, tweaking schedule and trying again." ) tumble_log.info("The paramaters of the failed attempt: ") tumble_log.info(str(taker.schedule[taker.schedule_index])) taker.schedule_index -= 1 taker.schedule = tweak_tumble_schedule( options, taker.schedule, taker.schedule_index, taker.tdestaddrs ) tumble_log.info("We tweaked the schedule, the new schedule is:") tumble_log.info(pprint.pformat(taker.schedule)) else: if not res: failure_msg = "Did not complete successfully, shutting down" tumble_log.info(failure_msg) log.info(failure_msg) else: log.info("All transactions completed correctly") tumble_log.info("Completed successfully the last entry:") # Whether sweep or not, the amt is not in satoshis; use taker data hramt = taker.cjamount tumble_log.info( human_readable_schedule_entry( taker.schedule[taker.schedule_index], hramt ) ) # copy of above, TODO refactor out taker.schedule[taker.schedule_index][5] = 1 with open(schedulefile, "wb") as f: f.write(schedule_to_text(taker.schedule))
def tumbler_taker_finished_update( taker, schedulefile, tumble_log, options, res, fromtx=False, waittime=0.0, txdetails=None, ): """on_finished_callback processing for tumbler. Note that this is *not* the full callback, but provides common processing across command line and other GUI versions. """ if fromtx == "unconfirmed": # unconfirmed event means transaction has been propagated, # we update state to prevent accidentally re-creating it in # any crash/restart condition unconf_update(taker, schedulefile, tumble_log, True) return if fromtx: if res: # this has no effect except in the rare case that confirmation # is immediate; also it does not repeat the log entry. unconf_update(taker, schedulefile, tumble_log, False) # note that Qt does not yet support 'addrask', so this is only # for command line script TODO if taker.schedule[taker.schedule_index + 1][3] == "addrask": jm_single().debug_silence[0] = True print("\n".join(["=" * 60] * 3)) print("Tumbler requires more addresses to stop amount correlation") print("Obtain a new destination address from your bitcoin recipient") print(" for example click the button that gives a new deposit address") print("\n".join(["=" * 60] * 1)) while True: destaddr = raw_input("insert new address: ") addr_valid, errormsg = validate_address(destaddr) if addr_valid: break print( "Address " + destaddr + " invalid. " + errormsg + " try again" ) jm_single().debug_silence[0] = False taker.schedule[taker.schedule_index + 1][3] = destaddr taker.tdestaddrs.append(destaddr) waiting_message = "Waiting for: " + str(waittime) + " minutes." tumble_log.info(waiting_message) log.info(waiting_message) txd, txid = txdetails taker.wallet.remove_old_utxos(txd) taker.wallet.add_new_utxos(txd, txid) else: # a transaction failed, either because insufficient makers # (acording to minimum_makers) responded in Stage 1, or not all # makers responded in Stage 2. We'll first try to repeat without the # troublemakers. # Note that Taker.nonrespondants is always set to the full maker # list at the start of Taker.receive_utxos, so it is always updated # to a new list in each tx run. log.info( "Schedule entry: " + str(taker.schedule[taker.schedule_index]) + " failed after timeout, trying again" ) taker.add_ignored_makers(taker.nonrespondants) # Now we have to set the specific group we want to use, and hopefully # they will respond again as they showed honesty last time. taker.add_honest_makers( list( set(taker.maker_utxo_data.keys()).symmetric_difference( set(taker.nonrespondants) ) ) ) # If no makers were honest, we can only tweak the schedule. # If some were, we prefer the restart with them only: if len(taker.honest_makers) != 0: tumble_log.info( "Transaction attempt failed, attempting to restart with subset." ) tumble_log.info("The paramaters of the failed attempt: ") tumble_log.info(str(taker.schedule[taker.schedule_index])) # we must reset the number of counterparties, as well as fix who they # are; this is because the number is used to e.g. calculate fees. # cleanest way is to reset the number in the schedule before restart. taker.schedule[taker.schedule_index][2] = len(taker.honest_makers) retry_str = ( "Retrying with: " + str(taker.schedule[taker.schedule_index][2]) + " counterparties." ) tumble_log.info(retry_str) log.info(retry_str) taker.set_honest_only(True) taker.schedule_index -= 1 # a tumbler is aggressive in trying to complete; we tweak the schedule # from this point in the mixdepth, then try again. However we only # try this strategy if the previous (select-honest-only) strategy # failed. else: tumble_log.info( "Transaction attempt failed, tweaking schedule and trying again." ) tumble_log.info("The paramaters of the failed attempt: ") tumble_log.info(str(taker.schedule[taker.schedule_index])) taker.schedule_index -= 1 taker.schedule = tweak_tumble_schedule( options, taker.schedule, taker.schedule_index, taker.tdestaddrs ) tumble_log.info("We tweaked the schedule, the new schedule is:") tumble_log.info(pprint.pformat(taker.schedule)) else: if not res: failure_msg = "Did not complete successfully, shutting down" tumble_log.info(failure_msg) log.info(failure_msg) else: log.info("All transactions completed correctly") tumble_log.info("Completed successfully the last entry:") # Whether sweep or not, the amt is not in satoshis; use taker data hramt = taker.cjamount tumble_log.info( human_readable_schedule_entry( taker.schedule[taker.schedule_index], hramt ) ) # copy of above, TODO refactor out taker.schedule[taker.schedule_index][5] = 1 with open(schedulefile, "wb") as f: f.write(schedule_to_text(taker.schedule))
https://github.com/JoinMarket-Org/joinmarket-clientserver/issues/169
2018-07-21 00:03:59,900 [MainThread ] [INFO ] Makers didnt respond: [u'J57XBPc4Ub5b3xxO', u'J54nByhefebjZFkB'] 2018-07-21 00:21:32,779 [MainThread ] [INFO ] STALL MONITOR: 2018-07-21 00:21:32,779 [MainThread ] [INFO ] Stall detected. Regenerating transactions and retrying. Unhandled Error Traceback (most recent call last): File "sendpayment.py", line 233, in main clientfactory, daemon=daemon) File "/home/alex/Documents/joinmarket-dev/test_ranr-under-max/joinmarket-clientserver/jmvenv/local/lib/python2.7/site-packages/jmclient/client_protocol.py", line 495, in start_reactor reactor.run(installSignalHandlers=ish) File "/home/alex/Documents/joinmarket-dev/test_ranr-under-max/joinmarket-clientserver/jmvenv/local/lib/python2.7/site-packages/twisted/internet/base.py", line 1199, in run self.mainLoop() File "/home/alex/Documents/joinmarket-dev/test_ranr-under-max/joinmarket-clientserver/jmvenv/local/lib/python2.7/site-packages/twisted/internet/base.py", line 1208, in mainLoop self.runUntilCurrent() --- <exception caught here> --- File "/home/alex/Documents/joinmarket-dev/test_ranr-under-max/joinmarket-clientserver/jmvenv/local/lib/python2.7/site-packages/twisted/internet/base.py", line 828, in runUntilCurrent call.func(*call.args, **call.kw) File "/home/alex/Documents/joinmarket-dev/test_ranr-under-max/joinmarket-clientserver/jmvenv/local/lib/python2.7/site-packages/jmclient/client_protocol.py", line 346, in stallMonitor self.client.on_finished_callback(False, True, 0.0) File "sendpayment.py", line 189, in taker_finished "makers didn't respond: ", taker.nonrespondants, exceptions.AttributeError: 'Taker' object has no attribute 'nonrespondants'
exceptions.AttributeError
def main(): parser = get_sendpayment_parser() (options, args) = parser.parse_args() load_program_config() if options.schedule == "" and len(args) < 3: parser.error("Needs a wallet, amount and destination address") sys.exit(0) # without schedule file option, use the arguments to create a schedule # of a single transaction sweeping = False if options.schedule == "": # note that sendpayment doesn't support fractional amounts, fractions throw # here. amount = int(args[1]) if amount == 0: sweeping = True destaddr = args[2] mixdepth = options.mixdepth addr_valid, errormsg = validate_address(destaddr) if not addr_valid: print("ERROR: Address invalid. " + errormsg) return schedule = [[options.mixdepth, amount, options.makercount, destaddr, 0.0, 0]] else: result, schedule = get_schedule(options.schedule) if not result: log.info("Failed to load schedule file, quitting. Check the syntax.") log.info("Error was: " + str(schedule)) sys.exit(0) mixdepth = 0 for s in schedule: if s[1] == 0: sweeping = True # only used for checking the maximum mixdepth required mixdepth = max([mixdepth, s[0]]) wallet_name = args[0] # to allow testing of confirm/unconfirm callback for multiple txs if isinstance(jm_single().bc_interface, RegtestBitcoinCoreInterface): jm_single().bc_interface.tick_forward_chain_interval = 10 jm_single().bc_interface.simulating = True jm_single().maker_timeout_sec = 15 chooseOrdersFunc = None if options.pickorders: chooseOrdersFunc = pick_order if sweeping: print("WARNING: You may have to pick offers multiple times") print("WARNING: due to manual offer picking while sweeping") elif options.choosecheapest: chooseOrdersFunc = cheapest_order_choose else: # choose randomly (weighted) chooseOrdersFunc = weighted_order_choose # Dynamically estimate a realistic fee if it currently is the default value. # At this point we do not know even the number of our own inputs, so # we guess conservatively with 2 inputs and 2 outputs each. if options.txfee == -1: options.txfee = max(options.txfee, estimate_tx_fee(2, 2, txtype="p2sh-p2wpkh")) log.debug( "Estimated miner/tx fee for each cj participant: " + str(options.txfee) ) assert options.txfee >= 0 log.debug("starting sendpayment") if not options.userpcwallet: # maxmixdepth in the wallet is actually the *number* of mixdepths (so misnamed); # to ensure we have enough, must be at least (requested index+1) max_mix_depth = max([mixdepth + 1, options.amtmixdepths]) if not os.path.exists(os.path.join("wallets", wallet_name)): wallet = get_wallet_cls()( wallet_name, None, max_mix_depth, options.gaplimit ) else: while True: try: pwd = get_password("Enter wallet decryption passphrase: ") wallet = get_wallet_cls()( wallet_name, pwd, max_mix_depth, options.gaplimit ) except WalletError: print("Wrong password, try again.") continue except Exception as e: print("Failed to load wallet, error message: " + repr(e)) sys.exit(0) break else: wallet = BitcoinCoreWallet(fromaccount=wallet_name) if ( jm_single().config.get("BLOCKCHAIN", "blockchain_source") == "electrum-server" and options.makercount != 0 ): jm_single().bc_interface.synctype = "with-script" # wallet sync will now only occur on reactor start if we're joining. sync_wallet(wallet, fast=options.fastsync) if options.makercount == 0: if isinstance(wallet, BitcoinCoreWallet): raise NotImplementedError("Direct send only supported for JM wallets") direct_send(wallet, amount, mixdepth, destaddr, options.answeryes) return def filter_orders_callback(orders_fees, cjamount): orders, total_cj_fee = orders_fees log.info("Chose these orders: " + pprint.pformat(orders)) log.info("total cj fee = " + str(total_cj_fee)) total_fee_pc = 1.0 * total_cj_fee / cjamount log.info( "total coinjoin fee = " + str(float("%.3g" % (100.0 * total_fee_pc))) + "%" ) WARNING_THRESHOLD = 0.02 # 2% if total_fee_pc > WARNING_THRESHOLD: log.info("\n".join(["=" * 60] * 3)) log.info("WARNING " * 6) log.info("\n".join(["=" * 60] * 1)) log.info("OFFERED COINJOIN FEE IS UNUSUALLY HIGH. DOUBLE/TRIPLE CHECK.") log.info("\n".join(["=" * 60] * 1)) log.info("WARNING " * 6) log.info("\n".join(["=" * 60] * 3)) if not options.answeryes: if raw_input("send with these orders? (y/n):")[0] != "y": return False return True def taker_finished(res, fromtx=False, waittime=0.0, txdetails=None): if fromtx == "unconfirmed": # If final entry, stop *here*, don't wait for confirmation if taker.schedule_index + 1 == len(taker.schedule): reactor.stop() return if fromtx: if res: txd, txid = txdetails taker.wallet.remove_old_utxos(txd) taker.wallet.add_new_utxos(txd, txid) reactor.callLater(waittime * 60, clientfactory.getClient().clientStart) else: # a transaction failed; we'll try to repeat without the # troublemakers. # If this error condition is reached from Phase 1 processing, # and there are less than minimum_makers honest responses, we # just give up (note that in tumbler we tweak and retry, but # for sendpayment the user is "online" and so can manually # try again). # However if the error is in Phase 2 and we have minimum_makers # or more responses, we do try to restart with the honest set, here. if taker.latest_tx is None: # can only happen with < minimum_makers; see above. log.info( "A transaction failed but there are insufficient " "honest respondants to continue; giving up." ) reactor.stop() return # This is Phase 2; do we have enough to try again? taker.add_honest_makers( list( set(taker.maker_utxo_data.keys()).symmetric_difference( set(taker.nonrespondants) ) ) ) if len(taker.honest_makers) < jm_single().config.getint( "POLICY", "minimum_makers" ): log.info( "Too few makers responded honestly; giving up this attempt." ) reactor.stop() return print( "We failed to complete the transaction. The following " "makers responded honestly: ", taker.honest_makers, ", so we will retry with them.", ) # Now we have to set the specific group we want to use, and hopefully # they will respond again as they showed honesty last time. # we must reset the number of counterparties, as well as fix who they # are; this is because the number is used to e.g. calculate fees. # cleanest way is to reset the number in the schedule before restart. taker.schedule[taker.schedule_index][2] = len(taker.honest_makers) log.info( "Retrying with: " + str(taker.schedule[taker.schedule_index][2]) + " counterparties." ) # rewind to try again (index is incremented in Taker.initialize()) taker.schedule_index -= 1 taker.set_honest_only(True) reactor.callLater(5.0, clientfactory.getClient().clientStart) else: if not res: log.info("Did not complete successfully, shutting down") # Should usually be unreachable, unless conf received out of order; # because we should stop on 'unconfirmed' for last (see above) else: log.info("All transactions completed correctly") reactor.stop() taker = Taker( wallet, schedule, order_chooser=chooseOrdersFunc, callbacks=(filter_orders_callback, None, taker_finished), ) clientfactory = JMClientProtocolFactory(taker) nodaemon = jm_single().config.getint("DAEMON", "no_daemon") daemon = True if nodaemon == 1 else False if jm_single().config.get("BLOCKCHAIN", "network") in ["regtest", "testnet"]: startLogging(sys.stdout) start_reactor( jm_single().config.get("DAEMON", "daemon_host"), jm_single().config.getint("DAEMON", "daemon_port"), clientfactory, daemon=daemon, )
def main(): parser = get_sendpayment_parser() (options, args) = parser.parse_args() load_program_config() if options.schedule == "" and len(args) < 3: parser.error("Needs a wallet, amount and destination address") sys.exit(0) # without schedule file option, use the arguments to create a schedule # of a single transaction sweeping = False if options.schedule == "": # note that sendpayment doesn't support fractional amounts, fractions throw # here. amount = int(args[1]) if amount == 0: sweeping = True destaddr = args[2] mixdepth = options.mixdepth addr_valid, errormsg = validate_address(destaddr) if not addr_valid: print("ERROR: Address invalid. " + errormsg) return schedule = [[options.mixdepth, amount, options.makercount, destaddr, 0.0, 0]] else: result, schedule = get_schedule(options.schedule) if not result: log.info("Failed to load schedule file, quitting. Check the syntax.") log.info("Error was: " + str(schedule)) sys.exit(0) mixdepth = 0 for s in schedule: if s[1] == 0: sweeping = True # only used for checking the maximum mixdepth required mixdepth = max([mixdepth, s[0]]) wallet_name = args[0] # to allow testing of confirm/unconfirm callback for multiple txs if isinstance(jm_single().bc_interface, RegtestBitcoinCoreInterface): jm_single().bc_interface.tick_forward_chain_interval = 10 jm_single().bc_interface.simulating = True jm_single().maker_timeout_sec = 15 chooseOrdersFunc = None if options.pickorders: chooseOrdersFunc = pick_order if sweeping: print("WARNING: You may have to pick offers multiple times") print("WARNING: due to manual offer picking while sweeping") elif options.choosecheapest: chooseOrdersFunc = cheapest_order_choose else: # choose randomly (weighted) chooseOrdersFunc = weighted_order_choose # Dynamically estimate a realistic fee if it currently is the default value. # At this point we do not know even the number of our own inputs, so # we guess conservatively with 2 inputs and 2 outputs each. if options.txfee == -1: options.txfee = max(options.txfee, estimate_tx_fee(2, 2, txtype="p2sh-p2wpkh")) log.debug( "Estimated miner/tx fee for each cj participant: " + str(options.txfee) ) assert options.txfee >= 0 log.debug("starting sendpayment") if not options.userpcwallet: # maxmixdepth in the wallet is actually the *number* of mixdepths (so misnamed); # to ensure we have enough, must be at least (requested index+1) max_mix_depth = max([mixdepth + 1, options.amtmixdepths]) if not os.path.exists(os.path.join("wallets", wallet_name)): wallet = get_wallet_cls()( wallet_name, None, max_mix_depth, options.gaplimit ) else: while True: try: pwd = get_password("Enter wallet decryption passphrase: ") wallet = get_wallet_cls()( wallet_name, pwd, max_mix_depth, options.gaplimit ) except WalletError: print("Wrong password, try again.") continue except Exception as e: print("Failed to load wallet, error message: " + repr(e)) sys.exit(0) break else: wallet = BitcoinCoreWallet(fromaccount=wallet_name) if ( jm_single().config.get("BLOCKCHAIN", "blockchain_source") == "electrum-server" and options.makercount != 0 ): jm_single().bc_interface.synctype = "with-script" # wallet sync will now only occur on reactor start if we're joining. sync_wallet(wallet, fast=options.fastsync) if options.makercount == 0: if isinstance(wallet, BitcoinCoreWallet): raise NotImplementedError("Direct send only supported for JM wallets") direct_send(wallet, amount, mixdepth, destaddr, options.answeryes) return def filter_orders_callback(orders_fees, cjamount): orders, total_cj_fee = orders_fees log.info("Chose these orders: " + pprint.pformat(orders)) log.info("total cj fee = " + str(total_cj_fee)) total_fee_pc = 1.0 * total_cj_fee / cjamount log.info( "total coinjoin fee = " + str(float("%.3g" % (100.0 * total_fee_pc))) + "%" ) WARNING_THRESHOLD = 0.02 # 2% if total_fee_pc > WARNING_THRESHOLD: log.info("\n".join(["=" * 60] * 3)) log.info("WARNING " * 6) log.info("\n".join(["=" * 60] * 1)) log.info("OFFERED COINJOIN FEE IS UNUSUALLY HIGH. DOUBLE/TRIPLE CHECK.") log.info("\n".join(["=" * 60] * 1)) log.info("WARNING " * 6) log.info("\n".join(["=" * 60] * 3)) if not options.answeryes: if raw_input("send with these orders? (y/n):")[0] != "y": return False return True def taker_finished(res, fromtx=False, waittime=0.0, txdetails=None): if fromtx == "unconfirmed": # If final entry, stop *here*, don't wait for confirmation if taker.schedule_index + 1 == len(taker.schedule): reactor.stop() return if fromtx: if res: txd, txid = txdetails taker.wallet.remove_old_utxos(txd) taker.wallet.add_new_utxos(txd, txid) reactor.callLater(waittime * 60, clientfactory.getClient().clientStart) else: # a transaction failed; we'll try to repeat without the # troublemakers # Note that Taker.nonrespondants is always set to the full maker # list at the start of Taker.receive_utxos, so it is always updated # to a new list in each run. print( "We failed to complete the transaction. The following " "makers didn't respond: ", taker.nonrespondants, ", so we will retry without them.", ) taker.add_ignored_makers(taker.nonrespondants) # Now we have to set the specific group we want to use, and hopefully # they will respond again as they showed honesty last time. taker.add_honest_makers( list( set(taker.maker_utxo_data.keys()).symmetric_difference( set(taker.nonrespondants) ) ) ) if len(taker.honest_makers) == 0: log.info( "None of the makers responded honestly; giving up this attempt." ) reactor.stop() return # we must reset the number of counterparties, as well as fix who they # are; this is because the number is used to e.g. calculate fees. # cleanest way is to reset the number in the schedule before restart. taker.schedule[taker.schedule_index][2] = len(taker.honest_makers) log.info( "Retrying with: " + str(taker.schedule[taker.schedule_index][2]) + " counterparties." ) # rewind to try again (index is incremented in Taker.initialize()) taker.schedule_index -= 1 taker.set_honest_only(True) reactor.callLater(5.0, clientfactory.getClient().clientStart) else: if not res: log.info("Did not complete successfully, shutting down") # Should usually be unreachable, unless conf received out of order; # because we should stop on 'unconfirmed' for last (see above) else: log.info("All transactions completed correctly") reactor.stop() taker = Taker( wallet, schedule, order_chooser=chooseOrdersFunc, callbacks=(filter_orders_callback, None, taker_finished), ) clientfactory = JMClientProtocolFactory(taker) nodaemon = jm_single().config.getint("DAEMON", "no_daemon") daemon = True if nodaemon == 1 else False if jm_single().config.get("BLOCKCHAIN", "network") in ["regtest", "testnet"]: startLogging(sys.stdout) start_reactor( jm_single().config.get("DAEMON", "daemon_host"), jm_single().config.getint("DAEMON", "daemon_port"), clientfactory, daemon=daemon, )
https://github.com/JoinMarket-Org/joinmarket-clientserver/issues/169
2018-07-21 00:03:59,900 [MainThread ] [INFO ] Makers didnt respond: [u'J57XBPc4Ub5b3xxO', u'J54nByhefebjZFkB'] 2018-07-21 00:21:32,779 [MainThread ] [INFO ] STALL MONITOR: 2018-07-21 00:21:32,779 [MainThread ] [INFO ] Stall detected. Regenerating transactions and retrying. Unhandled Error Traceback (most recent call last): File "sendpayment.py", line 233, in main clientfactory, daemon=daemon) File "/home/alex/Documents/joinmarket-dev/test_ranr-under-max/joinmarket-clientserver/jmvenv/local/lib/python2.7/site-packages/jmclient/client_protocol.py", line 495, in start_reactor reactor.run(installSignalHandlers=ish) File "/home/alex/Documents/joinmarket-dev/test_ranr-under-max/joinmarket-clientserver/jmvenv/local/lib/python2.7/site-packages/twisted/internet/base.py", line 1199, in run self.mainLoop() File "/home/alex/Documents/joinmarket-dev/test_ranr-under-max/joinmarket-clientserver/jmvenv/local/lib/python2.7/site-packages/twisted/internet/base.py", line 1208, in mainLoop self.runUntilCurrent() --- <exception caught here> --- File "/home/alex/Documents/joinmarket-dev/test_ranr-under-max/joinmarket-clientserver/jmvenv/local/lib/python2.7/site-packages/twisted/internet/base.py", line 828, in runUntilCurrent call.func(*call.args, **call.kw) File "/home/alex/Documents/joinmarket-dev/test_ranr-under-max/joinmarket-clientserver/jmvenv/local/lib/python2.7/site-packages/jmclient/client_protocol.py", line 346, in stallMonitor self.client.on_finished_callback(False, True, 0.0) File "sendpayment.py", line 189, in taker_finished "makers didn't respond: ", taker.nonrespondants, exceptions.AttributeError: 'Taker' object has no attribute 'nonrespondants'
exceptions.AttributeError
def taker_finished(res, fromtx=False, waittime=0.0, txdetails=None): if fromtx == "unconfirmed": # If final entry, stop *here*, don't wait for confirmation if taker.schedule_index + 1 == len(taker.schedule): reactor.stop() return if fromtx: if res: txd, txid = txdetails taker.wallet.remove_old_utxos(txd) taker.wallet.add_new_utxos(txd, txid) reactor.callLater(waittime * 60, clientfactory.getClient().clientStart) else: # a transaction failed; we'll try to repeat without the # troublemakers. # If this error condition is reached from Phase 1 processing, # and there are less than minimum_makers honest responses, we # just give up (note that in tumbler we tweak and retry, but # for sendpayment the user is "online" and so can manually # try again). # However if the error is in Phase 2 and we have minimum_makers # or more responses, we do try to restart with the honest set, here. if taker.latest_tx is None: # can only happen with < minimum_makers; see above. log.info( "A transaction failed but there are insufficient " "honest respondants to continue; giving up." ) reactor.stop() return # This is Phase 2; do we have enough to try again? taker.add_honest_makers( list( set(taker.maker_utxo_data.keys()).symmetric_difference( set(taker.nonrespondants) ) ) ) if len(taker.honest_makers) < jm_single().config.getint( "POLICY", "minimum_makers" ): log.info("Too few makers responded honestly; giving up this attempt.") reactor.stop() return print( "We failed to complete the transaction. The following " "makers responded honestly: ", taker.honest_makers, ", so we will retry with them.", ) # Now we have to set the specific group we want to use, and hopefully # they will respond again as they showed honesty last time. # we must reset the number of counterparties, as well as fix who they # are; this is because the number is used to e.g. calculate fees. # cleanest way is to reset the number in the schedule before restart. taker.schedule[taker.schedule_index][2] = len(taker.honest_makers) log.info( "Retrying with: " + str(taker.schedule[taker.schedule_index][2]) + " counterparties." ) # rewind to try again (index is incremented in Taker.initialize()) taker.schedule_index -= 1 taker.set_honest_only(True) reactor.callLater(5.0, clientfactory.getClient().clientStart) else: if not res: log.info("Did not complete successfully, shutting down") # Should usually be unreachable, unless conf received out of order; # because we should stop on 'unconfirmed' for last (see above) else: log.info("All transactions completed correctly") reactor.stop()
def taker_finished(res, fromtx=False, waittime=0.0, txdetails=None): if fromtx == "unconfirmed": # If final entry, stop *here*, don't wait for confirmation if taker.schedule_index + 1 == len(taker.schedule): reactor.stop() return if fromtx: if res: txd, txid = txdetails taker.wallet.remove_old_utxos(txd) taker.wallet.add_new_utxos(txd, txid) reactor.callLater(waittime * 60, clientfactory.getClient().clientStart) else: # a transaction failed; we'll try to repeat without the # troublemakers # Note that Taker.nonrespondants is always set to the full maker # list at the start of Taker.receive_utxos, so it is always updated # to a new list in each run. print( "We failed to complete the transaction. The following " "makers didn't respond: ", taker.nonrespondants, ", so we will retry without them.", ) taker.add_ignored_makers(taker.nonrespondants) # Now we have to set the specific group we want to use, and hopefully # they will respond again as they showed honesty last time. taker.add_honest_makers( list( set(taker.maker_utxo_data.keys()).symmetric_difference( set(taker.nonrespondants) ) ) ) if len(taker.honest_makers) == 0: log.info( "None of the makers responded honestly; giving up this attempt." ) reactor.stop() return # we must reset the number of counterparties, as well as fix who they # are; this is because the number is used to e.g. calculate fees. # cleanest way is to reset the number in the schedule before restart. taker.schedule[taker.schedule_index][2] = len(taker.honest_makers) log.info( "Retrying with: " + str(taker.schedule[taker.schedule_index][2]) + " counterparties." ) # rewind to try again (index is incremented in Taker.initialize()) taker.schedule_index -= 1 taker.set_honest_only(True) reactor.callLater(5.0, clientfactory.getClient().clientStart) else: if not res: log.info("Did not complete successfully, shutting down") # Should usually be unreachable, unless conf received out of order; # because we should stop on 'unconfirmed' for last (see above) else: log.info("All transactions completed correctly") reactor.stop()
https://github.com/JoinMarket-Org/joinmarket-clientserver/issues/169
2018-07-21 00:03:59,900 [MainThread ] [INFO ] Makers didnt respond: [u'J57XBPc4Ub5b3xxO', u'J54nByhefebjZFkB'] 2018-07-21 00:21:32,779 [MainThread ] [INFO ] STALL MONITOR: 2018-07-21 00:21:32,779 [MainThread ] [INFO ] Stall detected. Regenerating transactions and retrying. Unhandled Error Traceback (most recent call last): File "sendpayment.py", line 233, in main clientfactory, daemon=daemon) File "/home/alex/Documents/joinmarket-dev/test_ranr-under-max/joinmarket-clientserver/jmvenv/local/lib/python2.7/site-packages/jmclient/client_protocol.py", line 495, in start_reactor reactor.run(installSignalHandlers=ish) File "/home/alex/Documents/joinmarket-dev/test_ranr-under-max/joinmarket-clientserver/jmvenv/local/lib/python2.7/site-packages/twisted/internet/base.py", line 1199, in run self.mainLoop() File "/home/alex/Documents/joinmarket-dev/test_ranr-under-max/joinmarket-clientserver/jmvenv/local/lib/python2.7/site-packages/twisted/internet/base.py", line 1208, in mainLoop self.runUntilCurrent() --- <exception caught here> --- File "/home/alex/Documents/joinmarket-dev/test_ranr-under-max/joinmarket-clientserver/jmvenv/local/lib/python2.7/site-packages/twisted/internet/base.py", line 828, in runUntilCurrent call.func(*call.args, **call.kw) File "/home/alex/Documents/joinmarket-dev/test_ranr-under-max/joinmarket-clientserver/jmvenv/local/lib/python2.7/site-packages/jmclient/client_protocol.py", line 346, in stallMonitor self.client.on_finished_callback(False, True, 0.0) File "sendpayment.py", line 189, in taker_finished "makers didn't respond: ", taker.nonrespondants, exceptions.AttributeError: 'Taker' object has no attribute 'nonrespondants'
exceptions.AttributeError
def __getattr__(self, item): """This method is called only when the attribute does not exits usually on access to the direct `Settings` object instead of the `LazySettings`. All first level attributes are stored as UPPERCASE, so self.FOO will always be accessible, however in some cases `self.foo` might be acessible. This method routes this access to the underlying `_store` which handles casing and recursive access. """ try: if ( item.islower() and self._store.get("LOWERCASE_READ_FOR_DYNACONF", empty) is False ): raise KeyError value = self._store[item] except KeyError: raise AttributeError(f"Settings has no attribute '{item}'") else: return value
def __getattr__(self, name): """Allow getting keys from self.store using dot notation""" if self._wrapped is empty: self._setup() if name in self._wrapped._deleted: # noqa raise AttributeError( f"Attribute {name} was deleted, or belongs to different env" ) if name not in RESERVED_ATTRS: lowercase_mode = self._kwargs.get( "LOWERCASE_READ_FOR_DYNACONF", default_settings.LOWERCASE_READ_FOR_DYNACONF, ) if lowercase_mode is True: name = name.upper() if ( name.isupper() and (self._wrapped._fresh or name in self._wrapped.FRESH_VARS_FOR_DYNACONF) and name not in dir(default_settings) ): return self._wrapped.get_fresh(name) value = getattr(self._wrapped, name) if name not in RESERVED_ATTRS: return recursively_evaluate_lazy_format(value, self) return value
https://github.com/rochacbruno/dynaconf/issues/482
Traceback (most recent call last): File "app.py", line 11, in <module> assert settings['s3_url'] == expected_value # fails File "/home/user/dev/venv/lib/python3.7/site-packages/dynaconf/utils/functional.py", line 17, in inner return func(self._wrapped, *args) File "/home/user/dev/venv/lib/python3.7/site-packages/dynaconf/base.py", line 285, in __getitem__ value = self.get(item, default=empty) File "/home/user/dev/venv/lib/python3.7/site-packages/dynaconf/base.py", line 419, in get data = (parent or self.store).get(key, default) File "/home/user/dev/venv/lib/python3.7/site-packages/dynaconf/utils/boxing.py", line 15, in evaluate value = f(dynabox, item, *args, **kwargs) File "/home/user/dev/venv/lib/python3.7/site-packages/dynaconf/utils/boxing.py", line 64, in get return super(DynaBox, self).get(item, default, *args, **kwargs) File "/home/user/dev/venv/lib/python3.7/site-packages/dynaconf/vendor/box/box.py", line 109, in get return B[C] File "/home/user/dev/venv/lib/python3.7/site-packages/dynaconf/utils/boxing.py", line 23, in evaluate return recursively_evaluate_lazy_format(value, settings) File "/home/user/dev/venv/lib/python3.7/site-packages/dynaconf/utils/__init__.py", line 355, in recursively_evaluate_lazy_format value = value(settings) File "/home/user/dev/venv/lib/python3.7/site-packages/dynaconf/utils/parse_conf.py", line 176, in __call__ return self.formatter(self.value, **self.context) File "/home/user/dev/venv/lib/python3.7/site-packages/dynaconf/utils/parse_conf.py", line 138, in __call__ return self.function(value, **context) AttributeError: 'Settings' object has no attribute 's3_protocol'
AttributeError
def get(self, item, default=None, *args, **kwargs): if item not in self: # toggle case item = item.lower() if item.isupper() else upperfy(item) value = super(DynaBox, self).get(item, empty, *args, **kwargs) if value is empty: # see Issue: #486 return self._case_insensitive_get(item, default) return value
def get(self, item, default=None, *args, **kwargs): if item not in self: # toggle case item = item.lower() if item.isupper() else upperfy(item) return super(DynaBox, self).get(item, default, *args, **kwargs)
https://github.com/rochacbruno/dynaconf/issues/486
Host: localhost Name: Jane Doe Traceback (most recent call last): File "/Users/rene/Downloads/Validation/test.py", line 13, in <module> settings.validators.validate() File "/Users/rene/.pyenv/versions/3.9.0/lib/python3.9/site-packages/dynaconf/validator.py", line 318, in validate validator.validate(self.settings) File "/Users/rene/.pyenv/versions/3.9.0/lib/python3.9/site-packages/dynaconf/validator.py", line 172, in validate self._validate_items(settings, settings.current_env) File "/Users/rene/.pyenv/versions/3.9.0/lib/python3.9/site-packages/dynaconf/validator.py", line 194, in _validate_items raise ValidationError( dynaconf.validator.ValidationError: Operator.Name is required in env main
dynaconf.validator.ValidationError
def load_file(self, path=None, env=None, silent=True, key=None): """Programmatically load files from ``path``. :param path: A single filename or a file list :param env: Which env to load from file (default current_env) :param silent: Should raise errors? :param key: Load a single key? """ env = (env or self.current_env).upper() files = ensure_a_list(path) if files: already_loaded = set() for _filename in files: if py_loader.try_to_load_from_py_module_name( obj=self, name=_filename, silent=True ): # if it was possible to load from module name # continue the loop. continue # python 3.6 does not resolve Pathlib basedirs # issue #494 root_dir = str(self._root_path or os.getcwd()) if ( isinstance(_filename, Path) and str(_filename.parent) in root_dir ): # pragma: no cover filepath = str(_filename) else: filepath = os.path.join(self._root_path or os.getcwd(), str(_filename)) paths = [p for p in sorted(glob.glob(filepath)) if ".local." not in p] local_paths = [p for p in sorted(glob.glob(filepath)) if ".local." in p] # Handle possible *.globs sorted alphanumeric for path in paths + local_paths: if path in already_loaded: # pragma: no cover continue settings_loader( obj=self, env=env, silent=silent, key=key, filename=path, ) already_loaded.add(path)
def load_file(self, path=None, env=None, silent=True, key=None): """Programmatically load files from ``path``. :param path: A single filename or a file list :param env: Which env to load from file (default current_env) :param silent: Should raise errors? :param key: Load a single key? """ env = (env or self.current_env).upper() files = ensure_a_list(path) if files: already_loaded = set() for _filename in files: if py_loader.try_to_load_from_py_module_name( obj=self, name=_filename, silent=True ): # if it was possible to load from module name # continue the loop. continue filepath = os.path.join(self._root_path or os.getcwd(), _filename) paths = [p for p in sorted(glob.glob(filepath)) if ".local." not in p] local_paths = [p for p in sorted(glob.glob(filepath)) if ".local." in p] # Handle possible *.globs sorted alphanumeric for path in paths + local_paths: if path in already_loaded: # pragma: no cover continue settings_loader( obj=self, env=env, silent=silent, key=key, filename=path, ) already_loaded.add(path)
https://github.com/rochacbruno/dynaconf/issues/494
Traceback (most recent call last): File "/home/kevin/.virtualenvs/pythonic-project-samples-Yf6zzgRF/lib/python3.7/site-packages/dynaconf/loaders/py_loader.py", line 61, in try_to_load_from_py_module_name mod = importlib.import_module(name) File "/usr/lib/python3.7/importlib/__init__.py", line 118, in import_module if name.startswith('.'): AttributeError: 'PosixPath' object has no attribute 'startswith'
AttributeError
def try_to_load_from_py_module_name(obj, name, key=None, identifier="py", silent=False): """Try to load module by its string name. Arguments: obj {LAzySettings} -- Dynaconf settings instance name {str} -- Name of the module e.g: foo.bar.zaz Keyword Arguments: key {str} -- Single key to be loaded (default: {None}) identifier {str} -- Name of identifier to store (default: 'py') silent {bool} -- Weather to raise or silence exceptions. """ ctx = suppress(ImportError, TypeError) if silent else suppress() with ctx: mod = importlib.import_module(str(name)) load_from_python_object(obj, mod, name, key, identifier) return True # loaded ok! # if it reaches this point that means exception occurred, module not found. return False
def try_to_load_from_py_module_name(obj, name, key=None, identifier="py", silent=False): """Try to load module by its string name. Arguments: obj {LAzySettings} -- Dynaconf settings instance name {str} -- Name of the module e.g: foo.bar.zaz Keyword Arguments: key {str} -- Single key to be loaded (default: {None}) identifier {str} -- Name of identifier to store (default: 'py') silent {bool} -- Weather to raise or silence exceptions. """ ctx = suppress(ImportError, TypeError) if silent else suppress() with ctx: mod = importlib.import_module(name) load_from_python_object(obj, mod, name, key, identifier) return True # loaded ok! # if it reaches this point that means exception occurred, module not found. return False
https://github.com/rochacbruno/dynaconf/issues/494
Traceback (most recent call last): File "/home/kevin/.virtualenvs/pythonic-project-samples-Yf6zzgRF/lib/python3.7/site-packages/dynaconf/loaders/py_loader.py", line 61, in try_to_load_from_py_module_name mod = importlib.import_module(name) File "/usr/lib/python3.7/importlib/__init__.py", line 118, in import_module if name.startswith('.'): AttributeError: 'PosixPath' object has no attribute 'startswith'
AttributeError
def __getitem__(self, key): try: return self._settings[key] except KeyError: return Config.__getitem__(self, key)
def __getitem__(self, key): """ Flask templates always expects a None when key is not found in config """ return self.get(key)
https://github.com/rochacbruno/dynaconf/issues/521
False Traceback (most recent call last): File "dc_poc/1_no_dynaconf.py", line 6, in <module> print(app.config["NON_EXISTING"]) KeyError: 'NON_EXISTING'
KeyError
def __getattr__(self, name): """ First try to get value from dynaconf then from Flask Config """ try: return getattr(self._settings, name) except AttributeError: return self[name]
def __getattr__(self, name): """ First try to get value from dynaconf then from Flask """ try: return getattr(self._settings, name) except AttributeError: return self[name]
https://github.com/rochacbruno/dynaconf/issues/521
False Traceback (most recent call last): File "dc_poc/1_no_dynaconf.py", line 6, in <module> print(app.config["NON_EXISTING"]) KeyError: 'NON_EXISTING'
KeyError
def __new__( cls, *args: Any, box_settings: Any = None, default_box: bool = False, default_box_attr: Any = NO_DEFAULT, default_box_none_transform: bool = True, frozen_box: bool = False, camel_killer_box: bool = False, conversion_box: bool = True, modify_tuples_box: bool = False, box_safe_prefix: str = "x", box_duplicates: str = "ignore", box_intact_types: Union[Tuple, List] = (), box_recast: Dict = None, box_dots: bool = False, **kwargs: Any, ): """ Due to the way pickling works in python 3, we need to make sure the box config is created as early as possible. """ obj = super(Box, cls).__new__(cls, *args, **kwargs) obj._box_config = _get_box_config() obj._box_config.update( { "default_box": default_box, "default_box_attr": cls.__class__ if default_box_attr is NO_DEFAULT else default_box_attr, "default_box_none_transform": default_box_none_transform, "conversion_box": conversion_box, "box_safe_prefix": box_safe_prefix, "frozen_box": frozen_box, "camel_killer_box": camel_killer_box, "modify_tuples_box": modify_tuples_box, "box_duplicates": box_duplicates, "box_intact_types": tuple(box_intact_types), "box_recast": box_recast, "box_dots": box_dots, "box_settings": box_settings or {}, } ) return obj
def __new__( cls, *args: Any, box_settings: Any, default_box: bool = False, default_box_attr: Any = NO_DEFAULT, default_box_none_transform: bool = True, frozen_box: bool = False, camel_killer_box: bool = False, conversion_box: bool = True, modify_tuples_box: bool = False, box_safe_prefix: str = "x", box_duplicates: str = "ignore", box_intact_types: Union[Tuple, List] = (), box_recast: Dict = None, box_dots: bool = False, **kwargs: Any, ): """ Due to the way pickling works in python 3, we need to make sure the box config is created as early as possible. """ obj = super(Box, cls).__new__(cls, *args, **kwargs) obj._box_config = _get_box_config() obj._box_config.update( { "default_box": default_box, "default_box_attr": cls.__class__ if default_box_attr is NO_DEFAULT else default_box_attr, "default_box_none_transform": default_box_none_transform, "conversion_box": conversion_box, "box_safe_prefix": box_safe_prefix, "frozen_box": frozen_box, "camel_killer_box": camel_killer_box, "modify_tuples_box": modify_tuples_box, "box_duplicates": box_duplicates, "box_intact_types": tuple(box_intact_types), "box_recast": box_recast, "box_dots": box_dots, "box_settings": box_settings, } ) return obj
https://github.com/rochacbruno/dynaconf/issues/391
# Traceback python error.py (dynaconf) ➜ dynaconf git:(master) βœ— python error.py Traceback (most recent call last): File "error.py", line 5, in <module> data = DynaBox(settings.as_dict()) TypeError: __new__() missing 1 required keyword-only argument: 'box_settings'
TypeError
def __init__( self, *args: Any, box_settings: Any = None, default_box: bool = False, default_box_attr: Any = NO_DEFAULT, default_box_none_transform: bool = True, frozen_box: bool = False, camel_killer_box: bool = False, conversion_box: bool = True, modify_tuples_box: bool = False, box_safe_prefix: str = "x", box_duplicates: str = "ignore", box_intact_types: Union[Tuple, List] = (), box_recast: Dict = None, box_dots: bool = False, **kwargs: Any, ): super().__init__() self._box_config = _get_box_config() self._box_config.update( { "default_box": default_box, "default_box_attr": self.__class__ if default_box_attr is NO_DEFAULT else default_box_attr, "default_box_none_transform": default_box_none_transform, "conversion_box": conversion_box, "box_safe_prefix": box_safe_prefix, "frozen_box": frozen_box, "camel_killer_box": camel_killer_box, "modify_tuples_box": modify_tuples_box, "box_duplicates": box_duplicates, "box_intact_types": tuple(box_intact_types), "box_recast": box_recast, "box_dots": box_dots, "box_settings": box_settings or {}, } ) if ( not self._box_config["conversion_box"] and self._box_config["box_duplicates"] != "ignore" ): raise BoxError("box_duplicates are only for conversion_boxes") if len(args) == 1: if isinstance(args[0], str): raise BoxValueError("Cannot extrapolate Box from string") if isinstance(args[0], Mapping): for k, v in args[0].items(): if v is args[0]: v = self if ( v is None and self._box_config["default_box"] and self._box_config["default_box_none_transform"] ): continue self.__setitem__(k, v) elif isinstance(args[0], Iterable): for k, v in args[0]: self.__setitem__(k, v) else: raise BoxValueError("First argument must be mapping or iterable") elif args: raise BoxTypeError(f"Box expected at most 1 argument, got {len(args)}") for k, v in kwargs.items(): if args and isinstance(args[0], Mapping) and v is args[0]: v = self self.__setitem__(k, v) self._box_config["__created"] = True
def __init__( self, *args: Any, box_settings: Any, default_box: bool = False, default_box_attr: Any = NO_DEFAULT, default_box_none_transform: bool = True, frozen_box: bool = False, camel_killer_box: bool = False, conversion_box: bool = True, modify_tuples_box: bool = False, box_safe_prefix: str = "x", box_duplicates: str = "ignore", box_intact_types: Union[Tuple, List] = (), box_recast: Dict = None, box_dots: bool = False, **kwargs: Any, ): super().__init__() self._box_config = _get_box_config() self._box_config.update( { "default_box": default_box, "default_box_attr": self.__class__ if default_box_attr is NO_DEFAULT else default_box_attr, "default_box_none_transform": default_box_none_transform, "conversion_box": conversion_box, "box_safe_prefix": box_safe_prefix, "frozen_box": frozen_box, "camel_killer_box": camel_killer_box, "modify_tuples_box": modify_tuples_box, "box_duplicates": box_duplicates, "box_intact_types": tuple(box_intact_types), "box_recast": box_recast, "box_dots": box_dots, "box_settings": box_settings, } ) if ( not self._box_config["conversion_box"] and self._box_config["box_duplicates"] != "ignore" ): raise BoxError("box_duplicates are only for conversion_boxes") if len(args) == 1: if isinstance(args[0], str): raise BoxValueError("Cannot extrapolate Box from string") if isinstance(args[0], Mapping): for k, v in args[0].items(): if v is args[0]: v = self if ( v is None and self._box_config["default_box"] and self._box_config["default_box_none_transform"] ): continue self.__setitem__(k, v) elif isinstance(args[0], Iterable): for k, v in args[0]: self.__setitem__(k, v) else: raise BoxValueError("First argument must be mapping or iterable") elif args: raise BoxTypeError(f"Box expected at most 1 argument, got {len(args)}") for k, v in kwargs.items(): if args and isinstance(args[0], Mapping) and v is args[0]: v = self self.__setitem__(k, v) self._box_config["__created"] = True
https://github.com/rochacbruno/dynaconf/issues/391
# Traceback python error.py (dynaconf) ➜ dynaconf git:(master) βœ— python error.py Traceback (most recent call last): File "error.py", line 5, in <module> data = DynaBox(settings.as_dict()) TypeError: __new__() missing 1 required keyword-only argument: 'box_settings'
TypeError
def yaml_set_comment_before_after_key( self, key, before=None, indent=0, after=None, after_indent=None ): # type: (Any, Any, Any, Any, Any) -> None """ expects comment (before/after) to be without `#` and possible have multiple lines """ from dynaconf.vendor.ruamel.yaml.error import CommentMark from dynaconf.vendor.ruamel.yaml.tokens import CommentToken def comment_token(s, mark): # type: (Any, Any) -> Any # handle empty lines as having no comment return CommentToken(("# " if s else "") + s + "\n", mark, None) if after_indent is None: after_indent = indent + 2 if before and (len(before) > 1) and before[-1] == "\n": before = before[:-1] # strip final newline if there if after and after[-1] == "\n": after = after[:-1] # strip final newline if there start_mark = CommentMark(indent) c = self.ca.items.setdefault(key, [None, [], None, None]) if before == "\n": c[1].append(comment_token("", start_mark)) elif before: for com in before.split("\n"): c[1].append(comment_token(com, start_mark)) if after: start_mark = CommentMark(after_indent) if c[3] is None: c[3] = [] for com in after.split("\n"): c[3].append(comment_token(com, start_mark)) # type: ignore
def yaml_set_comment_before_after_key( self, key, before=None, indent=0, after=None, after_indent=None ): # type: (Any, Any, Any, Any, Any) -> None """ expects comment (before/after) to be without `#` and possible have multiple lines """ from ruamel.yaml.error import CommentMark from ruamel.yaml.tokens import CommentToken def comment_token(s, mark): # type: (Any, Any) -> Any # handle empty lines as having no comment return CommentToken(("# " if s else "") + s + "\n", mark, None) if after_indent is None: after_indent = indent + 2 if before and (len(before) > 1) and before[-1] == "\n": before = before[:-1] # strip final newline if there if after and after[-1] == "\n": after = after[:-1] # strip final newline if there start_mark = CommentMark(indent) c = self.ca.items.setdefault(key, [None, [], None, None]) if before == "\n": c[1].append(comment_token("", start_mark)) elif before: for com in before.split("\n"): c[1].append(comment_token(com, start_mark)) if after: start_mark = CommentMark(after_indent) if c[3] is None: c[3] = [] for com in after.split("\n"): c[3].append(comment_token(com, start_mark)) # type: ignore
https://github.com/rochacbruno/dynaconf/issues/391
# Traceback python error.py (dynaconf) ➜ dynaconf git:(master) βœ— python error.py Traceback (most recent call last): File "error.py", line 5, in <module> data = DynaBox(settings.as_dict()) TypeError: __new__() missing 1 required keyword-only argument: 'box_settings'
TypeError
def version_tnf(t1, t2=None): # type: (Any, Any) -> Any """ return True if ruamel.yaml version_info < t1, None if t2 is specified and bigger else False """ from dynaconf.vendor.ruamel.yaml import version_info # NOQA if version_info < t1: return True if t2 is not None and version_info < t2: return None return False
def version_tnf(t1, t2=None): # type: (Any, Any) -> Any """ return True if ruamel.yaml version_info < t1, None if t2 is specified and bigger else False """ from ruamel.yaml import version_info # NOQA if version_info < t1: return True if t2 is not None and version_info < t2: return None return False
https://github.com/rochacbruno/dynaconf/issues/391
# Traceback python error.py (dynaconf) ➜ dynaconf git:(master) βœ— python error.py Traceback (most recent call last): File "error.py", line 5, in <module> data = DynaBox(settings.as_dict()) TypeError: __new__() missing 1 required keyword-only argument: 'box_settings'
TypeError
def construct_rt_sequence(self, node, seqtyp, deep=False): # type: (Any, Any, bool) -> Any if not isinstance(node, SequenceNode): raise ConstructorError( None, None, "expected a sequence node, but found %s" % node.id, node.start_mark, ) ret_val = [] if node.comment: seqtyp._yaml_add_comment(node.comment[:2]) if len(node.comment) > 2: seqtyp.yaml_end_comment_extend(node.comment[2], clear=True) if node.anchor: from dynaconf.vendor.ruamel.yaml.serializer import templated_id if not templated_id(node.anchor): seqtyp.yaml_set_anchor(node.anchor) for idx, child in enumerate(node.value): if child.comment: seqtyp._yaml_add_comment(child.comment, key=idx) child.comment = None # if moved to sequence remove from child ret_val.append(self.construct_object(child, deep=deep)) seqtyp._yaml_set_idx_line_col( idx, [child.start_mark.line, child.start_mark.column] ) return ret_val
def construct_rt_sequence(self, node, seqtyp, deep=False): # type: (Any, Any, bool) -> Any if not isinstance(node, SequenceNode): raise ConstructorError( None, None, "expected a sequence node, but found %s" % node.id, node.start_mark, ) ret_val = [] if node.comment: seqtyp._yaml_add_comment(node.comment[:2]) if len(node.comment) > 2: seqtyp.yaml_end_comment_extend(node.comment[2], clear=True) if node.anchor: from ruamel.yaml.serializer import templated_id if not templated_id(node.anchor): seqtyp.yaml_set_anchor(node.anchor) for idx, child in enumerate(node.value): if child.comment: seqtyp._yaml_add_comment(child.comment, key=idx) child.comment = None # if moved to sequence remove from child ret_val.append(self.construct_object(child, deep=deep)) seqtyp._yaml_set_idx_line_col( idx, [child.start_mark.line, child.start_mark.column] ) return ret_val
https://github.com/rochacbruno/dynaconf/issues/391
# Traceback python error.py (dynaconf) ➜ dynaconf git:(master) βœ— python error.py Traceback (most recent call last): File "error.py", line 5, in <module> data = DynaBox(settings.as_dict()) TypeError: __new__() missing 1 required keyword-only argument: 'box_settings'
TypeError
def construct_mapping(self, node, maptyp, deep=False): # type: ignore # type: (Any, Any, bool) -> Any if not isinstance(node, MappingNode): raise ConstructorError( None, None, "expected a mapping node, but found %s" % node.id, node.start_mark, ) merge_map = self.flatten_mapping(node) # mapping = {} if node.comment: maptyp._yaml_add_comment(node.comment[:2]) if len(node.comment) > 2: maptyp.yaml_end_comment_extend(node.comment[2], clear=True) if node.anchor: from dynaconf.vendor.ruamel.yaml.serializer import templated_id if not templated_id(node.anchor): maptyp.yaml_set_anchor(node.anchor) last_key, last_value = None, self._sentinel for key_node, value_node in node.value: # keys can be list -> deep key = self.construct_object(key_node, deep=True) # lists are not hashable, but tuples are if not isinstance(key, Hashable): if isinstance(key, MutableSequence): key_s = CommentedKeySeq(key) if key_node.flow_style is True: key_s.fa.set_flow_style() elif key_node.flow_style is False: key_s.fa.set_block_style() key = key_s elif isinstance(key, MutableMapping): key_m = CommentedKeyMap(key) if key_node.flow_style is True: key_m.fa.set_flow_style() elif key_node.flow_style is False: key_m.fa.set_block_style() key = key_m if PY2: try: hash(key) except TypeError as exc: raise ConstructorError( "while constructing a mapping", node.start_mark, "found unacceptable key (%s)" % exc, key_node.start_mark, ) else: if not isinstance(key, Hashable): raise ConstructorError( "while constructing a mapping", node.start_mark, "found unhashable key", key_node.start_mark, ) value = self.construct_object(value_node, deep=deep) if self.check_mapping_key(node, key_node, maptyp, key, value): if key_node.comment and len(key_node.comment) > 4 and key_node.comment[4]: if last_value is None: key_node.comment[0] = key_node.comment.pop(4) maptyp._yaml_add_comment(key_node.comment, value=last_key) else: key_node.comment[2] = key_node.comment.pop(4) maptyp._yaml_add_comment(key_node.comment, key=key) key_node.comment = None if key_node.comment: maptyp._yaml_add_comment(key_node.comment, key=key) if value_node.comment: maptyp._yaml_add_comment(value_node.comment, value=key) maptyp._yaml_set_kv_line_col( key, [ key_node.start_mark.line, key_node.start_mark.column, value_node.start_mark.line, value_node.start_mark.column, ], ) maptyp[key] = value last_key, last_value = key, value # could use indexing # do this last, or <<: before a key will prevent insertion in instances # of collections.OrderedDict (as they have no __contains__ if merge_map: maptyp.add_yaml_merge(merge_map)
def construct_mapping(self, node, maptyp, deep=False): # type: ignore # type: (Any, Any, bool) -> Any if not isinstance(node, MappingNode): raise ConstructorError( None, None, "expected a mapping node, but found %s" % node.id, node.start_mark, ) merge_map = self.flatten_mapping(node) # mapping = {} if node.comment: maptyp._yaml_add_comment(node.comment[:2]) if len(node.comment) > 2: maptyp.yaml_end_comment_extend(node.comment[2], clear=True) if node.anchor: from ruamel.yaml.serializer import templated_id if not templated_id(node.anchor): maptyp.yaml_set_anchor(node.anchor) last_key, last_value = None, self._sentinel for key_node, value_node in node.value: # keys can be list -> deep key = self.construct_object(key_node, deep=True) # lists are not hashable, but tuples are if not isinstance(key, Hashable): if isinstance(key, MutableSequence): key_s = CommentedKeySeq(key) if key_node.flow_style is True: key_s.fa.set_flow_style() elif key_node.flow_style is False: key_s.fa.set_block_style() key = key_s elif isinstance(key, MutableMapping): key_m = CommentedKeyMap(key) if key_node.flow_style is True: key_m.fa.set_flow_style() elif key_node.flow_style is False: key_m.fa.set_block_style() key = key_m if PY2: try: hash(key) except TypeError as exc: raise ConstructorError( "while constructing a mapping", node.start_mark, "found unacceptable key (%s)" % exc, key_node.start_mark, ) else: if not isinstance(key, Hashable): raise ConstructorError( "while constructing a mapping", node.start_mark, "found unhashable key", key_node.start_mark, ) value = self.construct_object(value_node, deep=deep) if self.check_mapping_key(node, key_node, maptyp, key, value): if key_node.comment and len(key_node.comment) > 4 and key_node.comment[4]: if last_value is None: key_node.comment[0] = key_node.comment.pop(4) maptyp._yaml_add_comment(key_node.comment, value=last_key) else: key_node.comment[2] = key_node.comment.pop(4) maptyp._yaml_add_comment(key_node.comment, key=key) key_node.comment = None if key_node.comment: maptyp._yaml_add_comment(key_node.comment, key=key) if value_node.comment: maptyp._yaml_add_comment(value_node.comment, value=key) maptyp._yaml_set_kv_line_col( key, [ key_node.start_mark.line, key_node.start_mark.column, value_node.start_mark.line, value_node.start_mark.column, ], ) maptyp[key] = value last_key, last_value = key, value # could use indexing # do this last, or <<: before a key will prevent insertion in instances # of collections.OrderedDict (as they have no __contains__ if merge_map: maptyp.add_yaml_merge(merge_map)
https://github.com/rochacbruno/dynaconf/issues/391
# Traceback python error.py (dynaconf) ➜ dynaconf git:(master) βœ— python error.py Traceback (most recent call last): File "error.py", line 5, in <module> data = DynaBox(settings.as_dict()) TypeError: __new__() missing 1 required keyword-only argument: 'box_settings'
TypeError
def construct_setting(self, node, typ, deep=False): # type: (Any, Any, bool) -> Any if not isinstance(node, MappingNode): raise ConstructorError( None, None, "expected a mapping node, but found %s" % node.id, node.start_mark, ) if node.comment: typ._yaml_add_comment(node.comment[:2]) if len(node.comment) > 2: typ.yaml_end_comment_extend(node.comment[2], clear=True) if node.anchor: from dynaconf.vendor.ruamel.yaml.serializer import templated_id if not templated_id(node.anchor): typ.yaml_set_anchor(node.anchor) for key_node, value_node in node.value: # keys can be list -> deep key = self.construct_object(key_node, deep=True) # lists are not hashable, but tuples are if not isinstance(key, Hashable): if isinstance(key, list): key = tuple(key) if PY2: try: hash(key) except TypeError as exc: raise ConstructorError( "while constructing a mapping", node.start_mark, "found unacceptable key (%s)" % exc, key_node.start_mark, ) else: if not isinstance(key, Hashable): raise ConstructorError( "while constructing a mapping", node.start_mark, "found unhashable key", key_node.start_mark, ) # construct but should be null value = self.construct_object(value_node, deep=deep) # NOQA self.check_set_key(node, key_node, typ, key) if key_node.comment: typ._yaml_add_comment(key_node.comment, key=key) if value_node.comment: typ._yaml_add_comment(value_node.comment, value=key) typ.add(key)
def construct_setting(self, node, typ, deep=False): # type: (Any, Any, bool) -> Any if not isinstance(node, MappingNode): raise ConstructorError( None, None, "expected a mapping node, but found %s" % node.id, node.start_mark, ) if node.comment: typ._yaml_add_comment(node.comment[:2]) if len(node.comment) > 2: typ.yaml_end_comment_extend(node.comment[2], clear=True) if node.anchor: from ruamel.yaml.serializer import templated_id if not templated_id(node.anchor): typ.yaml_set_anchor(node.anchor) for key_node, value_node in node.value: # keys can be list -> deep key = self.construct_object(key_node, deep=True) # lists are not hashable, but tuples are if not isinstance(key, Hashable): if isinstance(key, list): key = tuple(key) if PY2: try: hash(key) except TypeError as exc: raise ConstructorError( "while constructing a mapping", node.start_mark, "found unacceptable key (%s)" % exc, key_node.start_mark, ) else: if not isinstance(key, Hashable): raise ConstructorError( "while constructing a mapping", node.start_mark, "found unhashable key", key_node.start_mark, ) # construct but should be null value = self.construct_object(value_node, deep=deep) # NOQA self.check_set_key(node, key_node, typ, key) if key_node.comment: typ._yaml_add_comment(key_node.comment, key=key) if value_node.comment: typ._yaml_add_comment(value_node.comment, value=key) typ.add(key)
https://github.com/rochacbruno/dynaconf/issues/391
# Traceback python error.py (dynaconf) ➜ dynaconf git:(master) βœ— python error.py Traceback (most recent call last): File "error.py", line 5, in <module> data = DynaBox(settings.as_dict()) TypeError: __new__() missing 1 required keyword-only argument: 'box_settings'
TypeError
def map(self, **kw): # type: (Any) -> Any if "rt" in self.typ: from dynaconf.vendor.ruamel.yaml.comments import CommentedMap return CommentedMap(**kw) else: return dict(**kw)
def map(self, **kw): # type: (Any) -> Any if "rt" in self.typ: from ruamel.yaml.comments import CommentedMap return CommentedMap(**kw) else: return dict(**kw)
https://github.com/rochacbruno/dynaconf/issues/391
# Traceback python error.py (dynaconf) ➜ dynaconf git:(master) βœ— python error.py Traceback (most recent call last): File "error.py", line 5, in <module> data = DynaBox(settings.as_dict()) TypeError: __new__() missing 1 required keyword-only argument: 'box_settings'
TypeError
def seq(self, *args): # type: (Any) -> Any if "rt" in self.typ: from dynaconf.vendor.ruamel.yaml.comments import CommentedSeq return CommentedSeq(*args) else: return list(*args)
def seq(self, *args): # type: (Any) -> Any if "rt" in self.typ: from ruamel.yaml.comments import CommentedSeq return CommentedSeq(*args) else: return list(*args)
https://github.com/rochacbruno/dynaconf/issues/391
# Traceback python error.py (dynaconf) ➜ dynaconf git:(master) βœ— python error.py Traceback (most recent call last): File "error.py", line 5, in <module> data = DynaBox(settings.as_dict()) TypeError: __new__() missing 1 required keyword-only argument: 'box_settings'
TypeError
def walk_tree(base, map=None): # type: (Any, Any) -> None """ the routine here walks over a simple yaml tree (recursing in dict values and list items) and converts strings that have multiple lines to literal scalars You can also provide an explicit (ordered) mapping for multiple transforms (first of which is executed): map = ruamel.yaml.compat.ordereddict map['\n'] = preserve_literal map[':'] = SingleQuotedScalarString walk_tree(data, map=map) """ from dynaconf.vendor.ruamel.yaml.compat import string_types from dynaconf.vendor.ruamel.yaml.compat import MutableMapping, MutableSequence # type: ignore if map is None: map = {"\n": preserve_literal} if isinstance(base, MutableMapping): for k in base: v = base[k] # type: Text if isinstance(v, string_types): for ch in map: if ch in v: base[k] = map[ch](v) break else: walk_tree(v) elif isinstance(base, MutableSequence): for idx, elem in enumerate(base): if isinstance(elem, string_types): for ch in map: if ch in elem: # type: ignore base[idx] = map[ch](elem) break else: walk_tree(elem)
def walk_tree(base, map=None): # type: (Any, Any) -> None """ the routine here walks over a simple yaml tree (recursing in dict values and list items) and converts strings that have multiple lines to literal scalars You can also provide an explicit (ordered) mapping for multiple transforms (first of which is executed): map = ruamel.yaml.compat.ordereddict map['\n'] = preserve_literal map[':'] = SingleQuotedScalarString walk_tree(data, map=map) """ from ruamel.yaml.compat import string_types from ruamel.yaml.compat import MutableMapping, MutableSequence # type: ignore if map is None: map = {"\n": preserve_literal} if isinstance(base, MutableMapping): for k in base: v = base[k] # type: Text if isinstance(v, string_types): for ch in map: if ch in v: base[k] = map[ch](v) break else: walk_tree(v) elif isinstance(base, MutableSequence): for idx, elem in enumerate(base): if isinstance(elem, string_types): for ch in map: if ch in elem: # type: ignore base[idx] = map[ch](elem) break else: walk_tree(elem)
https://github.com/rochacbruno/dynaconf/issues/391
# Traceback python error.py (dynaconf) ➜ dynaconf git:(master) βœ— python error.py Traceback (most recent call last): File "error.py", line 5, in <module> data = DynaBox(settings.as_dict()) TypeError: __new__() missing 1 required keyword-only argument: 'box_settings'
TypeError
def __init__(self, _dict=dict, preserve=False): from dynaconf.vendor.toml.decoder import CommentValue super(TomlPreserveCommentEncoder, self).__init__(_dict, preserve) self.dump_funcs[CommentValue] = lambda v: v.dump(self.dump_value)
def __init__(self, _dict=dict, preserve=False): from toml.decoder import CommentValue super(TomlPreserveCommentEncoder, self).__init__(_dict, preserve) self.dump_funcs[CommentValue] = lambda v: v.dump(self.dump_value)
https://github.com/rochacbruno/dynaconf/issues/391
# Traceback python error.py (dynaconf) ➜ dynaconf git:(master) βœ— python error.py Traceback (most recent call last): File "error.py", line 5, in <module> data = DynaBox(settings.as_dict()) TypeError: __new__() missing 1 required keyword-only argument: 'box_settings'
TypeError
def __init__( self, app=None, instance_relative_config=False, dynaconf_instance=None, extensions_list=False, **kwargs, ): """kwargs holds initial dynaconf configuration""" if not flask_installed: # pragma: no cover raise RuntimeError( "To use this extension Flask must be installed " "install it with: pip install flask" ) self.kwargs = kwargs kwargs.setdefault("ENVVAR_PREFIX", "FLASK") env_prefix = f"{kwargs['ENVVAR_PREFIX']}_ENV" # FLASK_ENV kwargs.setdefault("ENV_SWITCHER", env_prefix) kwargs.setdefault("ENVIRONMENTS", True) kwargs.setdefault("load_dotenv", True) kwargs.setdefault("default_settings_paths", dynaconf.DEFAULT_SETTINGS_FILES) self.dynaconf_instance = dynaconf_instance self.instance_relative_config = instance_relative_config self.extensions_list = extensions_list if app: self.init_app(app, **kwargs)
def __init__( self, app=None, instance_relative_config=False, dynaconf_instance=None, **kwargs, ): """kwargs holds initial dynaconf configuration""" if not flask_installed: # pragma: no cover raise RuntimeError( "To use this extension Flask must be installed " "install it with: pip install flask" ) self.kwargs = kwargs kwargs.setdefault("ENVVAR_PREFIX", "FLASK") env_prefix = f"{kwargs['ENVVAR_PREFIX']}_ENV" # FLASK_ENV kwargs.setdefault("ENV_SWITCHER", env_prefix) kwargs.setdefault("ENVIRONMENTS", True) kwargs.setdefault("load_dotenv", True) kwargs.setdefault("default_settings_paths", dynaconf.DEFAULT_SETTINGS_FILES) self.dynaconf_instance = dynaconf_instance self.instance_relative_config = instance_relative_config if app: self.init_app(app, **kwargs)
https://github.com/rochacbruno/dynaconf/issues/323
200 # Looks OK, defined in development BB # Looks OK, missing in development but defined in default DEV Namespace A # Looks OK, defined in the development.namespace section Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/mnt/data/projects/pkh/rapidxmm/repos/backend/backend/src/.venv/lib/python3.7/site-packages/dynaconf/utils/boxing.py", line 15, in __getattr__ return super(DynaBox, self).__getattr__(n_item, *args, **kwargs) File "/mnt/data/projects/pkh/rapidxmm/repos/backend/backend/src/.venv/lib/python3.7/site-packages/box.py", line 525, in __getattr__ raise BoxKeyError(str(err)) box.BoxKeyError: "'DynaBox' object has no attribute 'b'"
box.BoxKeyError
def init_app(self, app, **kwargs): """kwargs holds initial dynaconf configuration""" self.kwargs.update(kwargs) self.settings = self.dynaconf_instance or dynaconf.LazySettings(**self.kwargs) dynaconf.settings = self.settings # rebind customized settings app.config = self.make_config(app) app.dynaconf = self.settings if self.extensions_list: if not isinstance(self.extensions_list, str): self.extensions_list = "EXTENSIONS" app.config.load_extensions(self.extensions_list)
def init_app(self, app, **kwargs): """kwargs holds initial dynaconf configuration""" self.kwargs.update(kwargs) self.settings = self.dynaconf_instance or dynaconf.LazySettings(**self.kwargs) dynaconf.settings = self.settings # rebind customized settings app.config = self.make_config(app) app.dynaconf = self.settings
https://github.com/rochacbruno/dynaconf/issues/323
200 # Looks OK, defined in development BB # Looks OK, missing in development but defined in default DEV Namespace A # Looks OK, defined in the development.namespace section Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/mnt/data/projects/pkh/rapidxmm/repos/backend/backend/src/.venv/lib/python3.7/site-packages/dynaconf/utils/boxing.py", line 15, in __getattr__ return super(DynaBox, self).__getattr__(n_item, *args, **kwargs) File "/mnt/data/projects/pkh/rapidxmm/repos/backend/backend/src/.venv/lib/python3.7/site-packages/box.py", line 525, in __getattr__ raise BoxKeyError(str(err)) box.BoxKeyError: "'DynaBox' object has no attribute 'b'"
box.BoxKeyError
def load_extensions(self, key="EXTENSIONS", app=None): """Loads flask extensions dynamically.""" app = app or self._app extensions = app.config.get(key) if not extensions: warnings.warn( f"Settings is missing {key} to load Flask Extensions", RuntimeWarning, ) return for extension in app.config[key]: # Split data in form `extension.path:factory_function` module_name, factory = extension.split(":") # Dynamically import extension module. ext = import_module(module_name) # Invoke factory passing app. getattr(ext, factory)(app)
def load_extensions(self, key="EXTENSIONS", app=None): """Loads flask extensions dynamically.""" app = app or self._app for extension in app.config[key]: # Split data in form `extension.path:factory_function` module_name, factory = extension.split(":") # Dynamically import extension module. ext = import_module(module_name) # Invoke factory passing app. getattr(ext, factory)(app)
https://github.com/rochacbruno/dynaconf/issues/323
200 # Looks OK, defined in development BB # Looks OK, missing in development but defined in default DEV Namespace A # Looks OK, defined in the development.namespace section Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/mnt/data/projects/pkh/rapidxmm/repos/backend/backend/src/.venv/lib/python3.7/site-packages/dynaconf/utils/boxing.py", line 15, in __getattr__ return super(DynaBox, self).__getattr__(n_item, *args, **kwargs) File "/mnt/data/projects/pkh/rapidxmm/repos/backend/backend/src/.venv/lib/python3.7/site-packages/box.py", line 525, in __getattr__ raise BoxKeyError(str(err)) box.BoxKeyError: "'DynaBox' object has no attribute 'b'"
box.BoxKeyError
def __getitem__(self, item): """Allow getting variables as dict keys `settings['KEY']`""" value = self.get(item, default=empty) if value is empty: raise KeyError("{0} does not exist".format(item)) return value
def __getitem__(self, item): """Allow getting variables as dict keys `settings['KEY']`""" value = self.get(item) if value is None: raise KeyError("{0} does not exists".format(item)) return value
https://github.com/rochacbruno/dynaconf/issues/288
Hello Traceback (most recent call last): File ".../dynaconf/base.py", line 222, in __getitem__ raise KeyError("{0} does not exists".format(item)) KeyError: 'nulled_name does not exists'
KeyError
def write(filename, data, env=None): """Writes `data` to `filename` infers format by file extension.""" loader_name = "{0}_loader".format(filename.rpartition(".")[-1]) loader = globals().get(loader_name) if not loader: raise IOError("{0} cannot be found.".format(loader_name)) data = DynaBox(data).to_dict() if loader is not py_loader and env and env not in data: data = {env: data} loader.write(filename, data, merge=False)
def write(filename, data, env=None): """Writes `data` to `filename` infers format by file extension.""" loader_name = "{0}_loader".format(filename.rpartition(".")[-1]) loader = globals().get(loader_name) if not loader: raise IOError("{0} cannot be found.".format(loader_name)) data = DynaBox(data).to_dict() if env and env not in data: data = {env: data} loader.write(filename, data, merge=False)
https://github.com/rochacbruno/dynaconf/issues/288
Hello Traceback (most recent call last): File ".../dynaconf/base.py", line 222, in __getitem__ raise KeyError("{0} does not exists".format(item)) KeyError: 'nulled_name does not exists'
KeyError
def write(settings_path, settings_data, merge=True): """Write data to a settings file. :param settings_path: the filepath :param settings_data: a dictionary with data :param merge: boolean if existing file should be merged with new data """ settings_path = Path(settings_path) if settings_path.exists() and merge: # pragma: no cover with io.open( str(settings_path), encoding=default_settings.ENCODING_FOR_DYNACONF ) as open_file: object_merge(toml.load(open_file), settings_data) with io.open( str(settings_path), "w", encoding=default_settings.ENCODING_FOR_DYNACONF, ) as open_file: toml.dump(encode_nulls(settings_data), open_file)
def write(settings_path, settings_data, merge=True): """Write data to a settings file. :param settings_path: the filepath :param settings_data: a dictionary with data :param merge: boolean if existing file should be merged with new data """ settings_path = Path(settings_path) if settings_path.exists() and merge: # pragma: no cover with io.open( str(settings_path), encoding=default_settings.ENCODING_FOR_DYNACONF ) as open_file: object_merge(toml.load(open_file), settings_data) with io.open( str(settings_path), "w", encoding=default_settings.ENCODING_FOR_DYNACONF, ) as open_file: toml.dump(settings_data, open_file)
https://github.com/rochacbruno/dynaconf/issues/288
Hello Traceback (most recent call last): File ".../dynaconf/base.py", line 222, in __getitem__ raise KeyError("{0} does not exists".format(item)) KeyError: 'nulled_name does not exists'
KeyError
def get(self, item, default=None, *args, **kwargs): if item not in self: # toggle case item = item.lower() if item.isupper() else upperfy(item) return super(DynaBox, self).get(item, default, *args, **kwargs)
def get(self, item, default=None, *args, **kwargs): value = super(DynaBox, self).get(item, default, *args, **kwargs) if value is None or value == default: n_item = item.lower() if item.isupper() else upperfy(item) value = super(DynaBox, self).get(n_item, default, *args, **kwargs) return value
https://github.com/rochacbruno/dynaconf/issues/288
Hello Traceback (most recent call last): File ".../dynaconf/base.py", line 222, in __getitem__ raise KeyError("{0} does not exists".format(item)) KeyError: 'nulled_name does not exists'
KeyError
def _read(self, files, envs, silent=True, key=None): for source_file in files: if source_file.endswith(self.extensions): # pragma: no cover try: source_data = self.file_reader( io.open( find_file( source_file, project_root=self.obj.get("PROJECT_ROOT_FOR_DYNACONF"), ), encoding=self.obj.get("ENCODING_FOR_DYNACONF", "utf-8"), ) ) self.obj.logger.debug( "{}_loader: {}".format(self.identifier, source_file) ) except IOError: self.obj.logger.debug( "{}_loader: {} (Ignored, file not Found)".format( self.identifier, source_file ) ) source_data = None else: # for tests it is possible to pass string source_data = self.string_reader(source_file) if not source_data: continue # env name is checked in lower source_data = {k.lower(): value for k, value in source_data.items()} for env in envs: data = {} try: data = source_data[env.lower()] except KeyError: if env not in (self.obj.get("GLOBAL_ENV_FOR_DYNACONF"), "GLOBAL"): message = "%s_loader: %s env not defined in %s" % ( self.identifier, env, source_file, ) if silent: self.obj.logger.warning(message) else: raise KeyError(message) continue if env != self.obj.get("DEFAULT_ENV_FOR_DYNACONF"): identifier = "{0}_{1}".format(self.identifier, env.lower()) else: identifier = self.identifier # data 1st level keys should be transformed to upper case. data = {k.upper(): v for k, v in data.items()} if key: key = key.upper() if not key: self.obj.update(data, loader_identifier=identifier) elif key in data: self.obj.set(key, data.get(key), loader_identifier=identifier) self.obj.logger.debug( "{}_loader: {}: {}".format( self.identifier, env.lower(), list(data.keys()) if "secret" in source_file else data, ) )
def _read(self, files, envs, silent=True, key=None): for source_file in files: if source_file.endswith(self.extensions): # pragma: no cover try: source_data = self.file_reader( io.open( find_file( source_file, project_root=self.obj.get("PROJECT_ROOT_FOR_DYNACONF"), ), encoding=self.obj.get("ENCODING_FOR_DYNACONF", "utf-8"), ) ) self.obj.logger.debug( "{}_loader: {}".format(self.identifier, source_file) ) except IOError: self.obj.logger.debug( "{}_loader: {} (Ignored, file not Found)".format( self.identifier, source_file ) ) source_data = None else: # for tests it is possible to pass string source_data = self.string_reader(source_file) if not source_data: continue source_data = {k.lower(): value for k, value in source_data.items()} for env in envs: data = {} try: data = source_data[env.lower()] except KeyError: if env not in (self.obj.get("GLOBAL_ENV_FOR_DYNACONF"), "GLOBAL"): message = "%s_loader: %s env not defined in %s" % ( self.identifier, env, source_file, ) if silent: self.obj.logger.warning(message) else: raise KeyError(message) continue if env != self.obj.get("DEFAULT_ENV_FOR_DYNACONF"): identifier = "{0}_{1}".format(self.identifier, env.lower()) else: identifier = self.identifier if not key: self.obj.update(data, loader_identifier=identifier) elif key in data: self.obj.set(key, data.get(key), loader_identifier=identifier) self.obj.logger.debug( "{}_loader: {}: {}".format( self.identifier, env.lower(), list(data.keys()) if "secret" in source_file else data, ) )
https://github.com/rochacbruno/dynaconf/issues/129
In [1]: from dynaconf import settings In [2]: settings.POTATO Out[2]: 'test' In [3]: settings.get_fresh('POTATO') In [4]: settings.POTATO --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-4-22d467a777a4> in <module> ----> 1 settings.POTATO ~/miniconda3/lib/python3.7/site-packages/dynaconf/base.py in __getattr__(self, name) 95 raise AttributeError( 96 "Attribute %s was deleted, " ---> 97 "or belongs to different env" % name 98 ) 99 if ( AttributeError: Attribute POTATO was deleted, or belongs to different env
AttributeError
def write(settings_path, settings_data, merge=True): """Write data to a settings file. :param settings_path: the filepath :param settings_data: a dictionary with data :param merge: boolean if existing file should be merged with new data """ settings_path = Path(settings_path) if settings_path.exists() and merge: # pragma: no cover object_merge( ConfigObj( io.open( str(settings_path), encoding=default_settings.ENCODING_FOR_DYNACONF ) ).dict(), settings_data, ) new = ConfigObj() new.update(settings_data) new.write(open(str(settings_path), "bw"))
def write(settings_path, settings_data, merge=True): """Write data to a settings file. :param settings_path: the filepath :param settings_data: a dictionary with data :param merge: boolean if existing file should be merged with new data """ if settings_path.exists() and merge: # pragma: no cover object_merge( ConfigObj( io.open( str(settings_path), encoding=default_settings.ENCODING_FOR_DYNACONF ) ).dict(), settings_data, ) new = ConfigObj() new.update(settings_data) new.write(open(str(settings_path), "bw"))
https://github.com/rochacbruno/dynaconf/issues/129
In [1]: from dynaconf import settings In [2]: settings.POTATO Out[2]: 'test' In [3]: settings.get_fresh('POTATO') In [4]: settings.POTATO --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-4-22d467a777a4> in <module> ----> 1 settings.POTATO ~/miniconda3/lib/python3.7/site-packages/dynaconf/base.py in __getattr__(self, name) 95 raise AttributeError( 96 "Attribute %s was deleted, " ---> 97 "or belongs to different env" % name 98 ) 99 if ( AttributeError: Attribute POTATO was deleted, or belongs to different env
AttributeError