iodine 0.4.17 → 0.4.18
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of iodine might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -1
- data/ext/iodine/facil.c +7 -4
- data/ext/iodine/iodine_pubsub.c +8 -7
- data/ext/iodine/pubsub.c +8 -5
- 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: 985f5c140335dc38ff849e93d96d906a322a22699695908e998c07c8ee023053
|
4
|
+
data.tar.gz: a5b55c180aeb05a109c5f150e013b2832fd25f95f29b729488fb150f41aaa8f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97061042f83574de4992bacb013083e2eb8172fa79ae9ffea146907e53dfd5240f2fa3e91a213e6d87f90601d017fc4f8d2cf0c07726eb8b35b26f7bf82a8615
|
7
|
+
data.tar.gz: d9ea0fc7a78a0a4d8d59e391f85a4d228ba0878030a1e97333dee70d7b02a84400f8fc40afbf0a486a71d4fceb1f906cb9a5ed8a4e8da961a3c78c50348654c2
|
data/CHANGELOG.md
CHANGED
@@ -8,9 +8,15 @@ Please notice that this change log contains changes for upcoming releases as wel
|
|
8
8
|
|
9
9
|
---
|
10
10
|
|
11
|
+
#### Change log v.0.4.18
|
12
|
+
|
13
|
+
**Fix**: (`iodine pub/bus`) fixed issue #27 (?) where the `block` used for subscriptions would be recycled by the GC and the memory address (retained by `iodine`) would point at invalid Ruby objects (at worst) or become invalid (at best). Credit to Dmitry Davydov (@haukot) for exposing this issue.
|
14
|
+
|
15
|
+
**Fix**: (`facil pub/bus`) fixed issue #27 (?) where the `memcpy` was used instead of `memmove`, resulting in possibly corrupt data in cluster messaging system. Credit to Dmitry Davydov (@haukot) for exposing this issue.
|
16
|
+
|
11
17
|
#### Change log v.0.4.17
|
12
18
|
|
13
|
-
**Fix**: (`iodine RubyCaller`) fixed issue #26 that exposed an issue in the exception handling logic. This fix enforces exception handling whenever entering the Ruby GVL (GIL), allowing C functions to safely enter the user's Ruby code (where before C functions were assumed to be safe and user code would be executed unprotected when routed through certain functions). Credit to @haukot for exposing this issue (issue #26).
|
19
|
+
**Fix**: (`iodine RubyCaller`) fixed issue #26 that exposed an issue in the exception handling logic. This fix enforces exception handling whenever entering the Ruby GVL (GIL), allowing C functions to safely enter the user's Ruby code (where before C functions were assumed to be safe and user code would be executed unprotected when routed through certain functions). Credit to Dmitry Davydov (@haukot) for exposing this issue (issue #26).
|
14
20
|
|
15
21
|
#### Change log v.0.4.16
|
16
22
|
|
data/ext/iodine/facil.c
CHANGED
@@ -761,7 +761,7 @@ static void facil_cluster_on_data(intptr_t uuid, protocol_s *pr_) {
|
|
761
761
|
while (1) {
|
762
762
|
errno = 0;
|
763
763
|
if (pr->read < 8 || pr->read < pr->msg->len) {
|
764
|
-
ssize_t read = sock_read(uuid, (void *)((uintptr_t)pr->msg + pr->read),
|
764
|
+
ssize_t read = sock_read(uuid, (void *)(((uintptr_t)pr->msg) + pr->read),
|
765
765
|
pr->mem_size - pr->read);
|
766
766
|
if (read <= 0) {
|
767
767
|
if (read < 0)
|
@@ -786,10 +786,13 @@ static void facil_cluster_on_data(intptr_t uuid, protocol_s *pr_) {
|
|
786
786
|
}
|
787
787
|
}
|
788
788
|
if ((size_t)(pr->msg->len) <= pr->read) {
|
789
|
+
const size_t msg_len = (size_t)(pr->msg->len);
|
790
|
+
const size_t leftover = (size_t)(pr->read - msg_len);
|
789
791
|
facil_cluster_handle_msg(pr->msg);
|
790
|
-
pr->read =
|
791
|
-
if (
|
792
|
-
|
792
|
+
pr->read = leftover;
|
793
|
+
if (leftover) {
|
794
|
+
memmove(pr->msg, (void *)(((uintptr_t)pr->msg) + msg_len), pr->read);
|
795
|
+
}
|
793
796
|
}
|
794
797
|
}
|
795
798
|
}
|
data/ext/iodine/iodine_pubsub.c
CHANGED
@@ -503,17 +503,18 @@ static VALUE iodine_subscribe(VALUE self, VALUE args) {
|
|
503
503
|
Check_Type(rb_ch, T_STRING);
|
504
504
|
|
505
505
|
VALUE block = rb_block_proc();
|
506
|
+
Registry.add(block);
|
506
507
|
|
507
508
|
pubsub_engine_s *engine =
|
508
509
|
iodine_engine_ruby2facil(rb_hash_aref(args, engine_varid));
|
509
510
|
|
510
|
-
uintptr_t subid =
|
511
|
-
pubsub_subscribe(.channel.name = RSTRING_PTR(rb_ch),
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
511
|
+
uintptr_t subid =
|
512
|
+
(uintptr_t)pubsub_subscribe(.channel.name = RSTRING_PTR(rb_ch),
|
513
|
+
.channel.len = RSTRING_LEN(rb_ch),
|
514
|
+
.engine = engine, .use_pattern = use_pattern,
|
515
|
+
.on_message = on_pubsub_notificationin,
|
516
|
+
.on_unsubscribe = iodine_on_unsubscribe,
|
517
|
+
.udata1 = (void *)block);
|
517
518
|
if (!subid)
|
518
519
|
return Qnil;
|
519
520
|
return ULL2NUM(subid);
|
data/ext/iodine/pubsub.c
CHANGED
@@ -192,15 +192,18 @@ static int pubsub_cluster_publish(struct pubsub_publish_args args) {
|
|
192
192
|
static void pubsub_cluster_handle_publishing(void *data, uint32_t len) {
|
193
193
|
msg_s *msg = data;
|
194
194
|
if (len != sizeof(*msg) + msg->pub.channel.len + msg->pub.msg.len + 2) {
|
195
|
-
fprintf(
|
196
|
-
|
195
|
+
fprintf(
|
196
|
+
stderr,
|
197
|
+
"ERROR: (pub/sub) cluster message size error. Message ignored.\n"
|
198
|
+
" expecting %zu (ch: %zu, msg: %zu), got %zu\n",
|
199
|
+
(size_t)(sizeof(*msg) + msg->pub.channel.len + msg->pub.msg.len + 2),
|
200
|
+
(size_t)msg->pub.channel.len, (size_t)msg->pub.msg.len, (size_t)len);
|
197
201
|
return;
|
198
202
|
}
|
199
203
|
msg = malloc(len);
|
200
204
|
if (!msg) {
|
201
|
-
fprintf(
|
202
|
-
|
203
|
-
"ERROR: (pub/sub) cluster message allocation error.Message ignored.\n");
|
205
|
+
fprintf(stderr, "ERROR: (pub/sub) cluster message allocation error. "
|
206
|
+
"Message ignored.\n");
|
204
207
|
return;
|
205
208
|
}
|
206
209
|
memcpy(msg, data, len);
|
data/lib/iodine/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iodine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Boaz Segev
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-03-
|
11
|
+
date: 2018-03-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|