unicorn 5.0.1 → 5.3.1

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 (58) hide show
  1. checksums.yaml +4 -4
  2. data/.manifest +1 -0
  3. data/.olddoc.yml +6 -4
  4. data/Documentation/unicorn.1.txt +2 -3
  5. data/Documentation/unicorn_rails.1.txt +3 -3
  6. data/FAQ +1 -1
  7. data/GIT-VERSION-FILE +1 -1
  8. data/GIT-VERSION-GEN +1 -1
  9. data/GNUmakefile +3 -3
  10. data/HACKING +1 -2
  11. data/ISSUES +21 -17
  12. data/KNOWN_ISSUES +2 -2
  13. data/LATEST +102 -28
  14. data/Links +3 -3
  15. data/NEWS +373 -0
  16. data/README +7 -19
  17. data/SIGNALS +1 -1
  18. data/Sandbox +6 -5
  19. data/TODO +0 -2
  20. data/TUNING +19 -1
  21. data/examples/big_app_gc.rb +1 -1
  22. data/examples/init.sh +36 -8
  23. data/examples/logrotate.conf +16 -1
  24. data/examples/nginx.conf +1 -1
  25. data/examples/unicorn.conf.minimal.rb +2 -2
  26. data/examples/unicorn.conf.rb +2 -2
  27. data/examples/unicorn@.service +7 -0
  28. data/ext/unicorn_http/common_field_optimization.h +2 -2
  29. data/ext/unicorn_http/ext_help.h +0 -20
  30. data/ext/unicorn_http/extconf.rb +1 -1
  31. data/ext/unicorn_http/global_variables.h +2 -2
  32. data/ext/unicorn_http/httpdate.c +2 -2
  33. data/ext/unicorn_http/unicorn_http.c +673 -358
  34. data/ext/unicorn_http/unicorn_http.rl +32 -16
  35. data/ext/unicorn_http/unicorn_http_common.rl +1 -1
  36. data/lib/unicorn/configurator.rb +71 -12
  37. data/lib/unicorn/http_request.rb +89 -9
  38. data/lib/unicorn/http_response.rb +5 -2
  39. data/lib/unicorn/http_server.rb +66 -22
  40. data/lib/unicorn/oob_gc.rb +4 -4
  41. data/lib/unicorn/socket_helper.rb +19 -4
  42. data/lib/unicorn/stream_input.rb +5 -4
  43. data/lib/unicorn/tee_input.rb +8 -10
  44. data/lib/unicorn/version.rb +1 -1
  45. data/lib/unicorn/worker.rb +17 -6
  46. data/lib/unicorn.rb +31 -20
  47. data/man/man1/unicorn.1 +54 -55
  48. data/man/man1/unicorn_rails.1 +47 -46
  49. data/t/t0011-active-unix-socket.sh +1 -1
  50. data/t/t0012-reload-empty-config.sh +2 -1
  51. data/t/test-lib.sh +2 -2
  52. data/test/exec/test_exec.rb +6 -5
  53. data/test/unit/test_ccc.rb +90 -0
  54. data/test/unit/test_http_parser.rb +31 -17
  55. data/test/unit/test_socket_helper.rb +8 -4
  56. data/test/unit/test_util.rb +2 -2
  57. data/unicorn.gemspec +15 -17
  58. metadata +6 -19
data/NEWS CHANGED
@@ -1,3 +1,376 @@
1
+ === unicorn 5.3.0 / 2017-04-01 08:03 UTC
2
+
3
+ A couple of portability fixes from Dylan Thacker-Smith and
4
+ Jeremy Evans since 5.3.0.pre1 over a week ago, but this looks
5
+ ready for a stable release, today.
6
+
7
+ When I started this over 8 years ago, I wondered if this would
8
+ just end up being an April Fools' joke. Guess not. I guess I
9
+ somehow tricked people into using a terribly marketed web server
10
+ that cannot talk directly to untrusted clients :x Anyways,
11
+ unicorn won't be able to handle slow clients 8 years from now,
12
+ either, or 80 years from now. And I vow never to learn to use
13
+ new-fangled things like epoll, kqueue, or threads :P
14
+
15
+ Anyways, this is a largish release with several new features,
16
+ and no backwards incompatibilities.
17
+
18
+ Simon Eskildsen contributed heavily using TCP_INFO under Linux
19
+ to implement the (now 5 year old) check_client_connection feature:
20
+
21
+ https://bogomips.org/unicorn/Unicorn/Configurator.html#method-i-check_client_connection
22
+ https://bogomips.org/unicorn-public/?q=s:check_client_connection&d:..20170401&x=t
23
+
24
+ This also led to FreeBSD and OpenBSD portability improvements in
25
+ one of our dependencies, raindrops:
26
+
27
+ https://bogomips.org/raindrops-public/20170323024829.GA5190@dcvr/T/#u
28
+
29
+ Jeremy Evans contributed several new features. First he
30
+ implemented after_worker_exit to aid debugging:
31
+
32
+ https://bogomips.org/unicorn/Unicorn/Configurator.html#method-i-after_worker_exit
33
+ https://bogomips.org/unicorn-public/?q=s:after_worker_exit&d:..20170401&x=t#t
34
+
35
+ And then security-related features to isolate workers. Workers
36
+ may now chroot to drop access to the master filesystem, and the
37
+ new after_worker_ready configuration hook now exists to aid with
38
+ chroot support in workers:
39
+
40
+ https://bogomips.org/unicorn/Unicorn/Configurator.html#method-i-after_worker_ready
41
+ https://bogomips.org/unicorn/Unicorn/Worker.html#method-i-user
42
+ https://bogomips.org/unicorn-public/?q=s:after_worker_ready&d:..20170401&x=t#t
43
+ https://bogomips.org/unicorn-public/?q=s:chroot&d:..20170401&x=t#t
44
+
45
+ Additionally, workers may run in a completely different VM space
46
+ (nullifying preload_app and any CoW savings) with the new
47
+ worker_exec option:
48
+
49
+ https://bogomips.org/unicorn/Unicorn/Configurator.html#method-i-worker_exec
50
+ https://bogomips.org/unicorn-public/?q=s:worker_exec&d:..20170401&x=t#t
51
+
52
+ There are also several improvements to FreeBSD and OpenBSD
53
+ support with the addition of these features.
54
+
55
+ shortlog of changes since v5.2.0 (2016-10-31):
56
+
57
+ Dylan Thacker-Smith (1):
58
+ Check for Socket::TCP_INFO constant before trying to get TCP_INFO
59
+
60
+ Eric Wong (30):
61
+ drop rb_str_set_len compatibility replacement
62
+ TUNING: document THP caveat for Linux users
63
+ tee_input: simplify condition for IO#write
64
+ remove response_start_sent
65
+ http_request: freeze constant strings passed IO#write
66
+ Revert "remove response_start_sent"
67
+ t/t0012-reload-empty-config.sh: access ivars directly if needed
68
+ t0011-active-unix-socket.sh: fix race condition in test
69
+ new test for check_client_connection
70
+ revert signature change to HttpServer#process_client
71
+ support "struct tcp_info" on non-Linux and Ruby 2.2+
72
+ unicorn_http: reduce rb_global_variable calls
73
+ oob_gc: rely on opt_aref_with optimization on Ruby 2.2+
74
+ http_request: reduce insn size for check_client_connection
75
+ freebsd: avoid EINVAL when setting accept filter
76
+ test-lib: expr(1) portability fix
77
+ tests: keep disabled tests defined
78
+ test_exec: SO_KEEPALIVE value only needs to be true
79
+ doc: fix links to raindrops project
80
+ http_request: support proposed Raindrops::TCP states on non-Linux
81
+ ISSUES: expand on mail archive info + subscription disclaimer
82
+ test_ccc: use a pipe to synchronize test
83
+ doc: remove private email support address
84
+ input: update documentation and hide internals.
85
+ http_server: initialize @pid ivar
86
+ gemspec: remove olddoc from build dependency
87
+ doc: add version annotations for new features
88
+ unicorn 5.3.0.pre1
89
+ doc: note after_worker_exit is also 5.3.0+
90
+ test_exec: SO_KEEPALIVE value only needs to be true (take #2)
91
+
92
+ Jeremy Evans (7):
93
+ Add after_worker_exit configuration option
94
+ Fix code example in after_worker_exit documentation
95
+ Add support for chroot to Worker#user
96
+ Add after_worker_ready configuration option
97
+ Add worker_exec configuration option
98
+ Don't pass a block for fork when forking workers
99
+ Check for SocketError on first ccc attempt
100
+
101
+ Simon Eskildsen (1):
102
+ check_client_connection: use tcp state on linux
103
+
104
+ === unicorn 5.3.0.pre1 / 2017-03-24 00:25 UTC
105
+
106
+ A largish release with several new features.
107
+
108
+ Simon Eskildsen contributed heavily using TCP_INFO under Linux
109
+ to implement the (now 5 year old) check_client_connection feature:
110
+
111
+ https://bogomips.org/unicorn/Unicorn/Configurator.html#method-i-check_client_connection
112
+ https://bogomips.org/unicorn-public/?q=s:check_client_connection&d:..20170324&x=t
113
+
114
+ This also led to FreeBSD and OpenBSD portability improvements in
115
+ one of our dependencies, raindrops:
116
+
117
+ https://bogomips.org/raindrops-public/20170323024829.GA5190@dcvr/T/#u
118
+
119
+ Jeremy Evans contributed several new features. First he
120
+ implemented after_worker_exit to aid debugging:
121
+
122
+ https://bogomips.org/unicorn/Unicorn/Configurator.html#method-i-after_worker_exit
123
+ https://bogomips.org/unicorn-public/?q=s:after_worker_exit&d:..20170324&x=t#t
124
+
125
+ And then security-related features to isolate workers. Workers
126
+ may now chroot to drop access to the master filesystem, and the
127
+ new after_worker_ready configuration hook now exists to aid with
128
+ chroot support in workers:
129
+
130
+ https://bogomips.org/unicorn/Unicorn/Configurator.html#method-i-after_worker_ready
131
+ https://bogomips.org/unicorn/Unicorn/Worker.html#method-i-user
132
+ https://bogomips.org/unicorn-public/?q=s:after_worker_ready&d:..20170324&x=t#t
133
+ https://bogomips.org/unicorn-public/?q=s:chroot&d:..20170324&x=t#t
134
+
135
+ Additionally, workers may run in a completely different VM space
136
+ (nullifying preload_app and any CoW savings) with the new
137
+ worker_exec option:
138
+
139
+ https://bogomips.org/unicorn/Unicorn/Configurator.html#method-i-worker_exec
140
+ https://bogomips.org/unicorn-public/?q=s:worker_exec&d:..20170324&x=t#t
141
+
142
+ There are also several improvements to FreeBSD and OpenBSD
143
+ support with the addition of these features.
144
+
145
+ 34 changes since 5.2.0 (2016-10-31):
146
+
147
+ Eric Wong (27):
148
+ drop rb_str_set_len compatibility replacement
149
+ TUNING: document THP caveat for Linux users
150
+ tee_input: simplify condition for IO#write
151
+ remove response_start_sent
152
+ http_request: freeze constant strings passed IO#write
153
+ Revert "remove response_start_sent"
154
+ t/t0012-reload-empty-config.sh: access ivars directly if needed
155
+ t0011-active-unix-socket.sh: fix race condition in test
156
+ new test for check_client_connection
157
+ revert signature change to HttpServer#process_client
158
+ support "struct tcp_info" on non-Linux and Ruby 2.2+
159
+ unicorn_http: reduce rb_global_variable calls
160
+ oob_gc: rely on opt_aref_with optimization on Ruby 2.2+
161
+ http_request: reduce insn size for check_client_connection
162
+ freebsd: avoid EINVAL when setting accept filter
163
+ test-lib: expr(1) portability fix
164
+ tests: keep disabled tests defined
165
+ test_exec: SO_KEEPALIVE value only needs to be true
166
+ doc: fix links to raindrops project
167
+ http_request: support proposed Raindrops::TCP states on non-Linux
168
+ ISSUES: expand on mail archive info + subscription disclaimer
169
+ test_ccc: use a pipe to synchronize test
170
+ doc: remove private email support address
171
+ input: update documentation and hide internals.
172
+ http_server: initialize @pid ivar
173
+ gemspec: remove olddoc from build dependency
174
+ doc: add version annotations for new features
175
+
176
+ Jeremy Evans (6):
177
+ Add after_worker_exit configuration option
178
+ Fix code example in after_worker_exit documentation
179
+ Add support for chroot to Worker#user
180
+ Add after_worker_ready configuration option
181
+ Add worker_exec configuration option
182
+ Don't pass a block for fork when forking workers
183
+
184
+ Simon Eskildsen (1):
185
+ check_client_connection: use tcp state on linux
186
+
187
+ === unicorn 5.2.0 / 2016-10-31 20:00 UTC
188
+
189
+ Most notably, this release allows us to support requests with
190
+ lines delimited by LF-only, as opposed to the standard CRLF
191
+ pair and allowed by RFC 2616 sec 19.3.
192
+
193
+ Thanks to Mishael A Sibiryakov for the explanation and change:
194
+
195
+ https://bogomips.org/unicorn-public/1476954332.1736.156.camel@junki.org/
196
+
197
+ Thanks to Let's Encrypt, the website also moves to HTTPS
198
+ <https://bogomips.org/unicorn/> to improve reader privacy. The
199
+ "unicorn.bogomips.org" subdomain will be retired soon to reduce
200
+ subjectAltName bloat and speed up certificate renewals.
201
+
202
+ There's also the usual round of documentation and example
203
+ updates, too.
204
+
205
+ Eric Wong (7):
206
+ examples/init.sh: update to reduce upgrade raciness
207
+ doc: systemd should only kill master in example
208
+ examples/logrotate.conf: update example for systemd
209
+ doc: update gmane URLs to point to our own archives
210
+ relocate website to https://bogomips.org/unicorn/
211
+ TODO: remove Rack 2.x item
212
+ build: "install-gem" target avoids network
213
+
214
+ Mishael A Sibiryakov (1):
215
+ Add some tolerance (RFC2616 sec. 19.3)
216
+
217
+ === unicorn 5.1.0 - rack is optional, again / 2016-04-01 00:35 UTC
218
+
219
+ Note: no code changes since 5.1.0.pre1 from January.^WNo, wait,
220
+ last minute performance improvement added today. See below.
221
+
222
+ The big change is rack is not required (but still recommended).
223
+ Applications are expected to depend on rack on their own so they can
224
+ specify the version of rack they prefer without unicorn pulling
225
+ in a newer, potentially incompatible version.
226
+
227
+ unicorn will always attempt to work with multiple versions of rack
228
+ as practical.
229
+
230
+ The HTTP parser also switched to using the TypedData C-API for
231
+ extra type safety and memory usage accounting support in the
232
+ 'objspace' extension.
233
+
234
+ Thanks to Adam Duke to bringing the rack change to our attention
235
+ and Aaron Patterson for helping with the matter.
236
+
237
+ Last minute change: we now support the new leftpad() syscall under
238
+ Linux for major performance and security improvement:
239
+
240
+ http://mid.gmane.org/1459463613-32473-1-git-send-email-richard@nod.at
241
+
242
+ 8^H9 changes since 5.0.1:
243
+
244
+ http: TypedData C-API conversion
245
+ various documentation updates
246
+ doc: bump olddoc to ~> 1.2 for extra NNTP URL
247
+ rack is optional at runtime, required for dev
248
+ doc update for ClientShutdown exceptions class
249
+ unicorn 5.1.0.pre1 - rack is optional, again
250
+ doc: reference --keep-file-descriptors for "bundle exec"
251
+ doc: further trimming to reduce noise
252
+ use leftpad Linux syscall for speed!
253
+
254
+ === unicorn 5.1.0.pre1 - rack is optional, again / 2016-01-27 23:08 UTC
255
+
256
+ The big change is rack is not required (but still recommended).
257
+ Applications are expected to depend on rack on their own so they can
258
+ specify the version of rack they prefer without unicorn pulling
259
+ in a newer, potentially incompatible version.
260
+
261
+ unicorn will always attempt to work with multiple versions of rack
262
+ as practical.
263
+
264
+ The HTTP parser also switched to using the TypedData C-API for
265
+ extra type safety and memory usage accounting support in the
266
+ 'objspace' extension.
267
+
268
+ Thanks to Adam Duke to bringing the rack change to our attention
269
+ and Aaron Patterson for helping with the matter.
270
+
271
+ There might be more documentation-related changes before 5.1.0
272
+ final. I am considering dropping pandoc from manpage generation
273
+ and relying on pod2man (from Perl) because it has a wider install
274
+ base.
275
+
276
+ 5 changes since v5.0.1:
277
+
278
+ http: TypedData C-API conversion
279
+ various documentation updates
280
+ doc: bump olddoc to ~> 1.2 for extra NNTP URL
281
+ rack is optional at runtime, required for dev
282
+ doc update for ClientShutdown exceptions class
283
+
284
+ === unicorn 5.0.1 - continuing to violate Rack SPEC / 2015-11-17 22:44 UTC
285
+
286
+ Once again, we allow nil values in response headers. We've had
287
+ this bug since March 2009, and thus cannot expect existing
288
+ applications and middlewares running unicorn to fix this.
289
+
290
+ Unfortunately, supporting this bug contributes to application
291
+ server lock-in, but at least we'll document it as such.
292
+
293
+ Thanks to Owen Ou <o@heroku.com> for reporting this regression:
294
+
295
+ http://bogomips.org/unicorn-public/CAO47=rJa=zRcLn_Xm4v2cHPr6c0UswaFC_omYFEH+baSxHOWKQ@mail.gmail.com/
296
+
297
+ Additionally, systemd examples are now in the examples/ directory
298
+ based on a post by Christos Trochalakis <yatiohi@ideopolis.gr>:
299
+
300
+ http://bogomips.org/unicorn-public/20150708130821.GA1361@luke.ws.skroutz.gr/
301
+
302
+ === unicorn 5.0.0 - most boring major release. EVER. / 2015-11-01 08:48 UTC
303
+
304
+ An evolutionary dead-end since its announcement[1] nearly six years
305
+ ago, this old-fashioned preforker has had enough bugs and missteps
306
+ that it's managed to hit version 5!
307
+
308
+ I wish I could say unicorn 5 is leaps and bounds better than 4, but
309
+ it is not. This major version change allows us to drop some cruft
310
+ and unused features which accumulated over the years, resulting in
311
+ several kilobytes of memory saved[2]!
312
+
313
+ Compatibility:
314
+
315
+ * The horrible, proprietary (:P) "Status:" response header is
316
+ finally gone, saving at least 16 precious bytes in every HTTP
317
+ response. This should make it easier to write custom HTTP clients
318
+ which are compatible across all HTTP servers. It will hopefully
319
+ make migrating between different Rack servers easier for new
320
+ projects.
321
+
322
+ * Ruby 1.8 support removed. Ruby 1.9.3 is currently the earliest
323
+ supported version. However, expect minor, likely-unnoticeable
324
+ performance regressions if you use Ruby 2.1 or earlier. Going
325
+ forward, unicorn will favor the latest version (currently 2.2) of
326
+ the mainline Ruby implementation, potentially sacrificing
327
+ performance on older Rubies.
328
+
329
+ * Some internal, undocumented features and APIs used by
330
+ derivative servers are gone; removing bloat and slightly lowering
331
+ memory use. We have never and will never endorse the use of any
332
+ applications or middleware with a dependency on unicorn,
333
+ applications should be written for Rack instead.
334
+ Note: Rainbows! 5.0 will be released next week or so to be
335
+ compatible with unicorn 5.x
336
+
337
+ New features:
338
+
339
+ * sd_listen_fds(3) emulation added for systemd compatibility.
340
+ You may now stop using PID files and other process monitoring
341
+ software when using systemd.
342
+
343
+ * Newly-set TCP socket options are now applied to inherited sockets.
344
+
345
+ * Dynamic changes in the application to Rack::Utils::HTTP_STATUS
346
+ hash is now supported; allowing users to set custom status lines
347
+ in Rack to be reflected in unicorn. This feature causes a minor
348
+ performance regression, but is made up for Ruby 2.2 users with
349
+ other optimizations.
350
+
351
+ * The monotonic clock is used under Ruby 2.1+, making the
352
+ timeout feature immune to system clock changes.
353
+
354
+ As unicorn may be used anonymously without registration, the
355
+ project is committed to supporting anonymous and pseudonymous
356
+ help requests, contributions and feedback via plain-text mail to:
357
+
358
+ unicorn-public@bogomips.org
359
+
360
+ The mail submission port (587) is open to those behind firewalls
361
+ and allows access via Tor and anonymous remailers.
362
+ Archives are accessible via: http://bogomips.org/unicorn-public/
363
+ and mirrored to various other places, so you do not need to use
364
+ a valid address when posting.
365
+
366
+ Finally, rest assured the core design of unicorn will never change.
367
+ It will never use new-fangled things like threads, kqueue or epoll;
368
+ but will always remain a preforking server serving one client
369
+ per-process.
370
+
371
+ [1] http://mid.gmane.org/20090211230457.GB22926@dcvr.yhbt.net
372
+ [2] this would've been like, totally gnarly in the 80s!
373
+
1
374
  === unicorn 5.0.0.pre2 - another prerelease! / 2015-07-06 21:37 UTC
2
375
 
3
376
  There is a minor TCP socket options are now applied to inherited
data/README CHANGED
@@ -13,7 +13,7 @@ both the the request and response in between unicorn and slow clients.
13
13
  {nginx}[http://nginx.org/] or {Rack}[http://rack.github.io/].
14
14
 
15
15
  * Compatible with Ruby 1.9.3 and later.
16
- unicorn 4.8.x will remain supported for Ruby 1.8 users.
16
+ unicorn 4.x remains supported for Ruby 1.8 users.
17
17
 
18
18
  * Process management: unicorn will reap and restart workers that
19
19
  die from broken apps. There is no need to manage multiple processes
@@ -27,9 +27,6 @@ both the the request and response in between unicorn and slow clients.
27
27
  all run within their own isolated address space and only serve one
28
28
  client at a time for maximum robustness.
29
29
 
30
- * Supports all Rack applications, along with pre-Rack versions of
31
- Ruby on Rails via a Rack wrapper.
32
-
33
30
  * Builtin reopening of all log files in your application via
34
31
  USR1 signal. This allows logrotate to rotate files atomically and
35
32
  quickly via rename instead of the racy and slow copytruncate method.
@@ -54,13 +51,11 @@ both the the request and response in between unicorn and slow clients.
54
51
 
55
52
  * Simple and easy Ruby DSL for configuration.
56
53
 
57
- * Decodes chunked transfers on-the-fly, thus allowing upload progress
58
- notification to be implemented as well as being able to tunnel
59
- arbitrary stream-based protocols over HTTP.
54
+ * Decodes chunked requests on-the-fly.
60
55
 
61
56
  == License
62
57
 
63
- unicorn is copyright 2009 by all contributors (see logs in git).
58
+ unicorn is copyright 2009-2016 by all contributors (see logs in git).
64
59
  It is based on Mongrel 1.1.5.
65
60
  Mongrel is copyright 2007 Zed A. Shaw and contributors.
66
61
 
@@ -68,7 +63,7 @@ unicorn is licensed under (your choice) of the GPLv2 or later
68
63
  (GPLv3+ preferred), or Ruby (1.8)-specific terms.
69
64
  See the included LICENSE file for details.
70
65
 
71
- unicorn is 100% Free Software.
66
+ unicorn is 100% Free Software (including all development tools used).
72
67
 
73
68
  == Install
74
69
 
@@ -85,10 +80,9 @@ You can get the latest source via git from the following locations
85
80
  git://bogomips.org/unicorn.git
86
81
  git://repo.or.cz/unicorn.git (mirror)
87
82
 
88
- You may browse the code from the web and download the latest snapshot
89
- tarballs here:
83
+ You may browse the code from the web:
90
84
 
91
- * http://bogomips.org/unicorn.git (cgit)
85
+ * https://bogomips.org/unicorn.git
92
86
  * http://repo.or.cz/w/unicorn.git (gitweb)
93
87
 
94
88
  See the HACKING guide on how to contribute and build prerelease gems
@@ -102,12 +96,6 @@ In APP_ROOT, run:
102
96
 
103
97
  unicorn
104
98
 
105
- === Ancient Rails 1.2 - 2.x versions
106
-
107
- In RAILS_ROOT, run:
108
-
109
- unicorn_rails
110
-
111
99
  unicorn will bind to all interfaces on TCP port 8080 by default.
112
100
  You may use the +--listen/-l+ switch to bind to a different
113
101
  address:port or a UNIX socket.
@@ -140,7 +128,7 @@ All feedback (bug reports, user/development dicussion, patches, pull
140
128
  requests) go to the mailing list/newsgroup. See the ISSUES document for
141
129
  information on the {mailing list}[mailto:unicorn-public@bogomips.org].
142
130
 
143
- The mailing list is archived at http://bogomips.org/unicorn-public/
131
+ The mailing list is archived at https://bogomips.org/unicorn-public/
144
132
  Read-only NNTP access is available at:
145
133
  nntp://news.public-inbox.org/inbox.comp.lang.ruby.unicorn and
146
134
  nntp://news.gmane.org/gmane.comp.lang.ruby.unicorn.general
data/SIGNALS CHANGED
@@ -8,7 +8,7 @@ should be possible to easily share process management scripts between
8
8
  Unicorn and nginx.
9
9
 
10
10
  One example init script is distributed with unicorn:
11
- http://unicorn.bogomips.org/examples/init.sh
11
+ https://bogomips.org/unicorn/examples/init.sh
12
12
 
13
13
  === Master Process
14
14
 
data/Sandbox CHANGED
@@ -34,7 +34,7 @@ is the primary issue with sandboxing tools such as Bundler and Isolate.
34
34
  If you're bundling unicorn, use "bundle exec unicorn" (or "bundle exec
35
35
  unicorn_rails") to start unicorn with the correct environment variables
36
36
 
37
- ref: http://mid.gmane.org/9ECF07C4-5216-47BE-961D-AFC0F0C82060@internetfamo.us
37
+ ref: https://bogomips.org/unicorn-public/9ECF07C4-5216-47BE-961D-AFC0F0C82060@internetfamo.us/
38
38
 
39
39
  Otherwise (if you choose to not sandbox your unicorn installation), we
40
40
  expect the tips for Isolate (below) apply, too.
@@ -43,7 +43,8 @@ expect the tips for Isolate (below) apply, too.
43
43
 
44
44
  This is no longer be an issue as of bundler 0.9.17
45
45
 
46
- ref: http://mid.gmane.org/8FC34B23-5994-41CC-B5AF-7198EF06909E@tramchase.com
46
+ ref:
47
+ https://bogomips.org/unicorn-public/8FC34B23-5994-41CC-B5AF-7198EF06909E@tramchase.com/
47
48
 
48
49
  === BUNDLE_GEMFILE for Capistrano users
49
50
 
@@ -63,9 +64,9 @@ before_exec hook as illustrated by https://gist.github.com/534668
63
64
  === Ruby 2.0.0 close-on-exec and SIGUSR2 incompatibility
64
65
 
65
66
  Ruby 2.0.0 enforces FD_CLOEXEC on file descriptors by default. unicorn
66
- has been prepared for this behavior since unicorn 4.1.0, but we forgot
67
- to remind the Bundler developers. This issue is being tracked here:
68
- https://github.com/bundler/bundler/issues/2628
67
+ has been prepared for this behavior since unicorn 4.1.0, and bundler
68
+ needs the "--keep-file-descriptors" option for "bundle exec":
69
+ http://bundler.io/man/bundle-exec.1.html
69
70
 
70
71
  == Isolate
71
72
 
data/TODO CHANGED
@@ -1,5 +1,3 @@
1
1
  * Documentation improvements
2
2
 
3
3
  * improve test suite
4
-
5
- * Rack 2.x support (when Rack 2.x exists)
data/TUNING CHANGED
@@ -72,10 +72,28 @@ See Unicorn::Configurator for details on the config file format.
72
72
  have them unbuffered (File#sync = true) or they are
73
73
  record(line)-buffered in userspace before any writes.
74
74
 
75
- == Kernel Parameters (Linux sysctl)
75
+ == Kernel Parameters (Linux sysctl and sysfs)
76
76
 
77
77
  WARNING: Do not change system parameters unless you know what you're doing!
78
78
 
79
+ * Transparent hugepages (THP) improves performance in many cases,
80
+ but can also increase memory use when relying on a
81
+ copy-on-write(CoW)-friendly GC (Ruby 2.0+) with "preload_app true".
82
+ CoW operates at the page level, so writing to a huge page would
83
+ trigger a 2 MB copy (x86-64), as opposed to a 4 KB copy on a
84
+ regular (non-huge) page.
85
+
86
+ Consider only allowing THP to be used when it is requested via the
87
+ madvise(2) syscall:
88
+
89
+ echo madvise >/sys/kernel/mm/transparent_hugepage/enabled
90
+
91
+ Or disabling it system-wide, via "never".
92
+
93
+ n.b. "page" in this context only applies to the OS kernel,
94
+ Ruby GC implementations also use this term for the same concept
95
+ in a way that is agnostic to the OS.
96
+
79
97
  * net.core.rmem_max and net.core.wmem_max can increase the allowed
80
98
  size of :rcvbuf and :sndbuf respectively. This is mostly only useful
81
99
  for UNIX domain sockets which do not have auto-tuning buffer sizes.
@@ -1,2 +1,2 @@
1
- # see {Unicorn::OobGC}[http://unicorn.bogomips.org/Unicorn/OobGC.html]
1
+ # see {Unicorn::OobGC}[https://bogomips.org/unicorn/Unicorn/OobGC.html]
2
2
  # Unicorn::OobGC was broken in Unicorn v3.3.1 - v3.6.1 and fixed in v3.6.2
data/examples/init.sh CHANGED
@@ -1,7 +1,16 @@
1
1
  #!/bin/sh
2
2
  set -e
3
+ ### BEGIN INIT INFO
4
+ # Provides: unicorn
5
+ # Required-Start: $local_fs $network
6
+ # Required-Stop: $local_fs $network
7
+ # Default-Start: 2 3 4 5
8
+ # Default-Stop: 0 1 6
9
+ # Short-Description: Start/stop unicorn Rack app server
10
+ ### END INIT INFO
11
+
3
12
  # Example init script, this can be used with nginx, too,
4
- # since nginx and unicorn accept the same signals
13
+ # since nginx and unicorn accept the same signals.
5
14
 
6
15
  # Feel free to change any of the following variables for your app:
7
16
  TIMEOUT=${TIMEOUT-60}
@@ -9,21 +18,22 @@ APP_ROOT=/home/x/my_app/current
9
18
  PID=$APP_ROOT/tmp/pids/unicorn.pid
10
19
  CMD="/usr/bin/unicorn -D -c $APP_ROOT/config/unicorn.rb"
11
20
  INIT_CONF=$APP_ROOT/config/init.conf
21
+ UPGRADE_DELAY=${UPGRADE_DELAY-2}
12
22
  action="$1"
13
23
  set -u
14
24
 
15
25
  test -f "$INIT_CONF" && . $INIT_CONF
16
26
 
17
- old_pid="$PID.oldbin"
27
+ OLD="$PID.oldbin"
18
28
 
19
29
  cd $APP_ROOT || exit 1
20
30
 
21
31
  sig () {
22
- test -s "$PID" && kill -$1 `cat $PID`
32
+ test -s "$PID" && kill -$1 $(cat $PID)
23
33
  }
24
34
 
25
35
  oldsig () {
26
- test -s $old_pid && kill -$1 `cat $old_pid`
36
+ test -s "$OLD" && kill -$1 $(cat $OLD)
27
37
  }
28
38
 
29
39
  case $action in
@@ -45,18 +55,36 @@ restart|reload)
45
55
  $CMD
46
56
  ;;
47
57
  upgrade)
48
- if sig USR2 && sleep 2 && sig 0 && oldsig QUIT
58
+ if oldsig 0
59
+ then
60
+ echo >&2 "Old upgraded process still running with $OLD"
61
+ exit 1
62
+ fi
63
+
64
+ cur_pid=
65
+ if test -s "$PID"
66
+ then
67
+ cur_pid=$(cat $PID)
68
+ fi
69
+
70
+ if test -n "$cur_pid" &&
71
+ kill -USR2 "$cur_pid" &&
72
+ sleep $UPGRADE_DELAY &&
73
+ new_pid=$(cat $PID) &&
74
+ test x"$new_pid" != x"$cur_pid" &&
75
+ kill -0 "$new_pid" &&
76
+ kill -QUIT "$cur_pid"
49
77
  then
50
78
  n=$TIMEOUT
51
- while test -s $old_pid && test $n -ge 0
79
+ while kill -0 "$cur_pid" 2>/dev/null && test $n -ge 0
52
80
  do
53
81
  printf '.' && sleep 1 && n=$(( $n - 1 ))
54
82
  done
55
83
  echo
56
84
 
57
- if test $n -lt 0 && test -s $old_pid
85
+ if test $n -lt 0 && kill -0 "$cur_pid" 2>/dev/null
58
86
  then
59
- echo >&2 "$old_pid still exists after $TIMEOUT seconds"
87
+ echo >&2 "$cur_pid still running after $TIMEOUT seconds"
60
88
  exit 1
61
89
  fi
62
90
  exit 0
@@ -3,6 +3,9 @@
3
3
  #
4
4
  # See the logrotate(8) manpage for more information:
5
5
  # http://linux.die.net/man/8/logrotate
6
+ #
7
+ # public logrotate-related discussion in our archives:
8
+ # https://bogomips.org/unicorn-public/?q=logrotate
6
9
 
7
10
  # Modify the following glob to match the logfiles your app writes to:
8
11
  /var/log/unicorn_app/*.log {
@@ -22,7 +25,19 @@
22
25
  # config. Unicorn supports the USR1 signal and we send it
23
26
  # as our "lastaction" action:
24
27
  lastaction
25
- # assuming your pid file is in /var/run/unicorn_app/pid
28
+ # For systemd users, assuming you use two services
29
+ # (as recommended) to allow zero-downtime upgrades.
30
+ # Only one service needs to be started, but signaling
31
+ # both here is harmless as long as they're both enabled
32
+ systemctl kill -s SIGUSR1 unicorn@1.service
33
+ systemctl kill -s SIGUSR1 unicorn@2.service
34
+
35
+ # Examples for other process management systems appreciated
36
+ # Mail us at unicorn-public@bogomips.org
37
+ # (see above for archives)
38
+
39
+ # If you use a pid file and assuming your pid file
40
+ # is in /var/run/unicorn_app/pid
26
41
  pid=/var/run/unicorn_app/pid
27
42
  test -s $pid && kill -USR1 "$(cat $pid)"
28
43
  endscript
data/examples/nginx.conf CHANGED
@@ -112,7 +112,7 @@ http {
112
112
  # try_files directive appeared in in nginx 0.7.27 and has stabilized
113
113
  # over time. Older versions of nginx (e.g. 0.6.x) requires
114
114
  # "if (!-f $request_filename)" which was less efficient:
115
- # http://bogomips.org/unicorn.git/tree/examples/nginx.conf?id=v3.3.1#n127
115
+ # https://bogomips.org/unicorn.git/tree/examples/nginx.conf?id=v3.3.1#n127
116
116
  try_files $uri/index.html $uri.html $uri @app;
117
117
 
118
118
  location @app {
@@ -1,9 +1,9 @@
1
1
  # Minimal sample configuration file for Unicorn (not Rack) when used
2
2
  # with daemonization (unicorn -D) started in your working directory.
3
3
  #
4
- # See http://unicorn.bogomips.org/Unicorn/Configurator.html for complete
4
+ # See https://bogomips.org/unicorn/Unicorn/Configurator.html for complete
5
5
  # documentation.
6
- # See also http://unicorn.bogomips.org/examples/unicorn.conf.rb for
6
+ # See also https://bogomips.org/unicorn/examples/unicorn.conf.rb for
7
7
  # a more verbose configuration using more features.
8
8
 
9
9
  listen 2007 # by default Unicorn listens on port 8080