rage-iodine 3.0.8 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 28684763cfb5625db34047326c19994bf2968fd2f5887a7f10e7b981a02ffa06
4
- data.tar.gz: a866b322b86952b229eb2535bc13304d1775ba91eb9465ea430f9316cca436d2
3
+ metadata.gz: 7e0cf25032c21b2f527b8692bfead0da142cecc0bc625eea36da5a45046978ef
4
+ data.tar.gz: 512d45f660c336e8b33dd237fce1eec816828039a4139b71c505b318ecf37ef6
5
5
  SHA512:
6
- metadata.gz: 443787f38785ffdf9ddf4814e69008c3a4e5170a114ccd7a5594d326e2cdf0a4c737791db2a6966bae009e375a93e7b2d895dded05247c29559c085ec7590464
7
- data.tar.gz: 6dd8d7ea2237bf3af87197874bb168b1129e35f0282c81edfa92c681d8d7aa338145b49d4c5bff32c6b0d7b4b780f5c52f4ce9e867654cad514362d78cbf7cb9
6
+ metadata.gz: 82b018d7b9d1b7a3ce6facec12f22e27b1a3699a093571240ccaa95f98985cbf89a88a68821354eb5f5c3deb268f177c990afd2d396c6d776902dbafbcff96c9
7
+ data.tar.gz: 60a58204b498adc19204793c6366168732718393fa8d3cdd49788bc94ae2d6c2a972d912ed51a22b16e24e48850fe05d11cdfb6c5d0839340b7533719267cc3d
data/CHANGELOG.md CHANGED
@@ -6,6 +6,14 @@ Please notice that this change log contains changes for upcoming releases as wel
6
6
 
7
7
  ## Changes:
8
8
 
9
+ #### Change log v.3.2.0 (2024-07-15)
10
+
11
+ **Update**: Explicitly undefine the alloc function on IodineObjectStorage.
12
+
13
+ #### Change log v.3.1.0 (2024-05-01)
14
+
15
+ **Update**: Implement graceful shutdown.
16
+
9
17
  #### Change log v.3.0.8 (2024-04-12)
10
18
 
11
19
  **Fix**: Correctly generate request tags in cluster mode.
data/ext/iodine/fio.c CHANGED
@@ -386,6 +386,8 @@ typedef struct {
386
386
  uint32_t capa;
387
387
  /* connections counted towards shutdown (NOT while running) */
388
388
  uint32_t connection_count;
389
+ /* number of currently paused connections */
390
+ uint32_t async_connection_count;
389
391
  /* thread list */
390
392
  fio_ls_s thread_ids;
391
393
  /* active workers */
@@ -1294,6 +1296,18 @@ static void fio_defer_on_fork(void) {
1294
1296
  #endif
1295
1297
  }
1296
1298
 
1299
+ void fio_graceful_stop(void) {
1300
+ static uint8_t stop_requested;
1301
+
1302
+ if (!fio_data->async_connection_count) {
1303
+ fio_stop();
1304
+ } else if (!stop_requested) {
1305
+ stop_requested = 1;
1306
+ FIO_LOG_INFO("(%d) Waiting for up to 15 seconds to allow active requests to finish...", (int)getpid());
1307
+ fio_run_every(500, 30, (void (*)(void *))fio_graceful_stop, NULL, (void (*)(void *))fio_stop);
1308
+ }
1309
+ }
1310
+
1297
1311
  /* *****************************************************************************
1298
1312
  External Task API
1299
1313
  ***************************************************************************** */
@@ -1695,7 +1709,12 @@ static void sig_int_handler(int sig) {
1695
1709
  #else
1696
1710
  old = &fio_old_sig_term;
1697
1711
  #endif
1698
- fio_stop();
1712
+ if (fio_data->is_worker) {
1713
+ FIO_LOG_INFO("(%d) detected exit signal.", (int)getpid());
1714
+ } else {
1715
+ FIO_LOG_INFO("Server Detected exit signal.");
1716
+ }
1717
+ fio_graceful_stop();
1699
1718
  break;
1700
1719
  #ifndef __MINGW32__
1701
1720
  case SIGPIPE:
@@ -2788,6 +2807,16 @@ void fio_suspend(intptr_t uuid) {
2788
2807
  fio_trylock(&uuid_data(uuid).scheduled);
2789
2808
  }
2790
2809
 
2810
+ void fio_pause(intptr_t uuid) {
2811
+ fio_atomic_add(&fio_data->async_connection_count, 1);
2812
+ fio_suspend(uuid);
2813
+ }
2814
+
2815
+ void fio_resume(intptr_t uuid) {
2816
+ fio_atomic_sub(&fio_data->async_connection_count, 1);
2817
+ fio_force_event(uuid, FIO_EVENT_ON_DATA);
2818
+ }
2819
+
2791
2820
  /* *****************************************************************************
2792
2821
  Section Start Marker
2793
2822
 
@@ -4672,10 +4701,6 @@ static void fio_worker_startup(void) {
4672
4701
  /* performs all clean-up / shutdown requirements except for the exit sequence */
4673
4702
  static void fio_worker_cleanup(void) {
4674
4703
  /* switch to winding down */
4675
- if (fio_data->is_worker)
4676
- FIO_LOG_INFO("(%d) detected exit signal.", (int)getpid());
4677
- else
4678
- FIO_LOG_INFO("Server Detected exit signal.");
4679
4704
  fio_state_callback_force(FIO_CALL_ON_SHUTDOWN);
4680
4705
  for (size_t i = 0; i <= fio_data->max_protocol_fd; ++i) {
4681
4706
  if (fd_data(i).protocol) {
@@ -7211,7 +7236,7 @@ static void fio_cluster_client_handler(struct cluster_pr_s *pr) {
7211
7236
  fio_publish2process(fio_msg_internal_dup(pr->msg));
7212
7237
  break;
7213
7238
  case FIO_CLUSTER_MSG_SHUTDOWN:
7214
- fio_stop();
7239
+ fio_graceful_stop();
7215
7240
  case FIO_CLUSTER_MSG_ERROR: /* fallthrough */
7216
7241
  case FIO_CLUSTER_MSG_PING: /* fallthrough */
7217
7242
  case FIO_CLUSTER_MSG_ROOT: /* fallthrough */
data/ext/iodine/fio.h CHANGED
@@ -707,6 +707,18 @@ void fio_force_event(intptr_t uuid, enum fio_io_event);
707
707
  */
708
708
  void fio_suspend(intptr_t uuid);
709
709
 
710
+ /**
711
+ * Temporarily prevents `on_data` events from firing and increases the number
712
+ * of currently active connections.
713
+ */
714
+ void fio_pause(intptr_t uuid);
715
+
716
+ /**
717
+ * Schedules the `on_data` event and decreases the number of currently active
718
+ * connections.
719
+ */
720
+ void fio_resume(intptr_t uuid);
721
+
710
722
  /* *****************************************************************************
711
723
  Listening to Incoming Connections
712
724
  ***************************************************************************** */
data/ext/iodine/http1.c CHANGED
@@ -251,7 +251,7 @@ static int http1_push_file(http_s *h, FIOBJ filename, FIOBJ mime_type) {
251
251
  */
252
252
  static void http1_on_pause(http_s *h, http_fio_protocol_s *pr) {
253
253
  ((http1pr_s *)pr)->stop = 1;
254
- fio_suspend(pr->uuid);
254
+ fio_pause(pr->uuid);
255
255
  (void)h;
256
256
  }
257
257
 
@@ -260,7 +260,7 @@ static void http1_on_pause(http_s *h, http_fio_protocol_s *pr) {
260
260
  */
261
261
  static void http1_on_resume(http_s *h, http_fio_protocol_s *pr) {
262
262
  if (!((http1pr_s *)pr)->stop) {
263
- fio_force_event(pr->uuid, FIO_EVENT_ON_DATA);
263
+ fio_resume(pr->uuid);
264
264
  }
265
265
  (void)h;
266
266
  }
@@ -131,10 +131,9 @@ struct IodineStorage_s IodineStore = {
131
131
  /** Initializes the storage unit for first use. */
132
132
  void iodine_storage_init(void) {
133
133
  fio_store_capa_require(&iodine_storage, 512);
134
- VALUE tmp =
135
- rb_define_class_under(rb_cObject, "IodineObjectStorage", rb_cObject);
136
- VALUE storage_obj =
137
- TypedData_Wrap_Struct(tmp, &storage_type_struct, &iodine_storage);
134
+ VALUE tmp = rb_define_class_under(rb_cObject, "IodineObjectStorage", rb_cObject);
135
+ rb_undef_alloc_func(tmp);
136
+ VALUE storage_obj = TypedData_Wrap_Struct(tmp, &storage_type_struct, &iodine_storage);
138
137
  // rb_global_variable(&iodine_storage_obj);
139
138
  rb_ivar_set(IodineModule, rb_intern2("storage", 7), storage_obj);
140
139
  rb_define_module_function(IodineBaseModule, "db_print_protected_objects",
@@ -1,3 +1,3 @@
1
1
  module Iodine
2
- VERSION = '3.0.8'.freeze
2
+ VERSION = '3.2.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rage-iodine
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.8
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Boaz Segev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-04-12 00:00:00.000000000 Z
11
+ date: 2024-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -274,7 +274,7 @@ requirements:
274
274
  - Ruby >= 2.5.0 recommended.
275
275
  - TLS requires OpenSSL >= 1.1.0.
276
276
  - Or Windows with Ruby >= 3.0.0 build with MingW and MingW as compiler.
277
- rubygems_version: 3.4.10
277
+ rubygems_version: 3.5.9
278
278
  signing_key:
279
279
  specification_version: 4
280
280
  summary: iodine - a fast HTTP / Websocket Server with Pub/Sub support, optimized for