unicorn-simon 0.0.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 (158) hide show
  1. checksums.yaml +7 -0
  2. data/.CHANGELOG.old +25 -0
  3. data/.document +28 -0
  4. data/.gitattributes +5 -0
  5. data/.gitignore +25 -0
  6. data/.mailmap +26 -0
  7. data/.manifest +156 -0
  8. data/.olddoc.yml +18 -0
  9. data/Application_Timeouts +77 -0
  10. data/CONTRIBUTORS +35 -0
  11. data/COPYING +674 -0
  12. data/DESIGN +95 -0
  13. data/Documentation/.gitignore +5 -0
  14. data/Documentation/GNUmakefile +30 -0
  15. data/Documentation/unicorn.1.txt +187 -0
  16. data/Documentation/unicorn_rails.1.txt +175 -0
  17. data/FAQ +70 -0
  18. data/GIT-VERSION-FILE +1 -0
  19. data/GIT-VERSION-GEN +39 -0
  20. data/GNUmakefile +253 -0
  21. data/HACKING +120 -0
  22. data/ISSUES +90 -0
  23. data/KNOWN_ISSUES +79 -0
  24. data/LATEST +30 -0
  25. data/LICENSE +67 -0
  26. data/Links +56 -0
  27. data/NEWS +2465 -0
  28. data/PHILOSOPHY +139 -0
  29. data/README +138 -0
  30. data/Rakefile +16 -0
  31. data/SIGNALS +123 -0
  32. data/Sandbox +104 -0
  33. data/TODO +3 -0
  34. data/TUNING +119 -0
  35. data/archive/.gitignore +3 -0
  36. data/archive/slrnpull.conf +4 -0
  37. data/bin/unicorn +126 -0
  38. data/bin/unicorn_rails +209 -0
  39. data/examples/big_app_gc.rb +2 -0
  40. data/examples/echo.ru +27 -0
  41. data/examples/init.sh +102 -0
  42. data/examples/logger_mp_safe.rb +25 -0
  43. data/examples/logrotate.conf +44 -0
  44. data/examples/nginx.conf +155 -0
  45. data/examples/unicorn.conf.minimal.rb +13 -0
  46. data/examples/unicorn.conf.rb +110 -0
  47. data/examples/unicorn.socket +11 -0
  48. data/examples/unicorn@.service +33 -0
  49. data/ext/unicorn_http/CFLAGS +13 -0
  50. data/ext/unicorn_http/c_util.h +124 -0
  51. data/ext/unicorn_http/common_field_optimization.h +111 -0
  52. data/ext/unicorn_http/ext_help.h +62 -0
  53. data/ext/unicorn_http/extconf.rb +11 -0
  54. data/ext/unicorn_http/global_variables.h +97 -0
  55. data/ext/unicorn_http/httpdate.c +78 -0
  56. data/ext/unicorn_http/unicorn_http.c +4274 -0
  57. data/ext/unicorn_http/unicorn_http.rl +980 -0
  58. data/ext/unicorn_http/unicorn_http_common.rl +76 -0
  59. data/lib/unicorn/app/old_rails/static.rb +59 -0
  60. data/lib/unicorn/app/old_rails.rb +35 -0
  61. data/lib/unicorn/cgi_wrapper.rb +147 -0
  62. data/lib/unicorn/configurator.rb +664 -0
  63. data/lib/unicorn/const.rb +21 -0
  64. data/lib/unicorn/http_request.rb +122 -0
  65. data/lib/unicorn/http_response.rb +60 -0
  66. data/lib/unicorn/http_server.rb +824 -0
  67. data/lib/unicorn/launcher.rb +62 -0
  68. data/lib/unicorn/oob_gc.rb +82 -0
  69. data/lib/unicorn/preread_input.rb +33 -0
  70. data/lib/unicorn/socket_helper.rb +195 -0
  71. data/lib/unicorn/stream_input.rb +146 -0
  72. data/lib/unicorn/tee_input.rb +133 -0
  73. data/lib/unicorn/tmpio.rb +27 -0
  74. data/lib/unicorn/util.rb +90 -0
  75. data/lib/unicorn/version.rb +1 -0
  76. data/lib/unicorn/worker.rb +140 -0
  77. data/lib/unicorn.rb +123 -0
  78. data/man/man1/unicorn.1 +221 -0
  79. data/man/man1/unicorn_rails.1 +212 -0
  80. data/setup.rb +1586 -0
  81. data/t/.gitignore +4 -0
  82. data/t/GNUmakefile +74 -0
  83. data/t/README +42 -0
  84. data/t/bin/content-md5-put +36 -0
  85. data/t/bin/sha1sum.rb +17 -0
  86. data/t/bin/unused_listen +40 -0
  87. data/t/broken-app.ru +12 -0
  88. data/t/detach.ru +11 -0
  89. data/t/env.ru +3 -0
  90. data/t/fails-rack-lint.ru +5 -0
  91. data/t/heartbeat-timeout.ru +12 -0
  92. data/t/hijack.ru +43 -0
  93. data/t/listener_names.ru +4 -0
  94. data/t/my-tap-lib.sh +201 -0
  95. data/t/oob_gc.ru +20 -0
  96. data/t/oob_gc_path.ru +20 -0
  97. data/t/pid.ru +3 -0
  98. data/t/preread_input.ru +17 -0
  99. data/t/rack-input-tests.ru +21 -0
  100. data/t/t0000-http-basic.sh +50 -0
  101. data/t/t0001-reload-bad-config.sh +53 -0
  102. data/t/t0002-config-conflict.sh +49 -0
  103. data/t/t0002-parser-error.sh +94 -0
  104. data/t/t0003-working_directory.sh +51 -0
  105. data/t/t0004-heartbeat-timeout.sh +69 -0
  106. data/t/t0004-working_directory_broken.sh +24 -0
  107. data/t/t0005-working_directory_app.rb.sh +40 -0
  108. data/t/t0006-reopen-logs.sh +83 -0
  109. data/t/t0006.ru +13 -0
  110. data/t/t0007-working_directory_no_embed_cli.sh +44 -0
  111. data/t/t0008-back_out_of_upgrade.sh +110 -0
  112. data/t/t0009-broken-app.sh +56 -0
  113. data/t/t0009-winch_ttin.sh +59 -0
  114. data/t/t0010-reap-logging.sh +55 -0
  115. data/t/t0011-active-unix-socket.sh +79 -0
  116. data/t/t0012-reload-empty-config.sh +85 -0
  117. data/t/t0013-rewindable-input-false.sh +24 -0
  118. data/t/t0013.ru +12 -0
  119. data/t/t0014-rewindable-input-true.sh +24 -0
  120. data/t/t0014.ru +12 -0
  121. data/t/t0015-configurator-internals.sh +25 -0
  122. data/t/t0018-write-on-close.sh +23 -0
  123. data/t/t0019-max_header_len.sh +49 -0
  124. data/t/t0020-at_exit-handler.sh +49 -0
  125. data/t/t0021-process_detach.sh +29 -0
  126. data/t/t0022-listener_names-preload_app.sh +32 -0
  127. data/t/t0100-rack-input-tests.sh +124 -0
  128. data/t/t0116-client_body_buffer_size.sh +80 -0
  129. data/t/t0116.ru +16 -0
  130. data/t/t0200-rack-hijack.sh +30 -0
  131. data/t/t0300-no-default-middleware.sh +20 -0
  132. data/t/t9000-preread-input.sh +48 -0
  133. data/t/t9001-oob_gc.sh +47 -0
  134. data/t/t9002-oob_gc-path.sh +75 -0
  135. data/t/test-lib.sh +128 -0
  136. data/t/write-on-close.ru +11 -0
  137. data/test/aggregate.rb +15 -0
  138. data/test/benchmark/README +50 -0
  139. data/test/benchmark/dd.ru +18 -0
  140. data/test/benchmark/stack.ru +8 -0
  141. data/test/exec/README +5 -0
  142. data/test/exec/test_exec.rb +1099 -0
  143. data/test/test_helper.rb +298 -0
  144. data/test/unit/test_configurator.rb +175 -0
  145. data/test/unit/test_droplet.rb +28 -0
  146. data/test/unit/test_http_parser.rb +886 -0
  147. data/test/unit/test_http_parser_ng.rb +633 -0
  148. data/test/unit/test_request.rb +182 -0
  149. data/test/unit/test_response.rb +111 -0
  150. data/test/unit/test_server.rb +268 -0
  151. data/test/unit/test_signals.rb +188 -0
  152. data/test/unit/test_socket_helper.rb +197 -0
  153. data/test/unit/test_stream_input.rb +203 -0
  154. data/test/unit/test_tee_input.rb +304 -0
  155. data/test/unit/test_upload.rb +306 -0
  156. data/test/unit/test_util.rb +105 -0
  157. data/unicorn.gemspec +50 -0
  158. metadata +310 -0
data/GNUmakefile ADDED
@@ -0,0 +1,253 @@
1
+ # use GNU Make to run tests in parallel, and without depending on RubyGems
2
+ all:: test
3
+
4
+ RLFLAGS = -G2
5
+
6
+ MRI = ruby
7
+ RUBY = ruby
8
+ RAKE = rake
9
+ RAGEL = ragel
10
+ RSYNC = rsync
11
+ OLDDOC = olddoc
12
+ RDOC = rdoc
13
+
14
+ GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
15
+ @./GIT-VERSION-GEN
16
+ -include GIT-VERSION-FILE
17
+ -include local.mk
18
+ ruby_bin := $(shell which $(RUBY))
19
+ ifeq ($(DLEXT),) # "so" for Linux
20
+ DLEXT := $(shell $(RUBY) -rrbconfig -e 'puts RbConfig::CONFIG["DLEXT"]')
21
+ endif
22
+ ifeq ($(RUBY_VERSION),)
23
+ RUBY_VERSION := $(shell $(RUBY) -e 'puts RUBY_VERSION')
24
+ endif
25
+
26
+ RUBY_ENGINE := $(shell $(RUBY) -e 'puts((RUBY_ENGINE rescue "ruby"))')
27
+
28
+ MYLIBS = $(RUBYLIB)
29
+
30
+ # dunno how to implement this as concisely in Ruby, and hell, I love awk
31
+ awk_slow := awk '/def test_/{print FILENAME"--"$$2".n"}' 2>/dev/null
32
+
33
+ slow_tests := test/unit/test_server.rb test/exec/test_exec.rb \
34
+ test/unit/test_signals.rb test/unit/test_upload.rb
35
+ log_suffix = .$(RUBY_ENGINE).$(RUBY_VERSION).log
36
+ T := $(filter-out $(slow_tests), $(wildcard test/*/test*.rb))
37
+ T_n := $(shell $(awk_slow) $(slow_tests))
38
+ T_log := $(subst .rb,$(log_suffix),$(T))
39
+ T_n_log := $(subst .n,$(log_suffix),$(T_n))
40
+ test_prefix = $(CURDIR)/test/$(RUBY_ENGINE)-$(RUBY_VERSION)
41
+
42
+ ext := ext/unicorn_http
43
+ c_files := $(ext)/unicorn_http.c $(ext)/httpdate.c $(wildcard $(ext)/*.h)
44
+ rl_files := $(wildcard $(ext)/*.rl)
45
+ base_bins := unicorn unicorn_rails
46
+ bins := $(addprefix bin/, $(base_bins))
47
+ man1_rdoc := $(addsuffix _1, $(base_bins))
48
+ man1_bins := $(addsuffix .1, $(base_bins))
49
+ man1_paths := $(addprefix man/man1/, $(man1_bins))
50
+ rb_files := $(bins) $(shell find lib ext -type f -name '*.rb')
51
+ inst_deps := $(c_files) $(rb_files) GNUmakefile test/test_helper.rb
52
+
53
+ ragel: $(ext)/unicorn_http.c
54
+ $(ext)/unicorn_http.c: $(rl_files)
55
+ cd $(@D) && $(RAGEL) unicorn_http.rl -C $(RLFLAGS) -o $(@F)
56
+ $(ext)/Makefile: $(ext)/extconf.rb $(c_files)
57
+ cd $(@D) && $(RUBY) extconf.rb
58
+ $(ext)/unicorn_http.$(DLEXT): $(ext)/Makefile
59
+ $(MAKE) -C $(@D)
60
+ http: $(ext)/unicorn_http.$(DLEXT)
61
+
62
+ # only used for tests
63
+ http-install: $(ext)/unicorn_http.$(DLEXT)
64
+ install -m644 $< lib/
65
+
66
+ test-install: $(test_prefix)/.stamp
67
+ $(test_prefix)/.stamp: $(inst_deps)
68
+ mkdir -p $(test_prefix)/.ccache
69
+ tar cf - $(inst_deps) GIT-VERSION-GEN | \
70
+ (cd $(test_prefix) && tar xf -)
71
+ $(MAKE) -C $(test_prefix) clean
72
+ $(MAKE) -C $(test_prefix) http-install shebang RUBY="$(RUBY)"
73
+ > $@
74
+
75
+ # this is only intended to be run within $(test_prefix)
76
+ shebang: $(bins)
77
+ $(MRI) -i -p -e '$$_.gsub!(%r{^#!.*$$},"#!$(ruby_bin)")' $^
78
+
79
+ t_log := $(T_log) $(T_n_log)
80
+ test: $(T) $(T_n)
81
+ @cat $(t_log) | $(MRI) test/aggregate.rb
82
+ @$(RM) $(t_log)
83
+
84
+ test-exec: $(wildcard test/exec/test_*.rb)
85
+ test-unit: $(wildcard test/unit/test_*.rb)
86
+ $(slow_tests): $(test_prefix)/.stamp
87
+ @$(MAKE) $(shell $(awk_slow) $@)
88
+
89
+ # ensure we can require just the HTTP parser without the rest of unicorn
90
+ test-require: $(ext)/unicorn_http.$(DLEXT)
91
+ $(RUBY) --disable-gems -I$(ext) -runicorn_http -e Unicorn
92
+
93
+ test-integration: $(test_prefix)/.stamp
94
+ $(MAKE) -C t
95
+
96
+ check: test-require test test-integration
97
+ test-all: check
98
+
99
+ TEST_OPTS = -v
100
+ check_test = grep '0 failures, 0 errors' $(t) >/dev/null
101
+ ifndef V
102
+ quiet_pre = @echo '* $(arg)$(extra)';
103
+ quiet_post = >$(t) 2>&1 && $(check_test)
104
+ else
105
+ # we can't rely on -o pipefail outside of bash 3+,
106
+ # so we use a stamp file to indicate success and
107
+ # have rm fail if the stamp didn't get created
108
+ stamp = $@$(log_suffix).ok
109
+ quiet_pre = @echo $(RUBY) $(arg) $(TEST_OPTS); ! test -f $(stamp) && (
110
+ quiet_post = && > $(stamp) )2>&1 | tee $(t); \
111
+ rm $(stamp) 2>/dev/null && $(check_test)
112
+ endif
113
+
114
+ # not all systems have setsid(8), we need it because we spam signals
115
+ # stupidly in some tests...
116
+ rb_setsid := $(RUBY) -e 'Process.setsid' -e 'exec *ARGV'
117
+
118
+ # TRACER='strace -f -o $(t).strace -s 100000'
119
+ run_test = $(quiet_pre) \
120
+ $(rb_setsid) $(TRACER) $(RUBY) -w $(arg) $(TEST_OPTS) $(quiet_post) || \
121
+ (sed "s,^,$(extra): ," >&2 < $(t); exit 1)
122
+
123
+ %.n: arg = $(subst .n,,$(subst --, -n ,$@))
124
+ %.n: t = $(subst .n,$(log_suffix),$@)
125
+ %.n: export PATH := $(test_prefix)/bin:$(PATH)
126
+ %.n: export RUBYLIB := $(test_prefix)/lib:$(MYLIBS)
127
+ %.n: $(test_prefix)/.stamp
128
+ $(run_test)
129
+
130
+ $(T): arg = $@
131
+ $(T): t = $(subst .rb,$(log_suffix),$@)
132
+ $(T): export PATH := $(test_prefix)/bin:$(PATH)
133
+ $(T): export RUBYLIB := $(test_prefix)/lib:$(MYLIBS)
134
+ $(T): $(test_prefix)/.stamp
135
+ $(run_test)
136
+
137
+ install: $(bins) $(ext)/unicorn_http.c
138
+ $(prep_setup_rb)
139
+ $(RM) -r .install-tmp
140
+ mkdir .install-tmp
141
+ cp -p bin/* .install-tmp
142
+ $(RUBY) setup.rb all
143
+ $(RM) $^
144
+ mv .install-tmp/* bin/
145
+ $(RM) -r .install-tmp
146
+ $(prep_setup_rb)
147
+
148
+ setup_rb_files := .config InstalledFiles
149
+ prep_setup_rb := @-$(RM) $(setup_rb_files);$(MAKE) -C $(ext) clean
150
+
151
+ clean:
152
+ -$(MAKE) -C $(ext) clean
153
+ -$(MAKE) -C Documentation clean
154
+ $(RM) $(ext)/Makefile
155
+ $(RM) $(setup_rb_files) $(t_log)
156
+ $(RM) -r $(test_prefix) man
157
+
158
+ man html:
159
+ $(MAKE) -C Documentation install-$@
160
+
161
+ pkg_extra := GIT-VERSION-FILE lib/unicorn/version.rb LATEST NEWS \
162
+ $(ext)/unicorn_http.c $(man1_paths)
163
+
164
+ NEWS:
165
+ $(OLDDOC) prepare
166
+
167
+ .manifest: $(ext)/unicorn_http.c man NEWS
168
+ (git ls-files && for i in $@ $(pkg_extra); do echo $$i; done) | \
169
+ LC_ALL=C sort > $@+
170
+ cmp $@+ $@ || mv $@+ $@
171
+ $(RM) $@+
172
+
173
+ PLACEHOLDERS = $(man1_rdoc)
174
+ doc: .document $(ext)/unicorn_http.c man html .olddoc.yml $(PLACEHOLDERS)
175
+ find bin lib -type f -name '*.rbc' -exec rm -f '{}' ';'
176
+ $(RM) -r doc
177
+ $(OLDDOC) prepare
178
+ $(RDOC) -f oldweb
179
+ $(OLDDOC) merge
180
+ install -m644 COPYING doc/COPYING
181
+ install -m644 NEWS.atom.xml doc/NEWS.atom.xml
182
+ install -m644 $(shell LC_ALL=C grep '^[A-Z]' .document) doc/
183
+ install -m644 $(man1_paths) doc/
184
+ tar cf - $$(git ls-files examples/) | (cd doc && tar xf -)
185
+
186
+ # publishes docs to https://bogomips.org/unicorn/
187
+ publish_doc:
188
+ -git set-file-times
189
+ $(MAKE) doc
190
+ $(MAKE) doc_gz
191
+ chmod 644 $$(find doc -type f)
192
+ $(RSYNC) -av doc/ bogomips.org:/srv/bogomips/unicorn/
193
+ git ls-files | xargs touch
194
+
195
+ # Create gzip variants of the same timestamp as the original so nginx
196
+ # "gzip_static on" can serve the gzipped versions directly.
197
+ doc_gz: docs = $(shell find doc -type f ! -regex '^.*\.gz$$')
198
+ doc_gz:
199
+ for i in $(docs); do \
200
+ gzip --rsyncable -9 < $$i > $$i.gz; touch -r $$i $$i.gz; done
201
+
202
+ ifneq ($(VERSION),)
203
+ rfpackage := unicorn
204
+ pkggem := pkg/$(rfpackage)-$(VERSION).gem
205
+ pkgtgz := pkg/$(rfpackage)-$(VERSION).tgz
206
+
207
+ # ensures we're actually on the tagged $(VERSION), only used for release
208
+ verify:
209
+ test x"$(shell umask)" = x0022
210
+ git rev-parse --verify refs/tags/v$(VERSION)^{}
211
+ git diff-index --quiet HEAD^0
212
+ test `git rev-parse --verify HEAD^0` = \
213
+ `git rev-parse --verify refs/tags/v$(VERSION)^{}`
214
+
215
+ fix-perms:
216
+ git ls-tree -r HEAD | awk '/^100644 / {print $$NF}' | xargs chmod 644
217
+ git ls-tree -r HEAD | awk '/^100755 / {print $$NF}' | xargs chmod 755
218
+
219
+ gem: $(pkggem)
220
+
221
+ install-gem: $(pkggem)
222
+ gem install --local $(CURDIR)/$<
223
+
224
+ $(pkggem): .manifest fix-perms
225
+ gem build $(rfpackage).gemspec
226
+ mkdir -p pkg
227
+ mv $(@F) $@
228
+
229
+ $(pkgtgz): distdir = $(basename $@)
230
+ $(pkgtgz): HEAD = v$(VERSION)
231
+ $(pkgtgz): .manifest fix-perms
232
+ @test -n "$(distdir)"
233
+ $(RM) -r $(distdir)
234
+ mkdir -p $(distdir)
235
+ tar cf - $$(cat .manifest) | (cd $(distdir) && tar xf -)
236
+ cd pkg && tar cf - $(basename $(@F)) | gzip -9 > $(@F)+
237
+ mv $@+ $@
238
+
239
+ package: $(pkgtgz) $(pkggem)
240
+
241
+ release: verify package
242
+ # push gem to Gemcutter
243
+ gem push $(pkggem)
244
+ else
245
+ gem install-gem: GIT-VERSION-FILE
246
+ $(MAKE) $@ VERSION=$(GIT_VERSION)
247
+ endif
248
+
249
+ $(PLACEHOLDERS):
250
+ echo olddoc_placeholder > $@
251
+
252
+ .PHONY: .FORCE-GIT-VERSION-FILE doc $(T) $(slow_tests) man
253
+ .PHONY: test-install
data/HACKING ADDED
@@ -0,0 +1,120 @@
1
+ = Unicorn Hacker's Guide
2
+
3
+ == Polyglot Infrastructure
4
+
5
+ Like Mongrel, we use Ruby where it makes sense, and Ragel with C where
6
+ it helps performance. All of the code that actually runs your Rack
7
+ application is written Ruby, Ragel or C.
8
+
9
+ As far as tests and documentation goes, we're not afraid to embrace Unix
10
+ and use traditional Unix tools where they make sense and get the job
11
+ done.
12
+
13
+ === Tests
14
+
15
+ Tests are good, but slow tests make development slow, so we make tests
16
+ faster (in parallel) with GNU make (instead of Rake) and avoiding
17
+ RubyGems.
18
+
19
+ Users of GNU-based systems (such as GNU/Linux) usually have GNU make
20
+ installed as "make" instead of "gmake".
21
+
22
+ Running the entire test suite with 4 tests in parallel:
23
+
24
+ gmake -j4 check
25
+
26
+ Running just one unit test:
27
+
28
+ gmake test/unit/test_http_parser.rb
29
+
30
+ Running just one test case in a unit test:
31
+
32
+ gmake test/unit/test_http_parser.rb--test_parse_simple.n
33
+
34
+ === HttpServer
35
+
36
+ We strive to write as little code as possible while still maintaining
37
+ readability. However, readability and flexibility may be sacrificed for
38
+ performance in hot code paths. For Ruby, less code generally means
39
+ faster code.
40
+
41
+ Memory allocation should be minimized as much as practically possible.
42
+ Buffers for IO#readpartial are preallocated in the hot paths to avoid
43
+ building up garbage. Hash assignments use frozen strings to avoid the
44
+ duplication behind-the-scenes.
45
+
46
+ We spend as little time as possible inside signal handlers and instead
47
+ defer handling them for predictability and robustness. Most of the
48
+ Unix-specific things are in the Unicorn::HttpServer class. Unix systems
49
+ programming experience will come in handy (or be learned) here.
50
+
51
+ === Documentation
52
+
53
+ Due to the lack of RDoc-to-manpage converters we know about, we're
54
+ writing manpages in Markdown and converting to troff/HTML with Pandoc.
55
+
56
+ Please wrap documentation at 72 characters-per-line or less (long URLs
57
+ are exempt) so it is comfortably readable from terminals.
58
+
59
+ When referencing mailing list posts, use
60
+ <tt>https://bogomips.org/unicorn-public/$MESSAGE_ID/</tt> if possible
61
+ since the Message-ID remains searchable even if a particular site
62
+ becomes unavailable.
63
+
64
+ === Ruby/C Compatibility
65
+
66
+ We target mainline Ruby 1.9.3 and later. We need the Ruby
67
+ implementation to support fork, exec, pipe, UNIX signals, access to
68
+ integer file descriptors and ability to use unlinked files.
69
+
70
+ All of our C code is OS-independent and should run on compilers
71
+ supported by the versions of Ruby we target.
72
+
73
+ === Ragel Compatibility
74
+
75
+ We target the latest released version of Ragel and will update our code
76
+ to keep up with new releases. Packaged tarballs and gems include the
77
+ generated source code so they will remain usable if compatibility is
78
+ broken.
79
+
80
+ == Contributing
81
+
82
+ Contributions are welcome in the form of patches, pull requests, code
83
+ review, testing, documentation, user support or any other feedback is
84
+ welcome. The mailing list is the central coordination point for all
85
+ user and developer feedback and bug reports.
86
+
87
+ === Submitting Patches
88
+
89
+ Follow conventions already established in the code and do not exceed 80
90
+ characters per line.
91
+
92
+ Inline patches (from "git format-patch -M") to the mailing list are
93
+ preferred because they allow code review and comments in the reply to
94
+ the patch.
95
+
96
+ We will adhere to mostly the same conventions for patch submissions as
97
+ git itself. See the
98
+ {SubmittingPatches}[https://git.kernel.org/cgit/git/git.git/tree/Documentation/SubmittingPatches]
99
+ document
100
+ distributed with git on on patch submission guidelines to follow. Just
101
+ don't email the git mailing list or maintainer with Unicorn patches :)
102
+
103
+ == Building a Gem
104
+
105
+ In order to build the gem, you must install the following components:
106
+
107
+ * olddoc (RubyGem)
108
+ * pandoc
109
+
110
+ You can build the Unicorn gem with the following command:
111
+
112
+ gmake gem
113
+
114
+ == Running Development Versions
115
+
116
+ It is easy to install the contents of your git working directory:
117
+
118
+ Via RubyGems
119
+
120
+ gmake install-gem
data/ISSUES ADDED
@@ -0,0 +1,90 @@
1
+ = Issues
2
+
3
+ mailto:unicorn-public@bogomips.org is the best place to report bugs,
4
+ submit patches and/or obtain support after you have searched the
5
+ {email archives}[https://bogomips.org/unicorn-public/] and
6
+ {documentation}[https://bogomips.org/unicorn/].
7
+
8
+ * No subscription will ever be required to email us
9
+ * Cc: all participants in a thread or commit, as subscription is optional
10
+ * Do not {top post}[http://catb.org/jargon/html/T/top-post.html] in replies
11
+ * Quote as little as possible of the message you're replying to
12
+ * Do not send HTML mail or images, it will be flagged as spam
13
+ * Anonymous and pseudonymous messages will always be welcome.
14
+ * The email submission port (587) is enabled on the bogomips.org MX:
15
+ https://bogomips.org/unicorn-public/20141004232241.GA23908@dcvr.yhbt.net/t/
16
+
17
+ If your issue is of a sensitive nature or you're just shy in public,
18
+ then feel free to email us privately at mailto:unicorn@bogomips.org
19
+ instead and your issue will be handled discreetly.
20
+
21
+ If you don't get a response within a few days, we may have forgotten
22
+ about it so feel free to ask again.
23
+
24
+ == Bugs in related projects
25
+
26
+ unicorn is sometimes affected by bugs in its dependencies. Bugs
27
+ triggered by unicorn in mainline Ruby, rack, GNU C library (glibc),
28
+ or the Linux kernel will be reported upstream and fixed.
29
+
30
+ For bugs in Ruby itself, we may forward bugs to
31
+ https://bugs.ruby-lang.org/ and discuss+fix them on the ruby-core
32
+ list at mailto:ruby-core@ruby-lang.org
33
+ Subscription to post is required to ruby-core, unfortunately:
34
+ mailto:ruby-core-request@ruby-lang.org?subject=subscribe
35
+
36
+ For uncommon bugs in Rack, we may forward bugs to
37
+ mailto:rack-devel@googlegroups.com and discuss there.
38
+ Subscription (without any web UI or Google account) is possible via:
39
+ mailto:rack-devel+subscribe@googlegroups.com
40
+ Note: not everyone can use the proprietary bug tracker used by Rack,
41
+ but their mailing list remains operational.
42
+
43
+ Uncommon bugs we encounter in the Linux kernel should be Cc:-ed to the
44
+ Linux kernel mailing list (LKML) at mailto:linux-kernel@vger.kernel.org
45
+ and subsystem maintainers such as mailto:netdev@vger.kernel.org
46
+ (for networking issues). It is expected practice to Cc: anybody
47
+ involved with any problematic commits (including those in the
48
+ Signed-off-by: and other trailer lines). No subscription is necessary,
49
+ and the our mailing list follows the same conventions as LKML for
50
+ interopability. There is a kernel.org Bugzilla instance, but it is
51
+ ignored by most developers.
52
+
53
+ Likewise for any rare glibc bugs we might encounter, we should Cc:
54
+ mailto:libc-alpha@sourceware.org
55
+ Keep in mind glibc upstream does use Bugzilla for tracking bugs:
56
+ https://sourceware.org/bugzilla/
57
+
58
+ == Submitting Patches
59
+
60
+ See the HACKING document (and additionally, the
61
+ {SubmittingPatches}[https://git.kernel.org/cgit/git/git.git/tree/Documentation/SubmittingPatches]
62
+ document distributed with git) on guidelines for patch submission.
63
+
64
+ == Contact Info
65
+
66
+ * public: mailto:unicorn-public@bogomips.org
67
+ * private: mailto:unicorn@bogomips.org
68
+ * nntp://news.gmane.org/gmane.comp.lang.ruby.unicorn.general
69
+ * nntp://news.public-inbox.org/inbox.comp.lang.ruby.unicorn
70
+ * https://bogomips.org/unicorn-public/
71
+
72
+ Mailing list subscription is optional, so Cc: all participants.
73
+
74
+ You can follow along via NNTP:
75
+
76
+ nntp://news.public-inbox.org/inbox.comp.lang.ruby.unicorn
77
+ nntp://news.gmane.org/gmane.comp.lang.ruby.unicorn.general
78
+
79
+ Or Atom feeds:
80
+
81
+ https://bogomips.org/unicorn-public/new.atom
82
+
83
+ The HTML archives at https://bogomips.org/unicorn-public/
84
+ also has links to per-thread Atom feeds and downloadable
85
+ mboxes.
86
+
87
+ You may optionally subscribe via plain-text email:
88
+
89
+ mailto:unicorn-public+subscribe@bogomips.org
90
+ (and confirming the auto-reply)
data/KNOWN_ISSUES ADDED
@@ -0,0 +1,79 @@
1
+ = Known Issues
2
+
3
+ Occasionally odd {issues}[link:ISSUES.html] arise without a transparent or
4
+ acceptable solution. Those issues are documented here.
5
+
6
+ * Some libraries/applications may install signal handlers which conflict
7
+ with signal handlers unicorn uses. Leaving "preload_app false"
8
+ (the default) will allow unicorn to always override existing signal
9
+ handlers.
10
+
11
+ * Issues with FreeBSD jails can be worked around as documented by Tatsuya Ono:
12
+ https://bogomips.org/unicorn-public/CAHBuKRj09FdxAgzsefJWotexw-7JYZGJMtgUp_dhjPz9VbKD6Q@mail.gmail.com/
13
+
14
+ * PRNGs (pseudo-random number generators) loaded before forking
15
+ (e.g. "preload_app true") may need to have their internal state
16
+ reset in the after_fork hook. Starting with unicorn 3.6.1, we
17
+ have builtin workarounds for Kernel#rand and OpenSSL::Random users,
18
+ but applications may use other PRNGs.
19
+
20
+ * For notes on sandboxing tools such as Bundler or Isolate,
21
+ see the {Sandbox}[link:Sandbox.html] page.
22
+
23
+ * nginx with "sendfile on" under FreeBSD 8 is broken when
24
+ uploads are buffered to disk. Disabling sendfile is required to
25
+ work around this bug which should be fixed in newer versions of FreeBSD.
26
+
27
+ * When using "preload_app true", with apps using background threads
28
+ need to restart them in the after_fork hook because threads are never
29
+ shared with child processes. Additionally, any synchronization
30
+ primitives (Mutexes, Monitors, ConditionVariables) should be
31
+ reinitialized in case they are held during fork time to avoid
32
+ deadlocks. The core Ruby Logger class needlessly uses a MonitorMutex
33
+ which can be disabled with a {monkey patch}[link:examples/logger_mp_safe.rb]
34
+
35
+ == Known Issues (Old)
36
+
37
+ * Under some versions of Ruby 1.8, it is necessary to call +srand+ in an
38
+ after_fork hook to get correct random number generation. We have a builtin
39
+ workaround for this starting with unicorn 3.6.1
40
+
41
+ See http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/36450
42
+
43
+ * On Ruby 1.8 prior to Ruby 1.8.7-p248, *BSD platforms have a broken
44
+ stdio that causes failure for file uploads larger than 112K. Upgrade
45
+ your version of Ruby or continue using unicorn 1.x/3.4.x.
46
+
47
+ * Under Ruby 1.9.1, methods like Array#shuffle and Array#sample will
48
+ segfault if called after forking. Upgrade to Ruby 1.9.2 or call
49
+ "Kernel.rand" in your after_fork hook to reinitialize the random
50
+ number generator.
51
+
52
+ See http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/28655
53
+
54
+ * Rails 2.3.2 bundles its own version of Rack. This may cause subtle
55
+ bugs when simultaneously loaded with the system-wide Rack Rubygem
56
+ which unicorn depends on. Upgrading to Rails 2.3.4 (or later) is
57
+ strongly recommended for all Rails 2.3.x users for this (and security
58
+ reasons). Rails 2.2.x series (or before) did not bundle Rack and are
59
+ should be unnaffected. If there is any reason which forces your
60
+ application to use Rails 2.3.2 and you have no other choice, then
61
+ you may edit your unicorn gemspec and remove the Rack dependency.
62
+
63
+ ref: https://bogomips.org/unicorn-public/20091014221552.GA30624@dcvr.yhbt.net/
64
+ Note: the workaround described in the article above only made
65
+ the issue more subtle and we didn't notice them immediately.
66
+
67
+ * WONTFIX: code reloading and restarts with Sinatra 0.3.x (and likely older
68
+ versions) apps is broken. The workaround is to force production
69
+ mode to disable code reloading as well as disabling "run" in your
70
+ Sinatra application:
71
+ set :env, :production
72
+ set :run, false
73
+ Since this is no longer an issue with Sinatra 0.9.x apps, this will not be
74
+ fixed on our end. Since unicorn is itself the application launcher, the
75
+ at_exit handler used in old Sinatra always caused Mongrel to be launched
76
+ whenever a unicorn worker was about to exit.
77
+
78
+ Also remember we're capable of replacing the running binary without dropping
79
+ any connections regardless of framework :)
data/LATEST ADDED
@@ -0,0 +1,30 @@
1
+ === unicorn 5.2.0 / 2016-10-31 20:00 UTC
2
+
3
+ Most notably, this release allows us to support requests with
4
+ lines delimited by LF-only, as opposed to the standard CRLF
5
+ pair and allowed by RFC 2616 sec 19.3.
6
+
7
+ Thanks to Mishael A Sibiryakov for the explanation and change:
8
+
9
+ https://bogomips.org/unicorn-public/1476954332.1736.156.camel@junki.org/
10
+
11
+ Thanks to Let's Encrypt, the website also moves to HTTPS
12
+ <https://bogomips.org/unicorn/> to improve reader privacy. The
13
+ "unicorn.bogomips.org" subdomain will be retired soon to reduce
14
+ subjectAltName bloat and speed up certificate renewals.
15
+
16
+ There's also the usual round of documentation and example
17
+ updates, too.
18
+
19
+ Eric Wong (7):
20
+ examples/init.sh: update to reduce upgrade raciness
21
+ doc: systemd should only kill master in example
22
+ examples/logrotate.conf: update example for systemd
23
+ doc: update gmane URLs to point to our own archives
24
+ relocate website to https://bogomips.org/unicorn/
25
+ TODO: remove Rack 2.x item
26
+ build: "install-gem" target avoids network
27
+
28
+ Mishael A Sibiryakov (1):
29
+ Add some tolerance (RFC2616 sec. 19.3)
30
+
data/LICENSE ADDED
@@ -0,0 +1,67 @@
1
+ Unicorn is copyrighted free software by all contributors, see logs in
2
+ revision control for names and email addresses of all of them.
3
+
4
+ You can redistribute it and/or modify it under either the terms of the
5
+ GNU General Public License (GPL) as published by the Free Software
6
+ Foundation (FSF), either version 2 of the License, or (at your option)
7
+ any later version. We currently prefer the GPLv3 or later for
8
+ derivative works, but the GPLv2 is fine.
9
+
10
+ The complete texts of the GPLv2 and GPLv3 are below:
11
+ GPLv2 - http://www.gnu.org/licenses/gpl-2.0.txt
12
+ GPLv3 - http://www.gnu.org/licenses/gpl-3.0.txt
13
+
14
+ You may (against our _preference_) also use the Ruby 1.8 license terms
15
+ which we inherited from the original Mongrel project when we forked it:
16
+
17
+ === Ruby 1.8-specific terms (if you're not using the GPL)
18
+
19
+ 1. You may make and give away verbatim copies of the source form of the
20
+ software without restriction, provided that you duplicate all of the
21
+ original copyright notices and associated disclaimers.
22
+
23
+ 2. You may modify your copy of the software in any way, provided that
24
+ you do at least ONE of the following:
25
+
26
+ a) place your modifications in the Public Domain or otherwise make them
27
+ Freely Available, such as by posting said modifications to Usenet or an
28
+ equivalent medium, or by allowing the author to include your
29
+ modifications in the software.
30
+
31
+ b) use the modified software only within your corporation or
32
+ organization.
33
+
34
+ c) rename any non-standard executables so the names do not conflict with
35
+ standard executables, which must also be provided.
36
+
37
+ d) make other distribution arrangements with the author.
38
+
39
+ 3. You may distribute the software in object code or executable
40
+ form, provided that you do at least ONE of the following:
41
+
42
+ a) distribute the executables and library files of the software,
43
+ together with instructions (in the manual page or equivalent) on where
44
+ to get the original distribution.
45
+
46
+ b) accompany the distribution with the machine-readable source of the
47
+ software.
48
+
49
+ c) give non-standard executables non-standard names, with
50
+ instructions on where to get the original software distribution.
51
+
52
+ d) make other distribution arrangements with the author.
53
+
54
+ 4. You may modify and include the part of the software into any other
55
+ software (possibly commercial). But some files in the distribution
56
+ are not written by the author, so that they are not under this terms.
57
+
58
+ 5. The scripts and library files supplied as input to or produced as
59
+ output from the software do not automatically fall under the
60
+ copyright of the software, but belong to whomever generated them,
61
+ and may be sold commercially, and may be aggregated with this
62
+ software.
63
+
64
+ 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
65
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
66
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
67
+ PURPOSE.