Merge lp:~brianaker/gearmand/fix-exceptions into lp:gearmand

Proposed by Brian Aker on 2013-07-22
Status: Merged
Merged at revision: 841
Proposed branch: lp:~brianaker/gearmand/fix-exceptions
Merge into: lp:gearmand
Diff against target: 248 lines (+26/-29)
5 files modified
libgearman-server/server.cc (+20/-21)
libgearman/job.cc (+0/-6)
libtest/run-ci.gdb (+1/-1)
tests/burnin.cc (+4/-0)
tests/stress.am (+1/-1)
To merge this branch: bzr merge lp:~brianaker/gearmand/fix-exceptions
Reviewer Review Type Date Requested Status
Tangent Trunk 2013-07-22 Pending
Review via email: mp+176294@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libgearman-server/server.cc'
2--- libgearman-server/server.cc 2013-07-16 20:59:59 +0000
3+++ libgearman-server/server.cc 2013-07-22 21:50:44 +0000
4@@ -71,13 +71,14 @@
5 /**
6 * Queue an error packet.
7 */
8-static gearmand_error_t _server_error_packet(gearman_server_con_st *server_con,
9+static gearmand_error_t _server_error_packet(const char *position_, const char *func_,
10+ gearman_server_con_st *server_con,
11 gearman_return_t client_return_code, const char *error_string, const size_t error_string_length)
12 {
13 const char* error_code_string= gearman_strerror(client_return_code);
14 error_code_string+= 8;
15
16- gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "%s:%.*s", gearman_strerror(client_return_code), int(error_string_length), error_string);
17+ gearmand_log_error(position_, func_, "%s:%.*s", gearman_strerror(client_return_code), int(error_string_length), error_string);
18
19 return gearman_server_io_packet_add(server_con, false, GEARMAN_MAGIC_RESPONSE,
20 GEARMAN_COMMAND_ERROR, error_code_string,
21@@ -107,12 +108,12 @@
22
23 if (packet->magic == GEARMAN_MAGIC_RESPONSE)
24 {
25- return _server_error_packet(server_con, GEARMAN_INVALID_MAGIC, gearman_literal_param("Request magic expected"));
26+ return _server_error_packet(GEARMAN_DEFAULT_LOG_PARAM, server_con, GEARMAN_INVALID_MAGIC, gearman_literal_param("Request magic expected"));
27 }
28
29 if (uint32_t(packet->command) >= uint32_t(GEARMAN_COMMAND_MAX))
30 {
31- return _server_error_packet(server_con, GEARMAN_INVALID_COMMAND, gearman_literal_param("Invalid command expected"));
32+ return _server_error_packet(GEARMAN_DEFAULT_LOG_PARAM, server_con, GEARMAN_INVALID_COMMAND, gearman_literal_param("Invalid command expected"));
33 }
34
35 gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM,
36@@ -153,7 +154,7 @@
37 {
38 gearman_server_client_free(server_client);
39 gearmand_gerror("unique value too large", GEARMAND_ARGUMENT_TOO_LARGE);
40- return _server_error_packet(server_con, GEARMAN_ARGUMENT_TOO_LARGE, gearman_literal_param("Unique value too large"));
41+ return _server_error_packet(GEARMAN_DEFAULT_LOG_PARAM, server_con, GEARMAN_ARGUMENT_TOO_LARGE, gearman_literal_param("Unique value too large"));
42 }
43
44 gearman_job_priority_t map_priority= GEARMAN_JOB_PRIORITY_NORMAL;
45@@ -173,13 +174,13 @@
46 else if (ret == GEARMAND_JOB_QUEUE_FULL)
47 {
48 gearman_server_client_free(server_client);
49- return _server_error_packet(server_con, GEARMAN_QUEUE_ERROR, gearman_literal_param("Job queue is full"));
50+ return _server_error_packet(GEARMAN_DEFAULT_LOG_PARAM, server_con, GEARMAN_QUEUE_ERROR, gearman_literal_param("Job queue is full"));
51 }
52 else if (ret != GEARMAND_JOB_EXISTS)
53 {
54 gearman_server_client_free(server_client);
55 gearmand_gerror("gearman_server_job_add", ret);
56- return _server_error_packet(server_con, GEARMAN_QUEUE_ERROR, gearmand_strerror(ret), strlen(gearmand_strerror(ret)));
57+ return _server_error_packet(GEARMAN_DEFAULT_LOG_PARAM, server_con, GEARMAN_QUEUE_ERROR, gearmand_strerror(ret), strlen(gearmand_strerror(ret)));
58 }
59
60 /* Queue the job created packet. */
61@@ -275,7 +276,7 @@
62 {
63 gearmand_gerror("unique value too large", GEARMAND_ARGUMENT_TOO_LARGE);
64 gearman_server_client_free(server_client);
65- return _server_error_packet(server_con, GEARMAN_ARGUMENT_TOO_LARGE, gearman_literal_param("Unique value too large"));
66+ return _server_error_packet(GEARMAN_DEFAULT_LOG_PARAM, server_con, GEARMAN_ARGUMENT_TOO_LARGE, gearman_literal_param("Unique value too large"));
67 }
68
69 /* Schedule job. */
70@@ -293,13 +294,13 @@
71 else if (ret == GEARMAND_JOB_QUEUE_FULL)
72 {
73 gearman_server_client_free(server_client);
74- return _server_error_packet(server_con, GEARMAN_QUEUE_ERROR, gearman_literal_param("Job queue is full"));
75+ return _server_error_packet(GEARMAN_DEFAULT_LOG_PARAM, server_con, GEARMAN_QUEUE_ERROR, gearman_literal_param("Job queue is full"));
76 }
77 else if (ret != GEARMAND_JOB_EXISTS)
78 {
79 gearman_server_client_free(server_client);
80 gearmand_gerror("gearman_server_job_add", ret);
81- return _server_error_packet(server_con, GEARMAN_QUEUE_ERROR, gearmand_strerror(ret), strlen(gearmand_strerror(ret)));
82+ return _server_error_packet(GEARMAN_DEFAULT_LOG_PARAM, server_con, GEARMAN_QUEUE_ERROR, gearmand_strerror(ret), strlen(gearmand_strerror(ret)));
83 }
84
85 /* Queue the job created packet. */
86@@ -492,7 +493,7 @@
87 if (option_length >= GEARMAND_OPTION_SIZE || option_length < 0)
88 {
89 gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "snprintf(%d)", option_length);
90- return _server_error_packet(server_con, GEARMAN_UNKNOWN_OPTION,
91+ return _server_error_packet(GEARMAN_DEFAULT_LOG_PARAM, server_con, GEARMAN_UNKNOWN_OPTION,
92 gearman_literal_param("Server does not recognize given option"));
93 }
94
95@@ -503,7 +504,7 @@
96 }
97 else
98 {
99- return _server_error_packet(server_con, GEARMAN_UNKNOWN_OPTION,
100+ return _server_error_packet(GEARMAN_DEFAULT_LOG_PARAM, server_con, GEARMAN_UNKNOWN_OPTION,
101 gearman_literal_param("Server does not recognize given option"));
102 }
103
104@@ -707,7 +708,7 @@
105 server_con);
106 if (server_job == NULL)
107 {
108- return _server_error_packet(server_con, GEARMAN_JOB_NOT_FOUND, gearman_literal_param("Job does not exist on server"));
109+ return _server_error_packet(GEARMAN_DEFAULT_LOG_PARAM, server_con, GEARMAN_JOB_NOT_FOUND, gearman_literal_param("Job does not exist on server"));
110 }
111
112 /* Queue the data/warning packet for all clients. */
113@@ -728,7 +729,7 @@
114 server_con);
115 if (server_job == NULL)
116 {
117- return _server_error_packet(server_con, GEARMAN_JOB_NOT_FOUND,
118+ return _server_error_packet(GEARMAN_DEFAULT_LOG_PARAM, server_con, GEARMAN_JOB_NOT_FOUND,
119 gearman_literal_param("Job given in work result not found"));
120 }
121
122@@ -778,7 +779,7 @@
123 server_con);
124 if (server_job == NULL)
125 {
126- return _server_error_packet(server_con, GEARMAN_JOB_NOT_FOUND, gearman_literal_param("Job given in work result not found"));
127+ return _server_error_packet(GEARMAN_DEFAULT_LOG_PARAM, server_con, GEARMAN_JOB_NOT_FOUND, gearman_literal_param("Job given in work result not found"));
128 }
129
130 /* Queue the complete packet for all clients. */
131@@ -820,7 +821,7 @@
132 server_job->function->function_name_size, server_job->function->function_name, server_job->function->function_name_size);
133 if (server_job == NULL)
134 {
135- return _server_error_packet(server_con, GEARMAN_JOB_NOT_FOUND,
136+ return _server_error_packet(GEARMAN_DEFAULT_LOG_PARAM, server_con, GEARMAN_JOB_NOT_FOUND,
137 gearman_literal_param("An exception was received for a job that does not exist"));
138 }
139
140@@ -831,7 +832,6 @@
141 return gearmand_gerror("_server_queue_work_data", ret);
142 }
143
144-#if 0
145 /* Remove from persistent queue if one exists. */
146 if (server_job->job_queued)
147 {
148@@ -849,7 +849,6 @@
149
150 /* Job is done, remove it. */
151 gearman_server_job_free(server_job);
152-#endif
153 }
154
155 break;
156@@ -864,7 +863,7 @@
157
158 if (job_handle_length >= GEARMAND_JOB_HANDLE_SIZE || job_handle_length < 0)
159 {
160- return _server_error_packet(server_con, GEARMAN_ARGUMENT_TOO_LARGE,
161+ return _server_error_packet(GEARMAN_DEFAULT_LOG_PARAM, server_con, GEARMAN_ARGUMENT_TOO_LARGE,
162 gearman_literal_param("Error occured due to GEARMAND_JOB_HANDLE_SIZE being too small from snprintf"));
163 }
164
165@@ -872,7 +871,7 @@
166 server_con);
167 if (server_job == NULL)
168 {
169- return _server_error_packet(server_con, GEARMAN_JOB_NOT_FOUND,
170+ return _server_error_packet(GEARMAN_DEFAULT_LOG_PARAM, server_con, GEARMAN_JOB_NOT_FOUND,
171 gearman_literal_param("Job given in work result not found"));
172 }
173
174@@ -937,7 +936,7 @@
175 case GEARMAN_COMMAND_MAX:
176 case GEARMAN_COMMAND_STATUS_RES_UNIQUE:
177 default:
178- return _server_error_packet(server_con, GEARMAN_INVALID_COMMAND, gearman_literal_param("Command not expected"));
179+ return _server_error_packet(GEARMAN_DEFAULT_LOG_PARAM, server_con, GEARMAN_INVALID_COMMAND, gearman_literal_param("Command not expected"));
180 }
181
182 return GEARMAND_SUCCESS;
183
184=== modified file 'libgearman/job.cc'
185--- libgearman/job.cc 2013-07-16 20:59:59 +0000
186+++ libgearman/job.cc 2013-07-22 21:50:44 +0000
187@@ -204,10 +204,6 @@
188 }
189 }
190
191- job->options.assigned_in_use= false;
192- job->options.work_in_use= false;
193- job->options.finished= false;
194-
195 job->reducer= NULL;
196 job->_error_code= GEARMAN_UNKNOWN_STATE;
197
198@@ -542,9 +538,7 @@
199 {
200 return job->error_code();
201 }
202-#if 0
203 job->finished(true);
204-#endif
205 }
206
207 return GEARMAN_SUCCESS;
208
209=== modified file 'libtest/run-ci.gdb'
210--- libtest/run-ci.gdb 2013-05-03 06:03:28 +0000
211+++ libtest/run-ci.gdb 2013-07-22 21:50:44 +0000
212@@ -1,7 +1,7 @@
213 set logging on
214 set logging overwrite on
215 set environment LIBTEST_IN_GDB=1
216-set ASAN_OPTIONS=abort_on_error=1
217+#set ASAN_OPTIONS=abort_on_error=1
218 run
219 thread apply all bt
220 quit
221
222=== modified file 'tests/burnin.cc'
223--- tests/burnin.cc 2013-07-14 23:20:12 +0000
224+++ tests/burnin.cc 2013-07-22 21:50:44 +0000
225@@ -74,6 +74,10 @@
226 Error << "gearman_job_send_exception(" << gearman_strerror(ret) << ")";
227 return GEARMAN_WORK_ERROR;
228 }
229+ else
230+ {
231+ return ret;
232+ }
233 }
234
235 // We will pass back wrong responses from time to time.
236
237=== modified file 'tests/stress.am'
238--- tests/stress.am 2013-07-03 03:54:06 +0000
239+++ tests/stress.am 2013-07-22 21:50:44 +0000
240@@ -19,7 +19,7 @@
241 t_stress_LDADD+= libgearman/libgearman.la
242 t_stress_LDADD+= libtest/libtest.la
243 t_stress_LDADD+= tests/libstartworker.la
244-check_PROGRAMS+=t/stress
245+#check_PROGRAMS+=t/stress
246 noinst_PROGRAMS+=t/stress
247
248 test-stress: t/stress gearmand/gearmand

Subscribers

People subscribed via source and target branches

to all changes: