rage-iodine 3.3.0 → 4.0.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 +6 -0
- data/ext/iodine/fio.c +16 -6
- data/ext/iodine/scheduler.c +9 -3
- data/lib/iodine/version.rb +1 -1
- data/lib/iodine.rb +0 -14
- 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: 26936e113c659cee25877d312515e6fe50ca5ed56ff5e8195e6f5274292f2145
|
4
|
+
data.tar.gz: 40b7aa9c791a5bc08513e5e0c478c02274a39c81d9be0fab7736f8478157ffab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a789b92abed8d78b010ace73cb41d1688ff50c4fc6b590b6705a717196c212721039e252461ba8834a8f0bcd43679fc9c611a9f4d4690a826f3ac212bb3b9e5
|
7
|
+
data.tar.gz: 446a4ecf05a3b371266ea71a92cb514d9a510d2c0fb6dc72e212ff26253e60c343bfc1675a68e6f3c9985c267b9940e61492706f4e61d89e6cb73dbba6c05a2c
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,12 @@ Please notice that this change log contains changes for upcoming releases as wel
|
|
6
6
|
|
7
7
|
## Changes:
|
8
8
|
|
9
|
+
#### Change log v.4.0.0 (2024-09-11)
|
10
|
+
|
11
|
+
**Update**: Stop disconnecting from the DB on fork.
|
12
|
+
|
13
|
+
**Update**: Fiber Scheduler updates to correctly close file descriptors.
|
14
|
+
|
9
15
|
#### Change log v.3.3.0 (2024-08-18)
|
10
16
|
|
11
17
|
**Update**: Improvements and fixes for the static file service.
|
data/ext/iodine/fio.c
CHANGED
@@ -363,6 +363,8 @@ typedef struct {
|
|
363
363
|
uint8_t open;
|
364
364
|
/** indicated that the connection should be closed. */
|
365
365
|
uint8_t close;
|
366
|
+
/** indicates whether the fd is coming from the Fiber Scheduler. */
|
367
|
+
uint8_t internal;
|
366
368
|
/** peer address length */
|
367
369
|
uint8_t addr_len;
|
368
370
|
/** peer address */
|
@@ -2075,7 +2077,7 @@ static size_t fio_poll(void) {
|
|
2075
2077
|
epoll_wait(internal[j].data.fd, events, FIO_POLL_MAX_EVENTS, 0);
|
2076
2078
|
if (active_count > 0) {
|
2077
2079
|
for (int i = 0; i < active_count; i++) {
|
2078
|
-
if (events[i].events & (~(EPOLLIN | EPOLLOUT | EPOLLHUP | EPOLLRDHUP))) {
|
2080
|
+
if (events[i].events & (~(EPOLLIN | EPOLLOUT | EPOLLHUP | EPOLLRDHUP | EPOLLERR))) {
|
2079
2081
|
// errors are hendled as disconnections (on_close)
|
2080
2082
|
fio_force_close_in_poll(fd2uuid(events[i].data.fd));
|
2081
2083
|
} else {
|
@@ -2088,9 +2090,12 @@ static size_t fio_poll(void) {
|
|
2088
2090
|
fio_defer_push_task(deferred_on_data,
|
2089
2091
|
(void *)fd2uuid(events[i].data.fd), NULL);
|
2090
2092
|
}
|
2091
|
-
if (events[i].events & (EPOLLHUP | EPOLLRDHUP)) {
|
2092
|
-
|
2093
|
-
|
2093
|
+
if (events[i].events & (EPOLLHUP | EPOLLRDHUP | EPOLLERR)) {
|
2094
|
+
if(fd_data(events[i].data.fd).internal) {
|
2095
|
+
fio_force_close_in_poll(fd2uuid(events[i].data.fd));
|
2096
|
+
} else {
|
2097
|
+
fio_clear_fd((intptr_t)events[i].data.fd, 0);
|
2098
|
+
}
|
2094
2099
|
}
|
2095
2100
|
}
|
2096
2101
|
} // end for loop
|
@@ -2226,8 +2231,11 @@ static size_t fio_poll(void) {
|
|
2226
2231
|
NULL);
|
2227
2232
|
}
|
2228
2233
|
if (events[i].flags & (EV_EOF | EV_ERROR)) {
|
2229
|
-
|
2230
|
-
|
2234
|
+
if(fd_data(events[i].udata).internal) {
|
2235
|
+
fio_force_close_in_poll(fd2uuid(events[i].udata));
|
2236
|
+
} else {
|
2237
|
+
fio_clear_fd((intptr_t)events[i].udata, 0);
|
2238
|
+
}
|
2231
2239
|
}
|
2232
2240
|
}
|
2233
2241
|
} else if (active_count < 0) {
|
@@ -4033,6 +4041,7 @@ static int fio_attach__internal(void *uuid_, void *protocol_) {
|
|
4033
4041
|
}
|
4034
4042
|
fio_protocol_s *old_pr = uuid_data(uuid).protocol;
|
4035
4043
|
uuid_data(uuid).open = 1;
|
4044
|
+
uuid_data(uuid).internal = 1;
|
4036
4045
|
uuid_data(uuid).protocol = protocol;
|
4037
4046
|
touchfd(fio_uuid2fd(uuid));
|
4038
4047
|
fio_unlock(&uuid_data(uuid).protocol_lock);
|
@@ -4093,6 +4102,7 @@ static int fio_watch__internal(void *uuid_, void *protocol_) {
|
|
4093
4102
|
|
4094
4103
|
fio_protocol_s *old_pr = uuid_data(uuid).protocol;
|
4095
4104
|
uuid_data(uuid).open = 1;
|
4105
|
+
uuid_data(uuid).internal = 0;
|
4096
4106
|
uuid_data(uuid).protocol = protocol;
|
4097
4107
|
touchfd(fio_uuid2fd(uuid));
|
4098
4108
|
fio_unlock(&uuid_data(uuid).protocol_lock);
|
data/ext/iodine/scheduler.c
CHANGED
@@ -15,7 +15,8 @@
|
|
15
15
|
static ID call_id;
|
16
16
|
static uint8_t ATTACH_ON_READ_READY_CALLBACK;
|
17
17
|
static uint8_t ATTACH_ON_WRITE_READY_CALLBACK;
|
18
|
-
static VALUE
|
18
|
+
static VALUE e_timeout_args[1];
|
19
|
+
static VALUE e_closed_args[1];
|
19
20
|
|
20
21
|
/* *****************************************************************************
|
21
22
|
Fiber Scheduler API
|
@@ -36,6 +37,10 @@ typedef struct {
|
|
36
37
|
static void iodine_scheduler_task_close(intptr_t uuid, fio_protocol_s *fio_protocol) {
|
37
38
|
scheduler_protocol_s *protocol = (scheduler_protocol_s *)fio_protocol;
|
38
39
|
|
40
|
+
if (!protocol->fulfilled) {
|
41
|
+
IodineCaller.call2(protocol->block, call_id, 1, e_closed_args);
|
42
|
+
}
|
43
|
+
|
39
44
|
IodineStore.remove(protocol->block);
|
40
45
|
fio_free(protocol);
|
41
46
|
|
@@ -57,7 +62,7 @@ static void iodine_scheduler_task_timeout(intptr_t uuid, fio_protocol_s *fio_pro
|
|
57
62
|
scheduler_protocol_s *protocol = (scheduler_protocol_s *)fio_protocol;
|
58
63
|
|
59
64
|
if (!protocol->fulfilled) {
|
60
|
-
IodineCaller.call2(protocol->block, call_id, 1,
|
65
|
+
IodineCaller.call2(protocol->block, call_id, 1, e_timeout_args);
|
61
66
|
protocol->fulfilled = 1;
|
62
67
|
}
|
63
68
|
}
|
@@ -178,7 +183,8 @@ Scheduler initialization
|
|
178
183
|
|
179
184
|
void iodine_scheduler_initialize(void) {
|
180
185
|
call_id = rb_intern2("call", 4);
|
181
|
-
|
186
|
+
e_timeout_args[0] = INT2NUM(-ETIMEDOUT);
|
187
|
+
e_closed_args[0] = INT2NUM(-EIO);
|
182
188
|
|
183
189
|
VALUE SchedulerModule = rb_define_module_under(IodineModule, "Scheduler");
|
184
190
|
|
data/lib/iodine/version.rb
CHANGED
data/lib/iodine.rb
CHANGED
@@ -156,12 +156,6 @@ require 'rack/handler/iodine' unless defined? ::Iodine::Rack::IODINE_RACK_LOADED
|
|
156
156
|
|
157
157
|
### Automatic ActiveRecord and Sequel support for forking (preventing connection sharing)
|
158
158
|
Iodine.on_state(:before_fork) do
|
159
|
-
if defined?(ActiveRecord) && defined?(ActiveRecord::Base) && ActiveRecord::Base.respond_to?(:connection)
|
160
|
-
begin
|
161
|
-
ActiveRecord::Base.connection.disconnect!
|
162
|
-
rescue
|
163
|
-
end
|
164
|
-
end
|
165
159
|
if defined?(Sequel)
|
166
160
|
begin
|
167
161
|
Sequel::DATABASES.each { |database| database.disconnect }
|
@@ -169,14 +163,6 @@ Iodine.on_state(:before_fork) do
|
|
169
163
|
end
|
170
164
|
end
|
171
165
|
end
|
172
|
-
Iodine.on_state(:after_fork) do
|
173
|
-
if defined?(ActiveRecord) && defined?(ActiveRecord::Base) && ActiveRecord::Base.respond_to?(:establish_connection)
|
174
|
-
begin
|
175
|
-
ActiveRecord::Base.establish_connection
|
176
|
-
rescue
|
177
|
-
end
|
178
|
-
end
|
179
|
-
end
|
180
166
|
|
181
167
|
### Parse CLI for default HTTP settings
|
182
168
|
Iodine::Base::CLI.parse if defined?(IODINE_PARSE_CLI) && IODINE_PARSE_CLI
|
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:
|
4
|
+
version: 4.0.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-09-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|