update_engine: UM: Async request expiration handled differently.

As discussed on the tracker issue, we're changing the way an async
policy request expiration timeout is being handled: instead of failing
the policy request entirely, this now only causes the UpdateManager to
dump the evaluation context, reset the expiration deadline and
reevaluate the policy (which is necessary in order for evaluation time
and corresponding timeouts to be recomputed).  This is aimed to ensure
that policies are allowed to block for arbitrarily long periods, while
still emitting useful information to the log (which will help diagnose
if this is due to an implementation error).

Since the expiration timeout no longer returns control to the caller, we
remove it from the AsyncPolicyRequest() API. Instead, we use a single
timeout value, which is set during the UpdateManager construction and
used for all policy calls. By default, the update engine sets it to 12
hours; for testing and debugging purposes, a smaller value is used.

This CL also forbids the default (fallback) policy from blocking,
forcing a failure instead; a situation like that makes no sense anyway,
and may lead to inconsistent return values leaking to the caller.

BUG=chromium:401687
TEST=Unit tests.

Change-Id: I0bf60875bb7f524c99ed72dac61720633ab2061b
Reviewed-on: https://chromium-review.googlesource.com/211647
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
9 files changed
tree: c8238b99d14974c8e558591bd5a05c5fc6ab460f
  1. init/
  2. payload_generator/
  3. update_manager/
  4. .gitignore
  5. action.h
  6. action_mock.h
  7. action_pipe.h
  8. action_pipe_unittest.cc
  9. action_processor.cc
  10. action_processor.h
  11. action_processor_mock.h
  12. action_processor_unittest.cc
  13. action_unittest.cc
  14. build
  15. bzip.cc
  16. bzip.h
  17. bzip_extent_writer.cc
  18. bzip_extent_writer.h
  19. bzip_extent_writer_unittest.cc
  20. certificate_checker.cc
  21. certificate_checker.h
  22. certificate_checker_mock.h
  23. certificate_checker_unittest.cc
  24. chrome_browser_proxy_resolver.cc
  25. chrome_browser_proxy_resolver.h
  26. chrome_browser_proxy_resolver_unittest.cc
  27. clock.cc
  28. clock.h
  29. clock_interface.h
  30. connection_manager.cc
  31. connection_manager.h
  32. connection_manager_unittest.cc
  33. constants.cc
  34. constants.h
  35. dbus_constants.h
  36. dbus_service.cc
  37. dbus_service.h
  38. dbus_wrapper_interface.h
  39. delta_performer.cc
  40. delta_performer.h
  41. delta_performer_unittest.cc
  42. download_action.cc
  43. download_action.h
  44. download_action_unittest.cc
  45. error_code.h
  46. extent_ranges.cc
  47. extent_ranges.h
  48. extent_ranges_unittest.cc
  49. extent_writer.cc
  50. extent_writer.h
  51. extent_writer_unittest.cc
  52. fake_clock.h
  53. fake_hardware.h
  54. fake_p2p_manager.h
  55. fake_p2p_manager_configuration.h
  56. fake_prefs.cc
  57. fake_prefs.h
  58. fake_system_state.cc
  59. fake_system_state.h
  60. file_descriptor.cc
  61. file_descriptor.h
  62. file_writer.cc
  63. file_writer.h
  64. file_writer_mock.h
  65. file_writer_unittest.cc
  66. filesystem_copier_action.cc
  67. filesystem_copier_action.h
  68. filesystem_copier_action_unittest.cc
  69. gen_coverage_html
  70. glib_utils.cc
  71. glib_utils.h
  72. hardware.cc
  73. hardware.h
  74. hardware_interface.h
  75. http_common.cc
  76. http_common.h
  77. http_fetcher.cc
  78. http_fetcher.h
  79. http_fetcher_unittest.cc
  80. hwid_override.cc
  81. hwid_override.h
  82. hwid_override_unittest.cc
  83. inherit-review-settings-ok
  84. install_plan.cc
  85. install_plan.h
  86. libcurl_http_fetcher.cc
  87. libcurl_http_fetcher.h
  88. local_coverage_rate
  89. main.cc
  90. metrics.cc
  91. metrics.h
  92. mock_connection_manager.h
  93. mock_dbus_wrapper.h
  94. mock_file_writer.h
  95. mock_hardware.h
  96. mock_http_fetcher.cc
  97. mock_http_fetcher.h
  98. mock_p2p_manager.h
  99. mock_payload_state.h
  100. multi_range_http_fetcher.cc
  101. multi_range_http_fetcher.h
  102. omaha_hash_calculator.cc
  103. omaha_hash_calculator.h
  104. omaha_hash_calculator_unittest.cc
  105. omaha_request_action.cc
  106. omaha_request_action.h
  107. omaha_request_action_unittest.cc
  108. omaha_request_params.cc
  109. omaha_request_params.h
  110. omaha_request_params_unittest.cc
  111. omaha_response.h
  112. omaha_response_handler_action.cc
  113. omaha_response_handler_action.h
  114. omaha_response_handler_action_unittest.cc
  115. OWNERS
  116. p2p_manager.cc
  117. p2p_manager.h
  118. p2p_manager_unittest.cc
  119. payload_constants.cc
  120. payload_constants.h
  121. payload_state.cc
  122. payload_state.h
  123. payload_state_interface.h
  124. payload_state_unittest.cc
  125. payload_verifier.cc
  126. payload_verifier.h
  127. postinstall_runner_action.cc
  128. postinstall_runner_action.h
  129. postinstall_runner_action_unittest.cc
  130. prefs.cc
  131. prefs.h
  132. prefs_interface.h
  133. prefs_mock.h
  134. prefs_unittest.cc
  135. proxy_resolver.cc
  136. proxy_resolver.h
  137. real_dbus_wrapper.h
  138. real_system_state.cc
  139. real_system_state.h
  140. run_unittests
  141. sample_omaha_v3_response.xml
  142. simple_key_value_store.cc
  143. simple_key_value_store.h
  144. simple_key_value_store_unittest.cc
  145. subprocess.cc
  146. subprocess.h
  147. subprocess_unittest.cc
  148. system_state.h
  149. terminator.cc
  150. terminator.h
  151. terminator_unittest.cc
  152. test_http_server.cc
  153. test_utils.cc
  154. test_utils.h
  155. testrunner.cc
  156. unittest_key.pem
  157. unittest_key2.pem
  158. update_attempter.cc
  159. update_attempter.h
  160. update_attempter_mock.h
  161. update_attempter_unittest.cc
  162. update_check_scheduler.cc
  163. update_check_scheduler.h
  164. update_check_scheduler_unittest.cc
  165. update_engine.gyp
  166. update_engine.xml
  167. update_engine_client.cc
  168. update_metadata.proto
  169. UpdateEngine.conf
  170. utils.cc
  171. utils.h
  172. utils_unittest.cc
  173. WATCHLISTS
  174. zip_unittest.cc