We got nominated! Help us out and vote for GitHub as Best Bootstrapped Startup of 2008. (You can vote once a day.) [ hide ]

public
Description: Phusion Passenger (mod_rails)
Homepage: http://www.modrails.com/
Clone URL: git://github.com/FooBarWidget/passenger.git
Click here to lend your support to: passenger and make a donation at www.pledgie.com !
The semantics of the spawner server timeout values have changed: 0 now 
means never timeout while -1 means use default timeout. Update 
SpawnOptions, Hooks and Configuration accordingly.
Hongli Lai (Phusion) (author)
Sat Aug 02 05:21:08 -0700 2008
commit  2d1ec2e0270b733dc02320290cc55fbc2e245a44
tree    1999d17c5f745eabef5524bc264178173bd022c9
parent  7459af6797858bc77692f6722d83ccfb61159ecc
...
163
164
165
 
166
167
168
...
163
164
165
166
167
168
169
0
@@ -163,6 +163,7 @@ subdir 'ext/apache2' do
0
     'StandardApplicationPool.h',
0
     'MessageChannel.h',
0
     'SpawnManager.h',
0
+ 'SpawnOptions.h',
0
     'Utils.o',
0
     'Logging.o'
0
   ] do
...
671
672
673
674
675
676
677
...
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
 
 
719
720
721
...
671
672
673
 
674
675
676
...
699
700
701
 
 
 
 
 
 
 
 
 
 
702
703
704
705
706
 
707
708
709
710
711
0
@@ -671,7 +671,6 @@ public:
0
       UPDATE_TRACE_POINT();
0
       try {
0
         const char *defaultUser, *environment, *spawnMethod;
0
- unsigned int appSpawnerTimeout, frameworkSpawnerTimeout;
0
         ServerConfig *sconfig;
0
         
0
         sconfig = getServerConfig(r->server);
0
@@ -700,22 +699,13 @@ public:
0
         } else {
0
           spawnMethod = "smart";
0
         }
0
- if (config->frameworkSpawnerTimeout < 0) {
0
- frameworkSpawnerTimeout = 0;
0
- } else {
0
- frameworkSpawnerTimeout = config->frameworkSpawnerTimeout;
0
- }
0
- if (config->appSpawnerTimeout < 0) {
0
- appSpawnerTimeout = 0;
0
- } else {
0
- appSpawnerTimeout = config->appSpawnerTimeout;
0
- }
0
         
0
         session = applicationPool->get(SpawnOptions(
0
           canonicalizePath(mapper.getPublicDirectory() + "/.."),
0
           true, defaultUser, environment, spawnMethod,
0
           mapper.getApplicationTypeString(),
0
- appSpawnerTimeout, frameworkSpawnerTimeout));
0
+ config->appSpawnerTimeout,
0
+ config->frameworkSpawnerTimeout));
0
         P_TRACE(3, "Forwarding " << r->uri << " to PID " << session->getPid());
0
       } catch (const SpawnException &e) {
0
         if (e.hasErrorPage()) {
...
86
87
88
89
 
 
90
91
92
93
94
95
 
96
97
98
99
 
 
100
101
102
103
104
105
 
106
107
108
109
110
111
 
112
113
114
...
120
121
122
123
124
 
 
125
126
127
...
134
135
136
137
138
139
 
 
 
140
141
142
...
174
175
176
177
178
179
 
 
 
180
181
182
...
196
197
198
199
 
200
201
202
...
213
214
215
216
 
 
 
 
 
 
 
217
218
219
...
86
87
88
 
89
90
91
92
93
94
95
 
96
97
98
99
 
100
101
102
103
104
105
106
 
107
108
109
110
111
112
 
113
114
115
116
...
122
123
124
 
 
125
126
127
128
129
...
136
137
138
 
 
 
139
140
141
142
143
144
...
176
177
178
 
 
 
179
180
181
182
183
184
...
198
199
200
 
201
202
203
204
...
215
216
217
 
218
219
220
221
222
223
224
225
226
227
0
@@ -86,29 +86,31 @@ struct SpawnOptions {
0
   
0
   /**
0
    * The idle timeout, in seconds, of Rails framework spawners.
0
- * Set to 0 to use the default idle time.
0
+ * A timeout of 0 means that the framework spawner should never idle timeout. A timeout
0
+ * of -1 means that the default timeout value should be used.
0
    *
0
    * For more details about Rails framework spawners, please
0
    * read the documentation on the Railz::FrameworkSpawner
0
    * Ruby class.
0
    */
0
- unsigned int frameworkSpawnerTimeout;
0
+ long frameworkSpawnerTimeout;
0
   
0
   /**
0
    * The idle timeout, in seconds, of Rails application spawners.
0
- * Set to 0 to use the default idle time.
0
+ * A timeout of 0 means that the application spawner should never idle timeout. A timeout
0
+ * of -1 means that the default timeout value should be used.
0
    *
0
    * For more details about Rails application spawners, please
0
    * read the documentation on the Railz::ApplicationSpawner
0
    * Ruby class.
0
    */
0
- unsigned int appSpawnerTimeout;
0
+ long appSpawnerTimeout;
0
   
0
   /**
0
    * The maximum number of requests that the spawned application may process
0
    * before exiting. A value of 0 means unlimited.
0
    */
0
- unsigned int maxRequests;
0
+ unsigned long maxRequests;
0
   
0
   /**
0
    * Creates a new SpawnOptions object with the default values filled in.
0
@@ -120,8 +122,8 @@ struct SpawnOptions {
0
     environment = "production";
0
     spawnMethod = "smart";
0
     appType = "rails";
0
- frameworkSpawnerTimeout = 0;
0
- appSpawnerTimeout = 0;
0
+ frameworkSpawnerTimeout = -1;
0
+ appSpawnerTimeout = -1;
0
     maxRequests = 0;
0
   }
0
   
0
@@ -134,9 +136,9 @@ struct SpawnOptions {
0
     const string &environment = "production",
0
     const string &spawnMethod = "smart",
0
     const string &appType = "rails",
0
- unsigned int frameworkSpawnerTimeout = 0,
0
- unsigned int appSpawnerTimeout = 0,
0
- unsigned int maxRequests = 0) {
0
+ long frameworkSpawnerTimeout = -1,
0
+ long appSpawnerTimeout = -1,
0
+ unsigned long maxRequests = 0) {
0
     this->appRoot = appRoot;
0
     this->lowerPrivilege = lowerPrivilege;
0
     this->lowestUser = lowestUser;
0
@@ -174,9 +176,9 @@ struct SpawnOptions {
0
     environment = vec[startIndex + 7];
0
     spawnMethod = vec[startIndex + 9];
0
     appType = vec[startIndex + 11];
0
- frameworkSpawnerTimeout = atoi(vec[startIndex + 13]);
0
- appSpawnerTimeout = atoi(vec[startIndex + 15]);
0
- maxRequests = atoi(vec[startIndex + 17]);
0
+ frameworkSpawnerTimeout = atol(vec[startIndex + 13]);
0
+ appSpawnerTimeout = atol(vec[startIndex + 15]);
0
+ maxRequests = atol(vec[startIndex + 17]);
0
   }
0
   
0
   /**
0
@@ -196,7 +198,7 @@ struct SpawnOptions {
0
     appendKeyValue (vec, "app_type", appType);
0
     appendKeyValue2(vec, "framework_spawner_timeout", frameworkSpawnerTimeout);
0
     appendKeyValue2(vec, "app_spawner_timeout", appSpawnerTimeout);
0
- appendKeyValue2(vec, "max_requests", 0);
0
+ appendKeyValue3(vec, "max_requests", 0);
0
   }
0
 
0
 private:
0
@@ -213,7 +215,13 @@ private:
0
   }
0
   
0
   static inline void
0
- appendKeyValue2(vector<string> &vec, const char *key, unsigned int value) {
0
+ appendKeyValue2(vector<string> &vec, const char *key, long value) {
0
+ vec.push_back(key);
0
+ vec.push_back(toString(value));
0
+ }
0
+
0
+ static inline void
0
+ appendKeyValue3(vector<string> &vec, const char *key, unsigned long value) {
0
     vec.push_back(key);
0
     vec.push_back(toString(value));
0
   }
...
31
32
33
 
 
 
 
 
34
35
36
...
31
32
33
34
35
36
37
38
39
40
41
0
@@ -31,6 +31,11 @@ atoi(const string &s) {
0
   return ::atoi(s.c_str());
0
 }
0
 
0
+long
0
+atol(const string &s) {
0
+ return ::atol(s.c_str());
0
+}
0
+
0
 void
0
 split(const string &str, char sep, vector<string> &output) {
0
   string::size_type start, pos;
...
119
120
121
 
 
 
 
 
 
122
123
124
...
119
120
121
122
123
124
125
126
127
128
129
130
0
@@ -119,6 +119,12 @@ toString(T something) {
0
 int atoi(const string &s);
0
 
0
 /**
0
+ * Converts the given string to a long integer.
0
+ * @ingroup Support
0
+ */
0
+long atol(const string &s);
0
+
0
+/**
0
  * Split the given string using the given separator.
0
  *
0
  * @param str The string to split.

Comments

    No one has commented yet.