rage-iodine 3.0.8 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/ext/iodine/fio.c +31 -6
- data/ext/iodine/fio.h +12 -0
- data/ext/iodine/http1.c +2 -2
- data/lib/iodine/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef4ff042834d322d1a1eba37963ac373146345da2f167b75b421dbf6449f4060
|
4
|
+
data.tar.gz: 8ca3321bfd60e376ecb10017b118295f82d1ddf9897869f84aefad13909f3dfc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e55be44f50f6a779d9d1457a61dcc9c005055a52c1560dde62fb84d73226b78084a431571af0d3fb24388100236fd39dac0c624a73fab624e0529a20286d0500
|
7
|
+
data.tar.gz: 74e9602b4822a05b2b25f87a0685ed8311afc79dd7e266b1e032906d18e15f0ba186870ea3617682c3939bdd2155e64759193504d8b83d4942ddabe3669c50bb
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,10 @@ 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.1.0 (2024-05-01)
|
10
|
+
|
11
|
+
**Update**: Implement graceful shutdown.
|
12
|
+
|
9
13
|
#### Change log v.3.0.8 (2024-04-12)
|
10
14
|
|
11
15
|
**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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
263
|
+
fio_resume(pr->uuid);
|
264
264
|
}
|
265
265
|
(void)h;
|
266
266
|
}
|
data/lib/iodine/version.rb
CHANGED
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
|
4
|
+
version: 3.1.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-
|
11
|
+
date: 2024-05-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|