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 !
Improve autoloading efficiency. Fix CHLD trap warnings in 
spawn_manager_spec.
Hongli Lai (Phusion) (author)
Thu May 08 04:30:24 -0700 2008
commit  13a23f52e1a617dad2543f17537699db571de7ae
tree    eee1f32fed5cca718374eb19d8d9e7c1e0eadcf4
parent  06570e0b3627795261abfe3419a454b846e75da2
...
15
16
17
18
19
20
21
22
...
15
16
17
 
 
18
19
20
0
@@ -15,8 +15,6 @@
0
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
0
 
0
 require 'rubygems'
0
-require 'socket'
0
-require 'pathname'
0
 require 'passenger/passenger'
0
 module Passenger
0
 
...
79
80
81
 
 
 
 
 
 
 
 
 
82
83
 
84
85
86
...
240
241
242
 
 
 
 
243
244
245
...
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
...
250
251
252
253
254
255
256
257
258
259
0
@@ -79,8 +79,18 @@ class SpawnManager < AbstractServer
0
   def spawn_application(app_root, lower_privilege = true, lowest_user = "nobody",
0
    environment = "production", spawn_method = "smart")
0
     if GC.copy_on_write_friendly?
0
+ # If the garbage collector is copy-on-write friendly, then we'll
0
+ # want to preload all Passenger classes (before any spawn servers have
0
+ # been started), for copy-on-write semantics.
0
+ #
0
+ # On the other hand, if the garbage collector is *not* copy-on-write
0
+ # friendly, then we'll want to load Passenger classes after we've
0
+ # spawned an application. This increases perceived speed of the first spawn
0
+ # operation, and increases actual speed for subsequently created spawn
0
+ # servers (because they don't have to load classes on-demand anymore).
0
       Passenger.load_all_classes!
0
     end
0
+
0
     if spawn_method == "smart"
0
       spawner_must_be_started = true
0
       framework_version = Application.detect_framework_version(app_root)
0
@@ -240,6 +250,10 @@ private
0
       client.send_io(app.owner_pipe)
0
       app.close
0
     end
0
+ if !GC.copy_on_write_friendly?
0
+ # See the comment associated with the other load_all_classes! call.
0
+ Passenger.load_all_classes!
0
+ end
0
   end
0
   
0
   def handle_reload(app_root)
...
15
16
17
18
19
20
21
22
23
24
25
...
34
35
36
 
37
38
39
...
64
65
66
 
67
68
69
...
71
72
73
 
74
75
76
...
173
174
175
 
176
177
178
...
188
189
190
 
191
192
193
...
15
16
17
 
 
18
19
 
20
21
22
...
31
32
33
34
35
36
37
...
62
63
64
65
66
67
68
...
70
71
72
73
74
75
76
...
173
174
175
176
177
178
179
...
189
190
191
192
193
194
195
0
@@ -15,11 +15,8 @@
0
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
0
 
0
 require 'rubygems'
0
-require 'pathname'
0
-require 'etc'
0
 require 'thread'
0
 require 'fastthread'
0
-require 'timeout'
0
 require 'passenger/passenger'
0
 
0
 module Passenger
0
@@ -34,6 +31,7 @@ protected
0
   # Raises SystemCallError if something went wrong. Raises ArgumentError
0
   # if +path+ is nil.
0
   def normalize_path(path)
0
+ require 'pathname' unless defined?(Pathname)
0
     raise ArgumentError, "The 'path' argument may not be nil" if path.nil?
0
     return Pathname.new(path).realpath.to_s
0
   rescue Errno::ENOENT => e
0
@@ -64,6 +62,7 @@ protected
0
   # Assert that +username+ is a valid username. Raises
0
   # ArgumentError if that is not the case.
0
   def assert_valid_username(username)
0
+ require 'etc' unless defined?(Etc)
0
     # If username does not exist then getpwnam() will raise an ArgumentError.
0
     username && Etc.getpwnam(username)
0
   end
0
@@ -71,6 +70,7 @@ protected
0
   # Assert that +groupname+ is a valid group name. Raises
0
   # ArgumentError if that is not the case.
0
   def assert_valid_groupname(groupname)
0
+ require 'etc' unless defined?(Etc)
0
     # If groupname does not exist then getgrnam() will raise an ArgumentError.
0
     groupname && Etc.getgrnam(groupname)
0
   end
0
@@ -173,6 +173,7 @@ class ConditionVariable
0
   # amount of time. Returns true if this condition was signaled, false if a
0
   # timeout occurred.
0
   def timed_wait(mutex, secs)
0
+ require 'timeout' unless defined?(Timeout)
0
     if secs > 0
0
       Timeout.timeout(secs) do
0
         wait(mutex)
0
@@ -188,6 +189,7 @@ class ConditionVariable
0
   # This is like ConditionVariable.wait(), but allows one to wait a maximum
0
   # amount of time. Raises Timeout::Error if the timeout has elapsed.
0
   def timed_wait!(mutex, secs)
0
+ require 'timeout' unless defined?(Timeout)
0
     if secs > 0
0
       Timeout.timeout(secs) do
0
         wait(mutex)

Comments

    No one has commented yet.