passenger 4.0.2 → 4.0.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of passenger might be problematic. Click here for more details.

Files changed (79) hide show
  1. data.tar.gz.asc +7 -7
  2. data/NEWS +27 -0
  3. data/bin/passenger-config +6 -3
  4. data/bin/passenger-install-apache2-module +2 -2
  5. data/bin/passenger-install-nginx-module +16 -2
  6. data/build/agents.rb +4 -0
  7. data/build/apache2.rb +1 -1
  8. data/build/cplusplus_support.rb +1 -1
  9. data/build/cxx_tests.rb +3 -0
  10. data/build/packaging.rb +51 -8
  11. data/build/ruby_extension.rb +1 -1
  12. data/doc/Packaging.txt.md +20 -7
  13. data/doc/Users guide Apache.html +1 -1
  14. data/doc/Users guide Apache.txt +1 -1
  15. data/doc/Users guide Nginx.html +5 -4
  16. data/doc/Users guide Nginx.txt +1 -1
  17. data/doc/users_guide_snippets/installation.txt +5 -3
  18. data/ext/apache2/Configuration.cpp +12 -0
  19. data/ext/apache2/Configuration.hpp +7 -4
  20. data/ext/apache2/Hooks.cpp +29 -19
  21. data/ext/common/AgentsStarter.cpp +85 -57
  22. data/ext/common/AgentsStarter.h +570 -42
  23. data/ext/common/ApplicationPool2/DirectSpawner.h +5 -2
  24. data/ext/common/ApplicationPool2/Implementation.cpp +7 -1
  25. data/ext/common/ApplicationPool2/Pool.h +6 -3
  26. data/ext/common/ApplicationPool2/Process.h +12 -3
  27. data/ext/common/ApplicationPool2/SmartSpawner.h +2 -1
  28. data/ext/common/Constants.h +4 -1
  29. data/ext/common/EventedBufferedInput.h +139 -16
  30. data/ext/common/MultiLibeio.cpp +4 -2
  31. data/ext/common/SafeLibev.h +15 -62
  32. data/ext/common/ServerInstanceDir.h +10 -26
  33. data/ext/common/Utils.cpp +1 -3
  34. data/ext/common/Utils.h +1 -1
  35. data/ext/common/Utils/StrIntUtils.cpp +9 -0
  36. data/ext/common/Utils/StrIntUtils.h +5 -0
  37. data/ext/common/Utils/VariantMap.h +63 -14
  38. data/ext/common/agents/Base.cpp +50 -15
  39. data/ext/common/agents/HelperAgent/AgentOptions.h +20 -12
  40. data/ext/common/agents/HelperAgent/FileBackedPipe.h +1 -1
  41. data/ext/common/agents/HelperAgent/Main.cpp +5 -4
  42. data/ext/common/agents/HelperAgent/RequestHandler.h +1 -1
  43. data/ext/common/agents/LoggingAgent/Main.cpp +0 -1
  44. data/ext/common/agents/LoggingAgent/RemoteSender.h +2 -2
  45. data/ext/common/agents/SpawnPreparer.cpp +23 -5
  46. data/ext/common/agents/Watchdog/AgentWatcher.cpp +508 -0
  47. data/ext/common/agents/Watchdog/HelperAgentWatcher.cpp +93 -0
  48. data/ext/common/agents/Watchdog/LoggingAgentWatcher.cpp +68 -0
  49. data/ext/common/agents/Watchdog/Main.cpp +180 -802
  50. data/ext/common/agents/Watchdog/ServerInstanceDirToucher.cpp +111 -0
  51. data/ext/nginx/Configuration.c +107 -92
  52. data/ext/nginx/Configuration.h +1 -0
  53. data/ext/nginx/ContentHandler.c +6 -6
  54. data/ext/nginx/ContentHandler.h +1 -1
  55. data/ext/nginx/config +8 -2
  56. data/ext/nginx/ngx_http_passenger_module.c +54 -60
  57. data/ext/nginx/ngx_http_passenger_module.h +6 -6
  58. data/lib/phusion_passenger.rb +17 -10
  59. data/lib/phusion_passenger/admin_tools/server_instance.rb +2 -2
  60. data/lib/phusion_passenger/common_library.rb +0 -1
  61. data/lib/phusion_passenger/platform_info.rb +10 -1
  62. data/lib/phusion_passenger/platform_info/depcheck.rb +4 -4
  63. data/lib/phusion_passenger/platform_info/depcheck_specs/compiler_toolchain.rb +2 -2
  64. data/lib/phusion_passenger/platform_info/ruby.rb +7 -0
  65. data/lib/phusion_passenger/request_handler.rb +119 -42
  66. data/lib/phusion_passenger/request_handler/thread_handler.rb +25 -22
  67. data/lib/phusion_passenger/standalone/command.rb +2 -0
  68. data/lib/phusion_passenger/standalone/runtime_installer.rb +4 -3
  69. data/lib/phusion_passenger/standalone/start_command.rb +49 -37
  70. data/resources/templates/nginx/pcre_checksum_could_not_be_verified.txt.erb +11 -0
  71. data/test/cxx/CxxTestMain.cpp +2 -0
  72. data/test/cxx/EventedBufferedInputTest.cpp +758 -0
  73. data/test/cxx/ServerInstanceDirTest.cpp +16 -31
  74. data/test/cxx/TestSupport.cpp +2 -1
  75. data/test/cxx/VariantMapTest.cpp +23 -11
  76. metadata +8 -4
  77. metadata.gz.asc +7 -7
  78. data/ext/common/AgentsStarter.hpp +0 -655
  79. data/lib/phusion_passenger/utils/robust_interruption.rb +0 -173
@@ -1,173 +0,0 @@
1
- require 'thread'
2
-
3
- module PhusionPassenger
4
- module Utils
5
-
6
- module RobustInterruption
7
- class Interrupted < StandardError
8
- def initialize
9
- @origin_thread = Thread.current
10
- @origin = caller
11
- end
12
-
13
- def set_backtrace(bt)
14
- @origin.reverse.each do |line|
15
- if bt.last == line
16
- bt.pop
17
- else
18
- break
19
- end
20
- end
21
- bt << "interruption initiator thread: #{RobustInterruption._get_thread_display_name @origin_thread}"
22
- bt.concat(@origin)
23
- super(bt)
24
- end
25
- end
26
-
27
- class NotInstalled < StandardError
28
- end
29
-
30
- class Data
31
- attr_reader :interruption_flags
32
- attr_accessor :interrupted
33
- alias interrupted? interrupted
34
-
35
- def initialize
36
- @mutex = Mutex.new
37
- @interruption_flags = [true]
38
- @interrupted = false
39
- end
40
-
41
- def lock
42
- @mutex.lock
43
- end
44
-
45
- def try_lock
46
- return @mutex.try_lock
47
- end
48
-
49
- def unlock
50
- @mutex.unlock
51
- end
52
-
53
- def interruptable?
54
- return @interruption_flags.last
55
- end
56
-
57
- def push_interruption_flag(value)
58
- @interruption_flags.push(value)
59
- end
60
-
61
- def pop_interruption_flag
62
- Kernel.raise "BUG - cannot pop interruption flag in this state" if @interruption_flags.size <= 1
63
- @interruption_flags.pop
64
- end
65
- end
66
-
67
- def self.install(thread = Thread.current)
68
- thread[:robust_interruption] = Data.new
69
- end
70
-
71
- def install_robust_interruption
72
- RobustInterruption.install
73
- end
74
-
75
- def interrupted?(thread = Thread.current)
76
- if data = thread[:robust_interruption]
77
- return data.interrupted?
78
- else
79
- Kernel.raise NotInstalled, "RobustThreadInterruption not installed for #{_get_thread_display_name thread}"
80
- end
81
- end
82
- module_function :interrupted?
83
-
84
- def self.raise(thread, exception = Interrupted)
85
- if data = thread[:robust_interruption]
86
- RobustInterruption.disable_interruptions(Thread.current) do
87
- data.interrupted = true
88
- if data.try_lock
89
- begin
90
- thread.raise(exception)
91
- ensure
92
- data.unlock
93
- end
94
- end
95
- end
96
- else
97
- Kernel.raise NotInstalled, "RobustThreadInterruption not installed for #{_get_thread_display_name thread}"
98
- end
99
- end
100
-
101
- def disable_interruptions(thread = Thread.current)
102
- data = thread[:robust_interruption]
103
- if data
104
- was_interruptable = data.interruptable?
105
- data.lock if was_interruptable
106
- data.push_interruption_flag(false)
107
- begin
108
- yield
109
- ensure
110
- data.pop_interruption_flag
111
- data.unlock if was_interruptable
112
- end
113
- else
114
- Kernel.raise NotInstalled, "RobustThreadInterruption not installed for #{_get_thread_display_name thread}"
115
- end
116
- end
117
- module_function :disable_interruptions
118
-
119
- def enable_interruptions(thread = Thread.current)
120
- data = thread[:robust_interruption]
121
- if data
122
- was_interruptable = data.interruptable?
123
- data.push_interruption_flag(true)
124
- data.unlock if !was_interruptable
125
- begin
126
- yield
127
- ensure
128
- data.lock if !was_interruptable
129
- data.pop_interruption_flag
130
- end
131
- else
132
- Kernel.raise NotInstalled, "RobustThreadInterruption not installed for #{_get_thread_display_name thread}"
133
- end
134
- end
135
- module_function :enable_interruptions
136
-
137
- def restore_interruptions(thread = Thread.current)
138
- data = thread[:robust_interruption]
139
- if data
140
- if data.interruption_flags.size < 2
141
- Kernel.raise NotInstalled, "Cannot restore interruptions state to previous value - no previous value exists"
142
- end
143
- if data.interruption_flags[-2]
144
- enable_interruptions do
145
- yield
146
- end
147
- else
148
- disable_interruptions do
149
- yield
150
- end
151
- end
152
- else
153
- Kernel.raise NotInstalled, "RobustThreadInterruption not installed for #{_get_thread_display_name thread}"
154
- end
155
- end
156
- module_function :restore_interruptions
157
-
158
- private
159
- def _get_thread_display_name(thread)
160
- if !(thread_id = thread[:id])
161
- thread.to_s =~ /:(0x[0-9a-f]+)/i
162
- thread_id = $1 || '?'
163
- end
164
- if thread_name = thread[:name]
165
- thread_name = "(#{thread_name})"
166
- end
167
- return "#{thread_id}#{thread_name}"
168
- end
169
- module_function :_get_thread_display_name
170
- end
171
-
172
- end # module Utils
173
- end # module PhusionPassenger