passenger 6.0.27 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +11 -1
  3. data/CONTRIBUTORS +2 -0
  4. data/bin/passenger-install-apache2-module +6 -3
  5. data/bin/passenger-install-nginx-module +8 -3
  6. data/build/support/cxx_dependency_map.rb +3 -621
  7. data/dev/index_cxx_dependencies.rb +4 -0
  8. data/package.json +1 -1
  9. data/src/agent/Core/ApplicationPool/Implementation.cpp +1 -1
  10. data/src/agent/Core/ApplicationPool/Socket.h +3 -3
  11. data/src/agent/Core/ApplicationPool/TestSession.h +3 -4
  12. data/src/agent/Core/Config.h +1 -6
  13. data/src/agent/Core/Controller/Config.h +1 -1
  14. data/src/agent/Core/CoreMain.cpp +1 -0
  15. data/src/agent/Core/SecurityUpdateChecker.h +10 -1
  16. data/src/agent/Core/SpawningKit/Exceptions.h +0 -1
  17. data/src/agent/Core/SpawningKit/Handshake/Perform.h +13 -2
  18. data/src/agent/Shared/Fundamentals/AbortHandler.cpp +23 -5
  19. data/src/agent/Shared/Fundamentals/AbortHandler.h +10 -22
  20. data/src/agent/Shared/Fundamentals/Initialization.cpp +1 -0
  21. data/src/agent/Watchdog/Config.h +1 -1
  22. data/src/apache2_module/ConfigGeneral/AutoGeneratedDefinitions.cpp +5 -0
  23. data/src/apache2_module/ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.cpp +5 -0
  24. data/src/apache2_module/ConfigGeneral/AutoGeneratedSetterFuncs.cpp +14 -0
  25. data/src/apache2_module/DirConfig/AutoGeneratedCreateFunction.cpp +3 -0
  26. data/src/apache2_module/DirConfig/AutoGeneratedHeaderSerialization.cpp +3 -0
  27. data/src/apache2_module/DirConfig/AutoGeneratedManifestGeneration.cpp +11 -0
  28. data/src/apache2_module/DirConfig/AutoGeneratedMergeFunction.cpp +7 -0
  29. data/src/apache2_module/DirConfig/AutoGeneratedStruct.h +17 -0
  30. data/src/apache2_module/Hooks.cpp +0 -6
  31. data/src/cxx_supportlib/ConfigKit/IN_PRACTICE.md +2 -12
  32. data/src/cxx_supportlib/ConfigKit/Store.h +1 -6
  33. data/src/cxx_supportlib/Constants.h +1 -1
  34. data/src/cxx_supportlib/DataStructures/StringKeyTable.h +1 -7
  35. data/src/cxx_supportlib/Exceptions.cpp +178 -0
  36. data/src/cxx_supportlib/Exceptions.h +62 -177
  37. data/src/cxx_supportlib/IOTools/IOUtils.cpp +255 -228
  38. data/src/cxx_supportlib/IOTools/IOUtils.h +84 -121
  39. data/src/cxx_supportlib/ServerKit/Config.h +1 -6
  40. data/src/cxx_supportlib/ServerKit/FileBufferedChannel.h +1 -1
  41. data/src/cxx_supportlib/StaticString.h +1 -6
  42. data/src/cxx_supportlib/Utils/Curl.h +1 -6
  43. data/src/cxx_supportlib/Utils/ScopeGuard.h +0 -32
  44. data/src/cxx_supportlib/oxt/implementation.cpp +2 -2
  45. data/src/cxx_supportlib/oxt/spin_lock.hpp +94 -23
  46. data/src/ruby_supportlib/phusion_passenger/platform_info/compiler.rb +6 -10
  47. data/src/ruby_supportlib/phusion_passenger/platform_info/cxx_portability.rb +2 -2
  48. data/src/ruby_supportlib/phusion_passenger/rack_handler.rb +2 -2
  49. data/src/ruby_supportlib/phusion_passenger.rb +1 -1
  50. metadata +3 -7
  51. data/src/cxx_supportlib/oxt/detail/spin_lock_darwin.hpp +0 -75
  52. data/src/cxx_supportlib/oxt/detail/spin_lock_gcc_x86.hpp +0 -85
  53. data/src/cxx_supportlib/oxt/detail/spin_lock_portable.hpp +0 -38
  54. data/src/cxx_supportlib/oxt/detail/spin_lock_pthreads.hpp +0 -111
@@ -27,6 +27,9 @@
27
27
  #include <Exceptions.h>
28
28
  #include <stdlib.h>
29
29
  #include <string.h>
30
+ #include <sstream>
31
+ #include <cstring>
32
+ #include <cassert>
30
33
 
31
34
 
32
35
  void
@@ -70,3 +73,178 @@ pp_error_set(const std::exception &ex, PP_Error *error) {
70
73
  error->errnoCode = PP_NO_ERRNO;
71
74
  }
72
75
  }
76
+
77
+
78
+ namespace Passenger {
79
+
80
+ SystemException::SystemException(const string &briefMessage, int errorCode) {
81
+ stringstream str;
82
+ str << strerror(errorCode) << " (errno=" << errorCode << ")";
83
+ systemMessage = str.str();
84
+ setBriefMessage(briefMessage);
85
+ m_code = errorCode;
86
+ }
87
+
88
+ SystemException::~SystemException() noexcept {}
89
+
90
+ const char *
91
+ SystemException::what() const noexcept {
92
+ return fullMessage.c_str();
93
+ }
94
+
95
+ void
96
+ SystemException::setBriefMessage(const string &message) {
97
+ briefMessage = message;
98
+ fullMessage = briefMessage + ": " + systemMessage;
99
+ }
100
+
101
+ int
102
+ SystemException::code() const noexcept {
103
+ return m_code;
104
+ }
105
+
106
+ string
107
+ SystemException::brief() const noexcept {
108
+ return briefMessage;
109
+ }
110
+
111
+ string
112
+ SystemException::sys() const noexcept {
113
+ return systemMessage;
114
+ }
115
+
116
+
117
+ FileSystemException::FileSystemException(const string &message, int errorCode, const string &filename)
118
+ : SystemException(message, errorCode), m_filename(filename) {}
119
+
120
+ FileSystemException::~FileSystemException() noexcept {}
121
+
122
+ string
123
+ FileSystemException::filename() const noexcept {
124
+ return m_filename;
125
+ }
126
+
127
+
128
+ TimeRetrievalException::TimeRetrievalException(const string &message, int errorCode)
129
+ : SystemException(message, errorCode) {}
130
+
131
+ TimeRetrievalException::~TimeRetrievalException() noexcept {}
132
+
133
+
134
+ IOException::IOException(const string &message) : msg(message) {}
135
+
136
+ IOException::~IOException() noexcept {}
137
+
138
+ const char *
139
+ IOException::what() const noexcept {
140
+ return msg.c_str();
141
+ }
142
+
143
+
144
+ FileNotFoundException::FileNotFoundException(const string &message) : IOException(message) {}
145
+
146
+ FileNotFoundException::~FileNotFoundException() noexcept {}
147
+
148
+
149
+ EOFException::EOFException(const string &message) : IOException(message) {}
150
+
151
+ EOFException::~EOFException() noexcept {}
152
+
153
+
154
+ ConfigurationException::ConfigurationException(const string &message) : msg(message) {}
155
+
156
+ ConfigurationException::~ConfigurationException() noexcept {}
157
+
158
+ const char *
159
+ ConfigurationException::what() const noexcept {
160
+ return msg.c_str();
161
+ }
162
+
163
+
164
+ GetAbortedException::GetAbortedException(const string &message) : msg(message) {}
165
+
166
+ GetAbortedException::GetAbortedException(const oxt::tracable_exception::no_backtrace &tag)
167
+ : oxt::tracable_exception(tag) {}
168
+
169
+ GetAbortedException::~GetAbortedException() noexcept {}
170
+
171
+ const char *
172
+ GetAbortedException::what() const noexcept {
173
+ return msg.c_str();
174
+ }
175
+
176
+
177
+ RequestQueueFullException::RequestQueueFullException(unsigned int maxQueueSize)
178
+ : GetAbortedException(oxt::tracable_exception::no_backtrace())
179
+ {
180
+ stringstream str;
181
+ str << "Request queue full (configured max. size: " << maxQueueSize << ")";
182
+ msg = str.str();
183
+ }
184
+
185
+ RequestQueueFullException::~RequestQueueFullException() noexcept {}
186
+
187
+ const char *
188
+ RequestQueueFullException::what() const noexcept {
189
+ return msg.c_str();
190
+ }
191
+
192
+
193
+ ArgumentException::ArgumentException(const string &message) : msg(message) {}
194
+
195
+ ArgumentException::~ArgumentException() noexcept {}
196
+
197
+ const char *
198
+ ArgumentException::what() const noexcept {
199
+ return msg.c_str();
200
+ }
201
+
202
+
203
+ InvalidModeStringException::InvalidModeStringException(const string &message) : ArgumentException(message) {}
204
+
205
+
206
+ RuntimeException::RuntimeException(const string &message) : msg(message) {}
207
+
208
+ RuntimeException::~RuntimeException() noexcept {}
209
+
210
+ const char *
211
+ RuntimeException::what() const noexcept {
212
+ return msg.c_str();
213
+ }
214
+
215
+
216
+ TimeoutException::TimeoutException(const string &message) : msg(message) {}
217
+
218
+ TimeoutException::~TimeoutException() noexcept {}
219
+
220
+ const char *
221
+ TimeoutException::what() const noexcept {
222
+ return msg.c_str();
223
+ }
224
+
225
+
226
+ SecurityException::SecurityException(const string &message) : msg(message) {}
227
+
228
+ SecurityException::~SecurityException() noexcept {}
229
+
230
+ const char *
231
+ SecurityException::what() const noexcept {
232
+ return msg.c_str();
233
+ }
234
+
235
+
236
+ NonExistentUserException::NonExistentUserException(const string &message) : SecurityException(message) {}
237
+
238
+ NonExistentGroupException::NonExistentGroupException(const string &message) : SecurityException(message) {}
239
+
240
+
241
+ SyntaxError::SyntaxError(const string &message) : msg(message) {}
242
+
243
+ SyntaxError::~SyntaxError() noexcept {}
244
+
245
+ const char *
246
+ SyntaxError::what() const noexcept {
247
+ return msg.c_str();
248
+ }
249
+
250
+ } // namespace Passenger
@@ -62,9 +62,6 @@ void pp_error_destroy(PP_Error *error);
62
62
  #include <oxt/tracable_exception.hpp>
63
63
  #include <string>
64
64
  #include <exception>
65
- #include <sstream>
66
- #include <cstring>
67
- #include <cassert>
68
65
 
69
66
 
70
67
  /**
@@ -79,21 +76,15 @@ void pp_error_destroy(PP_Error *error);
79
76
  void pp_error_set(const std::exception &ex, PP_Error *error);
80
77
 
81
78
 
82
- /**
83
- * @defgroup Exceptions Exceptions
84
- */
85
-
86
79
  namespace Passenger {
87
80
 
88
81
  using namespace std;
89
82
 
90
83
  /**
91
- * Represents an error returned by a system call or a standard library call.
84
+ * An error returned by a system call or a standard library call.
92
85
  *
93
- * Use the code() method to find out the value of <tt>errno</tt> at the time
86
+ * Use `code()` to find out the value of `errno` at the time
94
87
  * the error occured.
95
- *
96
- * @ingroup Exceptions
97
88
  */
98
89
  class SystemException: public oxt::tracable_exception {
99
90
  private:
@@ -101,6 +92,7 @@ private:
101
92
  string systemMessage;
102
93
  string fullMessage;
103
94
  int m_code;
95
+
104
96
  public:
105
97
  /**
106
98
  * Create a new SystemException.
@@ -114,138 +106,83 @@ public:
114
106
  * @post code() == errorCode
115
107
  * @post brief() == briefMessage
116
108
  */
117
- SystemException(const string &briefMessage, int errorCode) {
118
- stringstream str;
119
-
120
- str << strerror(errorCode) << " (errno=" << errorCode << ")";
121
- systemMessage = str.str();
122
-
123
- setBriefMessage(briefMessage);
124
- m_code = errorCode;
125
- }
126
-
127
- virtual ~SystemException() throw() {}
128
-
129
- virtual const char *what() const throw() {
130
- return fullMessage.c_str();
131
- }
132
-
133
- void setBriefMessage(const string &message) {
134
- briefMessage = message;
135
- fullMessage = briefMessage + ": " + systemMessage;
136
- }
137
-
138
- /**
139
- * The value of <tt>errno</tt> at the time the error occured.
140
- */
141
- int code() const throw() {
142
- return m_code;
143
- }
144
-
145
- /**
146
- * Returns a brief version of the exception message. This message does
147
- * not include the system error description, and is equivalent to the
148
- * value of the <tt>message</tt> parameter as passed to the constructor.
149
- */
150
- string brief() const throw() {
151
- return briefMessage;
152
- }
153
-
154
- /**
155
- * Returns the system's error message. This message contains both the
156
- * content of <tt>strerror(errno)</tt> and the errno number itself.
157
- */
158
- string sys() const throw() {
159
- return systemMessage;
160
- }
109
+ SystemException(const string &briefMessage, int errorCode);
110
+ virtual ~SystemException() noexcept;
111
+ virtual const char *what() const noexcept;
112
+ void setBriefMessage(const string &message);
113
+ int code() const noexcept;
114
+ string brief() const noexcept;
115
+ string sys() const noexcept;
161
116
  };
162
117
 
163
118
  /**
164
119
  * A filesystem error, as returned by the operating system. This may include,
165
120
  * for example, permission errors.
166
- *
167
- * @ingroup Exceptions
168
121
  */
169
122
  class FileSystemException: public SystemException {
170
123
  private:
171
124
  string m_filename;
172
- public:
173
- FileSystemException(const string &message, int errorCode,
174
- const string &filename)
175
- : SystemException(message, errorCode),
176
- m_filename(filename) {}
177
-
178
- virtual ~FileSystemException() throw() {}
179
125
 
180
- /**
181
- * The filename that's associated to the error.
182
- */
183
- string filename() const throw() {
184
- return m_filename;
185
- }
126
+ public:
127
+ FileSystemException(const string &message, int errorCode, const string &filename);
128
+ virtual ~FileSystemException() noexcept;
129
+ string filename() const noexcept;
186
130
  };
187
131
 
188
132
  /**
189
133
  * Unable to retrieve the system time using <tt>time()</tt>.
190
- *
191
- * @ingroup Exceptions
192
134
  */
193
135
  class TimeRetrievalException: public SystemException {
194
136
  public:
195
- TimeRetrievalException(const string &message, int errorCode)
196
- : SystemException(message, errorCode)
197
- {}
198
- virtual ~TimeRetrievalException() throw() {}
137
+ TimeRetrievalException(const string &message, int errorCode);
138
+ virtual ~TimeRetrievalException() noexcept;
199
139
  };
200
140
 
201
141
  /**
202
- * Represents an error that occured during an I/O operation.
203
- *
204
- * @ingroup Exceptions
142
+ * Error during an I/O operation.
205
143
  */
206
144
  class IOException: public oxt::tracable_exception {
207
145
  private:
208
146
  string msg;
147
+
209
148
  public:
210
- IOException(const string &message): msg(message) {}
211
- virtual ~IOException() throw() {}
212
- virtual const char *what() const throw() { return msg.c_str(); }
149
+ IOException(const string &message);
150
+ virtual ~IOException() noexcept;
151
+ virtual const char *what() const noexcept;
213
152
  };
214
153
 
215
154
  /**
216
- * Thrown when a certain file cannot be found.
155
+ * Certain file cannot be found.
217
156
  */
218
157
  class FileNotFoundException: public IOException {
219
158
  public:
220
- FileNotFoundException(const string &message): IOException(message) {}
221
- virtual ~FileNotFoundException() throw() {}
159
+ FileNotFoundException(const string &message);
160
+ virtual ~FileNotFoundException() noexcept;
222
161
  };
223
162
 
224
163
  /**
225
- * An unexpected end-of-file I/O error.
226
- *
227
- * @ingroup Exceptions
164
+ * Unexpected end-of-file I/O error.
228
165
  */
229
166
  class EOFException: public IOException {
230
167
  public:
231
- EOFException(const string &message): IOException(message) {}
232
- virtual ~EOFException() throw() {}
168
+ EOFException(const string &message);
169
+ virtual ~EOFException() noexcept;
233
170
  };
234
171
 
235
172
  /**
236
- * Thrown when an invalid configuration is given.
173
+ * Invalid configuration is given.
237
174
  */
238
175
  class ConfigurationException: public oxt::tracable_exception {
239
176
  private:
240
177
  string msg;
241
178
  public:
242
- ConfigurationException(const string &message): msg(message) {}
243
- virtual ~ConfigurationException() throw() {}
244
- virtual const char *what() const throw() { return msg.c_str(); }
179
+ ConfigurationException(const string &message);
180
+ virtual ~ConfigurationException() noexcept;
181
+ virtual const char *what() const noexcept;
245
182
  };
246
183
 
247
184
  /**
248
- * Indicates that a Pool::get() or Pool::asyncGet() request was denied.
185
+ * A Pool::get() or Pool::asyncGet() request was denied.
249
186
  * The request never reached a process. This could be because, before the
250
187
  * request could reach a process, the administrator detached the containing
251
188
  * group. Or maybe the request sat in the queue for too long.
@@ -255,23 +192,14 @@ private:
255
192
  string msg;
256
193
 
257
194
  public:
258
- GetAbortedException(const string &message)
259
- : msg(message)
260
- { }
261
-
262
- GetAbortedException(const oxt::tracable_exception::no_backtrace &tag)
263
- : oxt::tracable_exception(tag)
264
- { }
265
-
266
- virtual ~GetAbortedException() throw() {}
267
-
268
- virtual const char *what() const throw() {
269
- return msg.c_str();
270
- }
195
+ GetAbortedException(const string &message);
196
+ GetAbortedException(const oxt::tracable_exception::no_backtrace &tag);
197
+ virtual ~GetAbortedException() noexcept;
198
+ virtual const char *what() const noexcept;
271
199
  };
272
200
 
273
201
  /**
274
- * Indicates that a Pool::get() or Pool::asyncGet() request was denied because
202
+ * A Pool::get() or Pool::asyncGet() request was denied because
275
203
  * the getWaitlist queue was full.
276
204
  */
277
205
  class RequestQueueFullException: public GetAbortedException {
@@ -279,127 +207,84 @@ private:
279
207
  string msg;
280
208
 
281
209
  public:
282
- RequestQueueFullException(unsigned int maxQueueSize)
283
- : GetAbortedException(oxt::tracable_exception::no_backtrace())
284
- {
285
- stringstream str;
286
- str << "Request queue full (configured max. size: " << maxQueueSize << ")";
287
- msg = str.str();
288
- }
289
-
290
- virtual ~RequestQueueFullException() throw() {}
291
-
292
- virtual const char *what() const throw() {
293
- return msg.c_str();
294
- }
210
+ RequestQueueFullException(unsigned int maxQueueSize);
211
+ virtual ~RequestQueueFullException() noexcept;
212
+ virtual const char *what() const noexcept;
295
213
  };
296
214
 
297
215
  /**
298
- * Indicates that a specified argument is incorrect or violates a requirement.
299
- *
300
- * @ingroup Exceptions
216
+ * A specified argument is incorrect or violates a requirement.
301
217
  */
302
218
  class ArgumentException: public oxt::tracable_exception {
303
219
  private:
304
220
  string msg;
305
221
  public:
306
- ArgumentException(const string &message): msg(message) {}
307
- virtual ~ArgumentException() throw() {}
308
- virtual const char *what() const throw() { return msg.c_str(); }
222
+ ArgumentException(const string &message);
223
+ virtual ~ArgumentException() noexcept;
224
+ virtual const char *what() const noexcept;
309
225
  };
310
226
 
311
- /*
312
- * @ingroup Exceptions
313
- */
314
227
  class InvalidModeStringException: public ArgumentException {
315
228
  public:
316
- InvalidModeStringException(const string &message): ArgumentException(message) {}
229
+ InvalidModeStringException(const string &message);
317
230
  };
318
231
 
319
232
  /**
320
- * A generic runtime exception.
321
- *
322
- * @ingroup Exceptions
233
+ * Generic runtime exception.
323
234
  */
324
235
  class RuntimeException: public oxt::tracable_exception {
325
236
  private:
326
237
  string msg;
327
238
  public:
328
- RuntimeException(const string &message): msg(message) {}
329
- virtual ~RuntimeException() throw() {}
330
- virtual const char *what() const throw() { return msg.c_str(); }
239
+ RuntimeException(const string &message);
240
+ virtual ~RuntimeException() noexcept;
241
+ virtual const char *what() const noexcept;
331
242
  };
332
243
 
333
244
  /**
334
- * An exception indicating that some timeout expired.
335
- *
336
- * @ingroup Exceptions
245
+ * Some timeout expired.
337
246
  */
338
247
  class TimeoutException: public oxt::tracable_exception {
339
248
  private:
340
249
  string msg;
341
250
  public:
342
- TimeoutException(const string &message): msg(message) {}
343
- virtual ~TimeoutException() throw() {}
344
- virtual const char *what() const throw() { return msg.c_str(); }
251
+ TimeoutException(const string &message);
252
+ virtual ~TimeoutException() noexcept;
253
+ virtual const char *what() const noexcept;
345
254
  };
346
255
 
347
256
  /**
348
- * Represents some kind of security error.
349
- *
350
- * @ingroup Exceptions
257
+ * Some kind of security error.
351
258
  */
352
259
  class SecurityException: public oxt::tracable_exception {
353
260
  private:
354
261
  string msg;
355
262
  public:
356
- SecurityException(const string &message): msg(message) {}
357
- virtual ~SecurityException() throw() {}
358
- virtual const char *what() const throw() { return msg.c_str(); }
263
+ SecurityException(const string &message);
264
+ virtual ~SecurityException() noexcept;
265
+ virtual const char *what() const noexcept;
359
266
  };
360
267
 
361
- /**
362
- * @ingroup Exceptions
363
- */
364
268
  class NonExistentUserException: public SecurityException {
365
269
  public:
366
- NonExistentUserException(const string &message): SecurityException(message) {}
270
+ NonExistentUserException(const string &message);
367
271
  };
368
272
 
369
- /**
370
- * @ingroup Exceptions
371
- */
372
273
  class NonExistentGroupException: public SecurityException {
373
274
  public:
374
- NonExistentGroupException(const string &message): SecurityException(message) {}
375
- };
376
-
377
- /**
378
- * The application pool is too busy and cannot fulfill a get() request.
379
- *
380
- * @ingroup Exceptions
381
- */
382
- class BusyException: public oxt::tracable_exception {
383
- private:
384
- string msg;
385
- public:
386
- BusyException(const string &message): msg(message) {}
387
- virtual ~BusyException() throw() {}
388
- virtual const char *what() const throw() { return msg.c_str(); }
275
+ NonExistentGroupException(const string &message);
389
276
  };
390
277
 
391
278
  /**
392
279
  * A parser detected a syntax error.
393
- *
394
- * @ingroup Exceptions
395
280
  */
396
281
  class SyntaxError: public oxt::tracable_exception {
397
282
  private:
398
283
  string msg;
399
284
  public:
400
- SyntaxError(const string &message): msg(message) {}
401
- virtual ~SyntaxError() throw() {}
402
- virtual const char *what() const throw() { return msg.c_str(); }
285
+ SyntaxError(const string &message);
286
+ virtual ~SyntaxError() noexcept;
287
+ virtual const char *what() const noexcept;
403
288
  };
404
289
 
405
290
  } // namespace Passenger