Merge lp:~marcustomlinson/unity-scopes-api/increase_childscopes_timeouts into lp:unity-scopes-api/devel

Proposed by Marcus Tomlinson
Status: Merged
Approved by: Marcus Tomlinson
Approved revision: 584
Merged at revision: 585
Proposed branch: lp:~marcustomlinson/unity-scopes-api/increase_childscopes_timeouts
Merge into: lp:unity-scopes-api/devel
Diff against target: 255 lines (+66/-10)
11 files modified
CMakeLists.txt (+1/-1)
CONFIGFILES (+10/-0)
RELEASE_NOTES.md (+6/-0)
debian/changelog (+8/-0)
include/unity/scopes/internal/DfltConfig.h.in (+7/-6)
include/unity/scopes/internal/zmq_middleware/ZmqConfig.h (+2/-0)
include/unity/scopes/internal/zmq_middleware/ZmqMiddleware.h (+2/-0)
include/unity/scopes/internal/zmq_middleware/ZmqScope.h (+1/-0)
src/scopes/internal/zmq_middleware/ZmqConfig.cpp (+13/-0)
src/scopes/internal/zmq_middleware/ZmqMiddleware.cpp (+6/-0)
src/scopes/internal/zmq_middleware/ZmqScope.cpp (+10/-3)
To merge this branch: bzr merge lp:~marcustomlinson/unity-scopes-api/increase_childscopes_timeouts
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Michi Henning (community) Approve
Review via email: mp+257266@code.launchpad.net

Commit message

Give child_scopes() and set_child_scopes() methods more time to process as these methods read and write to disk.

To post a comment you must log in.
Revision history for this message
Marcus Tomlinson (marcustomlinson) wrote :

A test failure recently popped up where the child_scopes() method timed out during a ChildScopes test on i386 (https://jenkins.qa.ubuntu.com/job/unity-scopes-api-devel-vivid-i386-autolanding/81/console).

The 500ms two-way timeout seems barely sufficient enough for the child_scopes() and set_child_scopes() methods to successfully read and write to the child-scopes.json file before returning.

This change now allows for these methods to complete within 2s.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Michi Henning (michihenning) wrote :

Looks very clean, thanks!

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Marcus Tomlinson (marcustomlinson) wrote :

Forcing rebuild

Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2015-04-15 15:23:45 +0000
3+++ CMakeLists.txt 2015-05-06 06:12:11 +0000
4@@ -227,7 +227,7 @@
5 # API version
6 set(UNITY_SCOPES_MAJOR 0)
7 set(UNITY_SCOPES_MINOR 6)
8-set(UNITY_SCOPES_MICRO 17)
9+set(UNITY_SCOPES_MICRO 18)
10 set(UNITY_SCOPES_SOVERSION 3)
11
12 # Version for testing, with all symbols visible
13
14=== modified file 'CONFIGFILES'
15--- CONFIGFILES 2015-02-04 07:08:27 +0000
16+++ CONFIGFILES 2015-05-06 06:12:11 +0000
17@@ -248,6 +248,16 @@
18
19 The default value is 5000 milliseconds.
20
21+- ChildScopes.Timeout
22+
23+ The timeout to be used when invoking either child_scopes() or set_child_scopes()
24+ on a scope. These methods require more time to execute than other scope methods
25+ as they read from and write to disk.
26+
27+ Only values in the range 10 to 15000 milliseconds are accepted.
28+
29+ The default value is 2000 milliseconds.
30+
31
32 Registry.ini
33 ------------
34
35=== modified file 'RELEASE_NOTES.md'
36--- RELEASE_NOTES.md 2015-04-15 15:23:45 +0000
37+++ RELEASE_NOTES.md 2015-05-06 06:12:11 +0000
38@@ -1,6 +1,12 @@
39 Release notes
40 =============
41
42+Changes in version 0.6.18
43+=========================
44+ - Allow child_scopes() and set_child_scopes() methods more time to
45+ execute as they read from and write to disk.
46+ - Added ChildScopes.Timeout configuration parameter to Zmq.ini
47+
48 Changes in version 0.6.17
49 =========================
50 - Added is_account_login_result() method to Result class.
51
52=== modified file 'debian/changelog'
53--- debian/changelog 2015-04-23 16:02:37 +0000
54+++ debian/changelog 2015-05-06 06:12:11 +0000
55@@ -1,3 +1,11 @@
56+unity-scopes-api (0.6.18-0ubuntu1) UNRELEASED; urgency=medium
57+
58+ * Allow child_scopes() and set_child_scopes() methods more time to
59+ execute as they read from and write to disk.
60+ * Added ChildScopes.Timeout configuration parameter to Zmq.ini
61+
62+ -- Marcus Tomlinson <marcus.tomlinson@canonical.com> Wed, 06 May 2015 07:47:15 +0200
63+
64 unity-scopes-api (0.6.17+15.04.20150423.2-0ubuntu1) vivid; urgency=medium
65
66 [ Marcus Tomlinson ]
67
68=== modified file 'include/unity/scopes/internal/DfltConfig.h.in'
69--- include/unity/scopes/internal/DfltConfig.h.in 2015-03-02 03:59:01 +0000
70+++ include/unity/scopes/internal/DfltConfig.h.in 2015-05-06 06:12:11 +0000
71@@ -46,12 +46,13 @@
72
73 static constexpr char const* DFLT_SS_SCOPE_IDENTITY = "SmartScope";
74
75-static constexpr int DFLT_REAP_EXPIRY = 45; // seconds
76-static constexpr int DFLT_REAP_INTERVAL = 10; // seconds
77-static constexpr int DFLT_PROCESS_TIMEOUT = 4000; // milliseconds
78-static constexpr int DFLT_ZMQ_TWOWAY_TIMEOUT = 500; // milliseconds
79-static constexpr int DFLT_ZMQ_LOCATE_TIMEOUT = 5000; // milliseconds
80-static constexpr int DFLT_ZMQ_REGISTRY_TIMEOUT = 5000; // milliseconds
81+static constexpr int DFLT_REAP_EXPIRY = 45; // seconds
82+static constexpr int DFLT_REAP_INTERVAL = 10; // seconds
83+static constexpr int DFLT_PROCESS_TIMEOUT = 4000; // milliseconds
84+static constexpr int DFLT_ZMQ_TWOWAY_TIMEOUT = 500; // milliseconds
85+static constexpr int DFLT_ZMQ_LOCATE_TIMEOUT = 5000; // milliseconds
86+static constexpr int DFLT_ZMQ_REGISTRY_TIMEOUT = 5000; // milliseconds
87+static constexpr int DFLT_ZMQ_CHILDSCOPES_TIMEOUT = 2000; // milliseconds
88
89 static constexpr char const* DFLT_HOME_CACHE_SUBDIR = ".local/share/unity-scopes";
90 static constexpr char const* DFLT_HOME_APP_SUBDIR = ".local/share";
91
92=== modified file 'include/unity/scopes/internal/zmq_middleware/ZmqConfig.h'
93--- include/unity/scopes/internal/zmq_middleware/ZmqConfig.h 2014-11-03 05:31:30 +0000
94+++ include/unity/scopes/internal/zmq_middleware/ZmqConfig.h 2015-05-06 06:12:11 +0000
95@@ -39,6 +39,7 @@
96 int twoway_timeout() const;
97 int locate_timeout() const;
98 int registry_timeout() const;
99+ int child_scopes_timeout() const;
100 std::string registry_endpoint_dir() const;
101 std::string ss_registry_endpoint_dir() const;
102
103@@ -47,6 +48,7 @@
104 int twoway_timeout_;
105 int locate_timeout_;
106 int registry_timeout_;
107+ int child_scopes_timeout_;
108 std::string registry_endpoint_dir_;
109 std::string ss_registry_endpoint_dir_;
110 };
111
112=== modified file 'include/unity/scopes/internal/zmq_middleware/ZmqMiddleware.h'
113--- include/unity/scopes/internal/zmq_middleware/ZmqMiddleware.h 2014-12-04 03:33:59 +0000
114+++ include/unity/scopes/internal/zmq_middleware/ZmqMiddleware.h 2015-05-06 06:12:11 +0000
115@@ -94,6 +94,7 @@
116 ThreadPool* twoway_pool();
117 int64_t locate_timeout() const noexcept;
118 int64_t registry_timeout() const noexcept;
119+ int64_t child_scopes_timeout() const noexcept;
120
121 private:
122 ObjectProxy make_typed_proxy(std::string const& endpoint,
123@@ -138,6 +139,7 @@
124 int64_t twoway_timeout_; // Default timeout for twoway invocations
125 int64_t locate_timeout_; // Timeout for registry locate()
126 int64_t registry_timeout_; // Timeout for registry operations other than locate()
127+ int64_t child_scopes_timeout_; // Timeout for child_scopes() and set_child_scopes() methods
128
129 std::string public_endpoint_dir_;
130 std::string private_endpoint_dir_;
131
132=== modified file 'include/unity/scopes/internal/zmq_middleware/ZmqScope.h'
133--- include/unity/scopes/internal/zmq_middleware/ZmqScope.h 2015-03-25 05:52:25 +0000
134+++ include/unity/scopes/internal/zmq_middleware/ZmqScope.h 2015-05-06 06:12:11 +0000
135@@ -70,6 +70,7 @@
136
137 private:
138 ZmqObjectProxy::TwowayOutParams invoke_scope_(capnp::MessageBuilder& in_params);
139+ ZmqObjectProxy::TwowayOutParams invoke_scope_(capnp::MessageBuilder& in_params, int64_t timeout);
140 std::mutex debug_mode_mutex_;
141 std::unique_ptr<bool> debug_mode_;
142 };
143
144=== modified file 'src/scopes/internal/zmq_middleware/ZmqConfig.cpp'
145--- src/scopes/internal/zmq_middleware/ZmqConfig.cpp 2014-08-04 06:31:27 +0000
146+++ src/scopes/internal/zmq_middleware/ZmqConfig.cpp 2015-05-06 06:12:11 +0000
147@@ -42,6 +42,7 @@
148 const string twoway_timeout_key = "Default.Twoway.Timeout";
149 const string locate_timeout_key = "Locate.Timeout";
150 const string registry_timeout_key = "Registry.Timeout";
151+ const string child_scopes_timeout_key = "ChildScopes.Timeout";
152 const string registry_endpoint_dir_key = "Registry.EndpointDir";
153 const string ss_registry_endpoint_dir_key = "Smartscopes.Registry.EndpointDir";
154 }
155@@ -90,6 +91,12 @@
156 throw_ex("Illegal value (" + to_string(locate_timeout_) + ") for " + locate_timeout_key + ": value must be 10-15000");
157 }
158
159+ child_scopes_timeout_ = get_optional_int(zmq_config_group, child_scopes_timeout_key, DFLT_ZMQ_CHILDSCOPES_TIMEOUT);
160+ if (child_scopes_timeout_ < 10 || child_scopes_timeout_ > 15000)
161+ {
162+ throw_ex("Illegal value (" + to_string(child_scopes_timeout_) + ") for " + child_scopes_timeout_key + ": value must be 10-15000");
163+ }
164+
165 registry_endpoint_dir_ = get_optional_string(zmq_config_group, registry_endpoint_dir_key);
166 ss_registry_endpoint_dir_ = get_optional_string(zmq_config_group, ss_registry_endpoint_dir_key);
167
168@@ -100,6 +107,7 @@
169 twoway_timeout_key,
170 locate_timeout_key,
171 registry_timeout_key,
172+ child_scopes_timeout_key,
173 registry_endpoint_dir_key,
174 ss_registry_endpoint_dir_key
175 }
176@@ -132,6 +140,11 @@
177 return registry_timeout_;
178 }
179
180+int ZmqConfig::child_scopes_timeout() const
181+{
182+ return child_scopes_timeout_;
183+}
184+
185 string ZmqConfig::registry_endpoint_dir() const
186 {
187 return registry_endpoint_dir_;
188
189=== modified file 'src/scopes/internal/zmq_middleware/ZmqMiddleware.cpp'
190--- src/scopes/internal/zmq_middleware/ZmqMiddleware.cpp 2015-01-23 05:00:02 +0000
191+++ src/scopes/internal/zmq_middleware/ZmqMiddleware.cpp 2015-05-06 06:12:11 +0000
192@@ -107,6 +107,7 @@
193 twoway_timeout_ = config.twoway_timeout();
194 locate_timeout_ = config.locate_timeout();
195 registry_timeout_ = config.registry_timeout();
196+ child_scopes_timeout_ = config.child_scopes_timeout();
197 public_endpoint_dir_ = config.endpoint_dir();
198 private_endpoint_dir_ = public_endpoint_dir_ + "/priv";
199 registry_endpoint_dir_ = public_endpoint_dir_;
200@@ -814,6 +815,11 @@
201 return registry_timeout_;
202 }
203
204+int64_t ZmqMiddleware::child_scopes_timeout() const noexcept
205+{
206+ return child_scopes_timeout_;
207+}
208+
209 ObjectProxy ZmqMiddleware::make_typed_proxy(string const& endpoint,
210 string const& identity,
211 string const& category,
212
213=== modified file 'src/scopes/internal/zmq_middleware/ZmqScope.cpp'
214--- src/scopes/internal/zmq_middleware/ZmqScope.cpp 2015-04-01 09:28:20 +0000
215+++ src/scopes/internal/zmq_middleware/ZmqScope.cpp 2015-05-06 06:12:11 +0000
216@@ -213,7 +213,8 @@
217 capnp::MallocMessageBuilder request_builder;
218 make_request_(request_builder, "child_scopes");
219
220- auto future = mw_base()->twoway_pool()->submit([&] { return this->invoke_scope_(request_builder); });
221+ int64_t timeout = mw_base()->child_scopes_timeout();
222+ auto future = mw_base()->twoway_pool()->submit([&] { return this->invoke_scope_(request_builder, timeout); });
223
224 auto out_params = future.get();
225 auto response = out_params.reader->getRoot<capnproto::Response>();
226@@ -270,7 +271,8 @@
227 }
228 }
229
230- auto future = mw_base()->twoway_pool()->submit([&] { return this->invoke_scope_(request_builder); });
231+ int64_t timeout = mw_base()->child_scopes_timeout();
232+ auto future = mw_base()->twoway_pool()->submit([&] { return this->invoke_scope_(request_builder, timeout); });
233 auto out_params = future.get();
234 auto r = out_params.reader->getRoot<capnproto::Response>();
235 throw_if_runtime_exception(r);
236@@ -303,13 +305,18 @@
237
238 ZmqObjectProxy::TwowayOutParams ZmqScope::invoke_scope_(capnp::MessageBuilder& in_params)
239 {
240+ return invoke_scope_(in_params, timeout());
241+}
242+
243+ZmqObjectProxy::TwowayOutParams ZmqScope::invoke_scope_(capnp::MessageBuilder& in_params, int64_t timeout)
244+{
245 // Check if this scope has requested debug mode, if so, disable two-way timeout and set
246 // locate timeout to 15s.
247 if (debug_mode())
248 {
249 return this->invoke_twoway_(in_params, -1, 15000);
250 }
251- return this->invoke_twoway_(in_params);
252+ return this->invoke_twoway_(in_params, timeout);
253 }
254
255 } // namespace zmq_middleware

Subscribers

People subscribed via source and target branches

to all changes: