bootsnap 1.18.1 → 1.18.2
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/bootsnap/bootsnap.c +30 -2
- data/ext/bootsnap/extconf.rb +2 -2
- data/lib/bootsnap/compile_cache.rb +2 -1
- data/lib/bootsnap/version.rb +1 -1
- data/lib/bootsnap.rb +2 -0
- 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: 219e1686c3d7b3a3c3d0e4814c27842f1e1e9ab35958a1a655532ccaedfa4702
|
4
|
+
data.tar.gz: 439966933d2dea1cf428b6b61d5e8e72e3c9e7963a00938aff46622a5f7342bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6232067f5e67dc414233738b2d1e6390cf17726d78efe6150d30ccd7b7d2e206c68515ddb182988537331982e206be60e3c974fba779ca98a42810084507a827
|
7
|
+
data.tar.gz: 6d7aa8fc570210a4798903e6150a5e97de4d67e29729c8a04db3ca2aae7bd47f3d9257e8b961158155103306e4ec99f8d50a94cac2c2798c86471d7219038d49
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Unreleased
|
2
2
|
|
3
|
+
# 1.18.2
|
4
|
+
|
5
|
+
* Disable stale cache entries revalidation by default as it seems to cause cache corruption issues. See #471 and #474.
|
6
|
+
Will be re-enabled in a future version once the root cause is identified.
|
7
|
+
* Fix a potential compilation issue on some systems. See #470.
|
8
|
+
|
3
9
|
# 1.18.1
|
4
10
|
|
5
11
|
* Handle `EPERM` errors when opening files with `O_NOATIME`.
|
data/ext/bootsnap/bootsnap.c
CHANGED
@@ -18,8 +18,15 @@
|
|
18
18
|
#include <sys/types.h>
|
19
19
|
#include <errno.h>
|
20
20
|
#include <fcntl.h>
|
21
|
+
#include <unistd.h>
|
21
22
|
#include <sys/stat.h>
|
22
23
|
|
24
|
+
#ifdef __APPLE__
|
25
|
+
// The symbol is present, however not in the headers
|
26
|
+
// See: https://github.com/Shopify/bootsnap/issues/470
|
27
|
+
extern int fdatasync(int);
|
28
|
+
#endif
|
29
|
+
|
23
30
|
#ifndef O_NOATIME
|
24
31
|
#define O_NOATIME 0
|
25
32
|
#endif
|
@@ -96,11 +103,13 @@ static ID instrumentation_method;
|
|
96
103
|
static VALUE sym_hit, sym_miss, sym_stale, sym_revalidated;
|
97
104
|
static bool instrumentation_enabled = false;
|
98
105
|
static bool readonly = false;
|
106
|
+
static bool revalidation = false;
|
99
107
|
static bool perm_issue = false;
|
100
108
|
|
101
109
|
/* Functions exposed as module functions on Bootsnap::CompileCache::Native */
|
102
110
|
static VALUE bs_instrumentation_enabled_set(VALUE self, VALUE enabled);
|
103
111
|
static VALUE bs_readonly_set(VALUE self, VALUE enabled);
|
112
|
+
static VALUE bs_revalidation_set(VALUE self, VALUE enabled);
|
104
113
|
static VALUE bs_compile_option_crc32_set(VALUE self, VALUE crc32_v);
|
105
114
|
static VALUE bs_rb_fetch(VALUE self, VALUE cachedir_v, VALUE path_v, VALUE handler, VALUE args);
|
106
115
|
static VALUE bs_rb_precompile(VALUE self, VALUE cachedir_v, VALUE path_v, VALUE handler);
|
@@ -183,6 +192,7 @@ Init_bootsnap(void)
|
|
183
192
|
|
184
193
|
rb_define_module_function(rb_mBootsnap, "instrumentation_enabled=", bs_instrumentation_enabled_set, 1);
|
185
194
|
rb_define_module_function(rb_mBootsnap_CompileCache_Native, "readonly=", bs_readonly_set, 1);
|
195
|
+
rb_define_module_function(rb_mBootsnap_CompileCache_Native, "revalidation=", bs_revalidation_set, 1);
|
186
196
|
rb_define_module_function(rb_mBootsnap_CompileCache_Native, "coverage_running?", bs_rb_coverage_running, 0);
|
187
197
|
rb_define_module_function(rb_mBootsnap_CompileCache_Native, "fetch", bs_rb_fetch, 4);
|
188
198
|
rb_define_module_function(rb_mBootsnap_CompileCache_Native, "precompile", bs_rb_precompile, 3);
|
@@ -214,6 +224,13 @@ bs_readonly_set(VALUE self, VALUE enabled)
|
|
214
224
|
return enabled;
|
215
225
|
}
|
216
226
|
|
227
|
+
static VALUE
|
228
|
+
bs_revalidation_set(VALUE self, VALUE enabled)
|
229
|
+
{
|
230
|
+
revalidation = RTEST(enabled);
|
231
|
+
return enabled;
|
232
|
+
}
|
233
|
+
|
217
234
|
/*
|
218
235
|
* Bootsnap's ruby code registers a hook that notifies us via this function
|
219
236
|
* when compile_option changes. These changes invalidate all existing caches.
|
@@ -318,7 +335,12 @@ static enum cache_status cache_key_equal_fast_path(struct bs_cache_key *k1,
|
|
318
335
|
k1->ruby_platform == k2->ruby_platform &&
|
319
336
|
k1->compile_option == k2->compile_option &&
|
320
337
|
k1->ruby_revision == k2->ruby_revision && k1->size == k2->size) {
|
321
|
-
|
338
|
+
if (k1->mtime == k2->mtime) {
|
339
|
+
return hit;
|
340
|
+
}
|
341
|
+
if (revalidation) {
|
342
|
+
return stale;
|
343
|
+
}
|
322
344
|
}
|
323
345
|
return miss;
|
324
346
|
}
|
@@ -508,7 +530,7 @@ open_cache_file(const char * path, struct bs_cache_key * key, const char ** errn
|
|
508
530
|
{
|
509
531
|
int fd, res;
|
510
532
|
|
511
|
-
if (readonly) {
|
533
|
+
if (readonly || !revalidation) {
|
512
534
|
fd = bs_open_noatime(path, O_RDONLY);
|
513
535
|
} else {
|
514
536
|
fd = bs_open_noatime(path, O_RDWR);
|
@@ -908,6 +930,12 @@ succeed:
|
|
908
930
|
return output_data;
|
909
931
|
fail_errno:
|
910
932
|
CLEANUP;
|
933
|
+
if (errno_provenance) {
|
934
|
+
exception_message = rb_str_concat(
|
935
|
+
rb_str_new_cstr(errno_provenance),
|
936
|
+
rb_str_concat(rb_str_new_cstr(": "), exception_message)
|
937
|
+
);
|
938
|
+
}
|
911
939
|
exception = rb_syserr_new_str(errno, exception_message);
|
912
940
|
rb_exc_raise(exception);
|
913
941
|
__builtin_unreachable();
|
data/ext/bootsnap/extconf.rb
CHANGED
@@ -3,10 +3,10 @@
|
|
3
3
|
require "mkmf"
|
4
4
|
|
5
5
|
if %w[ruby truffleruby].include?(RUBY_ENGINE)
|
6
|
-
have_func "fdatasync", "
|
6
|
+
have_func "fdatasync", "unistd.h"
|
7
7
|
|
8
8
|
unless RUBY_PLATFORM.match?(/mswin|mingw|cygwin/)
|
9
|
-
append_cppflags ["
|
9
|
+
append_cppflags ["-D_GNU_SOURCE"] # Needed of O_NOATIME
|
10
10
|
end
|
11
11
|
|
12
12
|
append_cflags ["-O3", "-std=c99"]
|
@@ -9,7 +9,7 @@ module Bootsnap
|
|
9
9
|
|
10
10
|
Error = Class.new(StandardError)
|
11
11
|
|
12
|
-
def self.setup(cache_dir:, iseq:, yaml:, json:, readonly: false)
|
12
|
+
def self.setup(cache_dir:, iseq:, yaml:, json:, readonly: false, revalidation: false)
|
13
13
|
if iseq
|
14
14
|
if supported?
|
15
15
|
require_relative "compile_cache/iseq"
|
@@ -39,6 +39,7 @@ module Bootsnap
|
|
39
39
|
|
40
40
|
if supported? && defined?(Bootsnap::CompileCache::Native)
|
41
41
|
Bootsnap::CompileCache::Native.readonly = readonly
|
42
|
+
Bootsnap::CompileCache::Native.revalidation = revalidation
|
42
43
|
end
|
43
44
|
end
|
44
45
|
|
data/lib/bootsnap/version.rb
CHANGED
data/lib/bootsnap.rb
CHANGED
@@ -51,6 +51,7 @@ module Bootsnap
|
|
51
51
|
load_path_cache: true,
|
52
52
|
ignore_directories: nil,
|
53
53
|
readonly: false,
|
54
|
+
revalidation: false,
|
54
55
|
compile_cache_iseq: true,
|
55
56
|
compile_cache_yaml: true,
|
56
57
|
compile_cache_json: true
|
@@ -70,6 +71,7 @@ module Bootsnap
|
|
70
71
|
yaml: compile_cache_yaml,
|
71
72
|
json: compile_cache_json,
|
72
73
|
readonly: readonly,
|
74
|
+
revalidation: revalidation,
|
73
75
|
)
|
74
76
|
end
|
75
77
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bootsnap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.18.
|
4
|
+
version: 1.18.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Burke Libbey
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-01-
|
11
|
+
date: 2024-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: msgpack
|