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
@@ -2,10 +2,10 @@
2
2
  #
3
3
  # This configuration file documents many features of Unicorn
4
4
  # that may not be needed for some applications. See
5
- # http://unicorn.bogomips.org/examples/unicorn.conf.minimal.rb
5
+ # https://bogomips.org/unicorn/examples/unicorn.conf.minimal.rb
6
6
  # for a much simpler configuration file.
7
7
  #
8
- # See http://unicorn.bogomips.org/Unicorn/Configurator.html for complete
8
+ # See https://bogomips.org/unicorn/Unicorn/Configurator.html for complete
9
9
  # documentation.
10
10
 
11
11
  # Use at least one worker per core if you're on a dedicated server,
@@ -11,6 +11,8 @@ Wants = unicorn.socket
11
11
  After = unicorn.socket
12
12
 
13
13
  [Service]
14
+ # bundler users must use the "--keep-file-descriptors" switch, here:
15
+ # ExecStart = bundle exec --keep-file-descriptors unicorn -c ...
14
16
  ExecStart = /usr/bin/unicorn -c /path/to/unicorn.conf.rb /path/to/config.ru
15
17
  Sockets = unicorn.socket
16
18
  KillSignal = SIGQUIT
@@ -22,5 +24,10 @@ ExecReload = /bin/kill -HUP $MAINPID
22
24
  # adding a few seconds for scheduling differences:
23
25
  TimeoutStopSec = 62
24
26
 
27
+ # Only kill the master process, it may be harmful to signal
28
+ # workers via default "control-group" setting since some
29
+ # Ruby extensions and applications misbehave on interrupts
30
+ KillMode = process
31
+
25
32
  [Install]
26
33
  WantedBy = multi-user.target
@@ -60,7 +60,7 @@ static struct common_field common_http_fields[] = {
60
60
  #define HTTP_PREFIX_LEN (sizeof(HTTP_PREFIX) - 1)
61
61
 
62
62
  /* this function is not performance-critical, called only at load time */
63
- static void init_common_fields(void)
63
+ static void init_common_fields(VALUE mark_ary)
64
64
  {
65
65
  int i;
66
66
  struct common_field *cf = common_http_fields;
@@ -77,7 +77,7 @@ static void init_common_fields(void)
77
77
  cf->value = rb_str_new(tmp, HTTP_PREFIX_LEN + cf->len);
78
78
  }
79
79
  cf->value = rb_obj_freeze(cf->value);
80
- rb_global_variable(&cf->value);
80
+ rb_ary_push(mark_ary, cf->value);
81
81
  }
82
82
  }
83
83
 
@@ -1,26 +1,6 @@
1
1
  #ifndef ext_help_h
2
2
  #define ext_help_h
3
3
 
4
- #ifndef RSTRING_PTR
5
- #define RSTRING_PTR(s) (RSTRING(s)->ptr)
6
- #endif /* !defined(RSTRING_PTR) */
7
- #ifndef RSTRING_LEN
8
- #define RSTRING_LEN(s) (RSTRING(s)->len)
9
- #endif /* !defined(RSTRING_LEN) */
10
-
11
- #ifndef HAVE_RB_STR_SET_LEN
12
- # ifdef RUBINIUS
13
- # error we should never get here with current Rubinius (1.x)
14
- # endif
15
- /* this is taken from Ruby 1.8.7, 1.8.6 may not have it */
16
- static void rb_18_str_set_len(VALUE str, long len)
17
- {
18
- RSTRING(str)->len = len;
19
- RSTRING(str)->ptr[len] = '\0';
20
- }
21
- # define rb_str_set_len(str,len) rb_18_str_set_len(str,len)
22
- #endif /* !defined(HAVE_RB_STR_SET_LEN) */
23
-
24
4
  /* not all Ruby implementations support frozen objects (Rubinius does not) */
25
5
  #if defined(OBJ_FROZEN)
26
6
  # define assert_frozen(f) assert(OBJ_FROZEN(f) && "unfrozen object")
@@ -4,7 +4,7 @@ require 'mkmf'
4
4
  have_macro("SIZEOF_OFF_T", "ruby.h") or check_sizeof("off_t", "sys/types.h")
5
5
  have_macro("SIZEOF_SIZE_T", "ruby.h") or check_sizeof("size_t", "sys/types.h")
6
6
  have_macro("SIZEOF_LONG", "ruby.h") or check_sizeof("long", "sys/types.h")
7
- have_func("rb_str_set_len", "ruby.h")
7
+ have_func("rb_str_set_len", "ruby.h") or abort 'Ruby 1.9.3+ required'
8
8
  have_func("rb_hash_clear", "ruby.h") # Ruby 2.0+
9
9
  have_func("gmtime_r", "time.h")
10
10
 
@@ -56,7 +56,7 @@ NORETURN(static void parser_raise(VALUE klass, const char *));
56
56
  /** Defines global strings in the init method. */
57
57
  #define DEF_GLOBAL(N, val) do { \
58
58
  g_##N = rb_obj_freeze(rb_str_new(val, sizeof(val) - 1)); \
59
- rb_global_variable(&g_##N); \
59
+ rb_ary_push(mark_ary, g_##N); \
60
60
  } while (0)
61
61
 
62
62
  /* Defines the maximum allowed lengths for various input elements.*/
@@ -67,7 +67,7 @@ DEF_MAX_LENGTH(FRAGMENT, 1024); /* Don't know if this length is specified somewh
67
67
  DEF_MAX_LENGTH(REQUEST_PATH, 4096); /* common PATH_MAX on modern systems */
68
68
  DEF_MAX_LENGTH(QUERY_STRING, (1024 * 10));
69
69
 
70
- static void init_globals(void)
70
+ static void init_globals(VALUE mark_ary)
71
71
  {
72
72
  DEF_GLOBAL(rack_url_scheme, "rack.url_scheme");
73
73
  DEF_GLOBAL(request_method, "REQUEST_METHOD");
@@ -64,13 +64,13 @@ static VALUE httpdate(VALUE self)
64
64
  return buf;
65
65
  }
66
66
 
67
- void init_unicorn_httpdate(void)
67
+ void init_unicorn_httpdate(VALUE mark_ary)
68
68
  {
69
69
  VALUE mod = rb_define_module("Unicorn");
70
70
  mod = rb_define_module_under(mod, "HttpResponse");
71
71
 
72
72
  buf = rb_str_new(0, buf_capa - 1);
73
- rb_global_variable(&buf);
73
+ rb_ary_push(mark_ary, buf);
74
74
  buf_ptr = RSTRING_PTR(buf);
75
75
  httpdate(Qnil);
76
76