Commit Graph

711 Commits

Author SHA1 Message Date
Jean Boussier cae219a7aa Release 1.18.4 2024-08-05 11:47:29 +02:00
Jean byroot Boussier 407bdefaf9
Merge pull request #489 from Shopify/fix-load-error
Fix bootsnap setup in environments without bundler
2024-07-17 10:46:08 +02:00
Jean Boussier 7afa95114e Fix bootsnap setup in environments without bundler
Fix: https://github.com/Shopify/bootsnap/issues/488

`ExplicitRequire.with_gems` assumed the provided gems were activated
which is only true if `bundler/setup` was required.

If bootsnap is used without bundler, then we need to explictly
activate the gem before mutating the `$LOAD_PATH`, otherwise
the paths appended during gems activation will be lost once we
exit `with_gems`.
2024-07-17 10:40:00 +02:00
Jean byroot Boussier c5513d977f
Merge pull request #487 from Uaitt/update-gh-action-versions
Update GitHub actions versions
2024-07-12 14:14:09 +02:00
Lorenzo Zabot 65691caae2 Update GitHub actions versions 2024-07-12 14:08:06 +02:00
Jean byroot Boussier 156b8c979e
Merge pull request #485 from Uaitt/changelog-typo
Correct a typo present in the CHANGELOG
2024-05-24 15:30:45 +09:00
Jean byroot Boussier e76fe383d1
Merge pull request #486 from Uaitt/correct-rubocop-offenses
Correct Rubocop offenses
2024-05-24 15:30:32 +09:00
Lorenzo Zabot 9ec8d705ee Correct Rubocop offenses 2024-05-21 09:01:25 +02:00
Lorenzo Zabot 47ad13424d Correct a typo present in the CHANGELOG 2024-05-21 08:57:30 +02:00
Dorian Marié f627992c52 Add --version flag
Fix: https://github.com/Shopify/bootsnap/pull/483
2024-04-04 18:52:27 +02:00
Jean byroot Boussier 87edda3e21
Merge pull request #480 from Shopify/centralize_ruby_version
Use .ruby-version
2024-04-04 13:14:50 +02:00
Étienne Barrié c702303a5b Use .ruby-version 2024-04-04 12:01:27 +02:00
Jean byroot Boussier 5d37046710
Merge pull request #479 from Earlopain/remove-coverage-workaround
Remove coverage workaround
2024-03-05 09:05:54 -05:00
Earlopain cf24e98885
Remove coverage workaround
The running? method has been added in Ruby 2.4
2024-03-05 14:07:32 +01:00
Jean Boussier de109b2e88 Appease rubocop 2024-03-05 06:39:32 -05:00
Jean byroot Boussier 9210a2e4b5
Merge pull request #478 from Earlopain/store-with-broken-symlink
Fix startup failure if the cache directory points to a broken symlink
2024-03-05 06:38:30 -05:00
Earlopain aef82de32c
Fix startup failure if the cache directory points to a broken symlink 2024-03-04 16:19:42 +01:00
Jean Boussier 8394834cd5 Refactor default_setup environment variable parsing
You can now pass `BOOTSNAP_READONLY=0` or `BOOTSNAP_READONLY=false`
which can use useful to unset a default (easier than undefining the
environment variable).
2024-02-02 10:08:07 +01:00
Jean Boussier 811b34adb8 Bump cache version 2024-02-01 17:56:27 +01:00
Jean Boussier 7c99f37c08 Only trigger instrumnetation after cleaning up FDs 2024-02-01 15:24:47 +01:00
Jean Boussier f13dcb38de Enable cache revalidation during precompilation 2024-02-01 15:16:44 +01:00
Jean Boussier 48c08b0dd9 Release 1.18.3 2024-01-31 15:38:53 +01:00
Jean byroot Boussier 08cd0d9937
Merge pull request #476 from Shopify/fix-revalidation
Fix a cache corruption issue during revalidation
2024-01-31 09:53:06 +01:00
Jean Boussier ad189d1367 Fix a cache corruption issue during revalidation
Fix: https://github.com/Shopify/bootsnap/issues/474
Fix: https://github.com/Shopify/bootsnap/issues/471

As noticed by Stan Hu, upon revalidation, we'd corrupt the
`data_size` field, as it wasn't initialized at all on the
cache key we computed from the source file.

The only thing we actually want to update is the `mtime`.

Co-Authored-By: Stan Hu <stanhu@gmail.com>
2024-01-31 09:45:36 +01:00
Jean Boussier 2dba040855 Release 1.18.2 2024-01-31 08:55:17 +01:00
Jean byroot Boussier 38554bb5bb
Merge pull request #475 from Shopify/disable-revalidation-by-default
Disable stale cache entries revalidation by default
2024-01-31 08:54:30 +01:00
Jean Boussier a5b46d0e92 Disable stale cache entries revalidation by default
Ref: https://github.com/Shopify/bootsnap/issues/471
Ref: https://github.com/Shopify/bootsnap/issues/474

Since it is still unclear what causes the corruption, and more
people seem to be running into it, I'd rather make it an opt-in
feature until I get to the bottom of this.
2024-01-31 08:51:15 +01:00
Jean byroot Boussier 4b6d40ef30
Merge pull request #473 from Shopify/gnu-source
Define _GNU_SOURCE properly
2024-01-31 08:36:37 +01:00
Alan Wu 33754b4f0b Define _GNU_SOURCE properly
extconf output shows that it was passing _GNU_SOURCE as a command line
argument and it was failing:

    checking for whether _GNU_SOURCE is accepted as CPPFLAGS... no
2024-01-30 18:30:03 -05:00
Jean Boussier d4b46660cb Workaround fdatasync bug on macOS
Fix: https://github.com/Shopify/bootsnap/issues/470
2024-01-30 18:12:28 +01:00
Jean Boussier c88b4bda88 Include `errno_provenance` in sys_err messages
Helps with debugging nasty issues.
2024-01-30 17:52:02 +01:00
Jean Boussier 34f1be968f Fix extconf.rb to look for fdatasync in unistd.h
Fix: https://github.com/Shopify/bootsnap/issues/470
2024-01-30 17:44:29 +01:00
Jean Boussier bb428132bf Release 1.18.1 2024-01-30 15:35:22 +01:00
Jean Boussier 4dd0c775bf Handle `EPERM` errors when opening files with `O_NOATIME`.
```
       EPERM  The O_NOATIME flag was specified, but the effective user
              ID of the caller did not match the owner of the file and
              the caller was not privileged.
```
2024-01-30 15:22:02 +01:00
Jean Boussier efb56e4227 Release 1.18.0 2024-01-30 15:00:07 +01:00
Jean Boussier 7eb03b2a45 Add `hit` instrumentation events and add log_stat! 2024-01-30 14:59:13 +01:00
Jean byroot Boussier 4a91add2bc
Merge pull request #468 from Shopify/revalidate-mtime
Revalidate cache based on source digest
2024-01-30 13:49:19 +01:00
Étienne Barrié df6267fdfa Revalidate stale entries using a digest.
Ref: https://github.com/Shopify/bootsnap/issues/336

Bootsnap was initially designed for improving boot time
in development, so it was logical to use `mtime` to detect changes
given that's reliable on a given machine.

But is just as useful on production and CI environments, however
there its hit rate can vary a lot because depending on how the
source code and caches are saved and restored, many if not all
`mtime` will have changed.

To improve this, we can first try to revalidate using the `mtime`,
and if it fails, fallback to compare a digest of the file content.
Digesting a file, even with `fnv1a_64` is of course an overhead,
but the assumption is that true misses should be relatively rare
and that digesting the file will always be faster than compiling it.
So even if it only improve the hit rate marginally, it should be
faster overall.

Also we only recompute the digest if the file mtime changed, but
its size remained the same, which should discard the overwhelming
majority of legitimate source file changes.

Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
2024-01-30 13:45:34 +01:00
Jean byroot Boussier c12002fa30
Merge pull request #469 from Shopify/open-noatime
Open with `O_NOATIME`
2024-01-30 10:53:29 +01:00
Jean Boussier 404745f804 Open with O_NOATIME
Should avoid some needless disk access on Linux.

Also cleanup the extconf.rb
2024-01-30 10:49:58 +01:00
Jean Boussier 266b935eff precompile ignore `features` directories (cucumber) 2024-01-29 17:45:53 +01:00
Jean byroot Boussier 457adc5e9f
Merge pull request #467 from Shopify/remove-warning
Remove unused variable warning
2024-01-29 16:27:32 +01:00
Étienne Barrié 3c15095426 Remove unused variable warning
Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
2024-01-29 16:21:59 +01:00
Jean byroot Boussier e0a11fe9e7
Merge pull request #466 from Shopify/precompile-app
Make `precompile --gemfile` consider the entire gem not just `lib/`
2024-01-29 14:48:20 +01:00
Jean Boussier d99b076e7c Make `precompile --gemfile` consider the entire gem not just `lib/`
Fix: https://github.com/Shopify/bootsnap/issues/465

Should catch things such as Rails engines and other Ruby source files
not directly in the load path.
2024-01-29 14:36:29 +01:00
Jean Boussier 06497da38e Release 1.17.1 2024-01-12 11:59:34 +01:00
Jean byroot Boussier e0542c0c6d
Merge pull request #464 from Shopify/handle-prism
Fix a compatibility issues with statically linked libraries (prism)
2024-01-12 11:58:59 +01:00
Jean Boussier a53bad12de Fix a compatibility issues with statically linked libraries (prism)
Fix: https://github.com/Shopify/bootsnap/issues/463
2024-01-12 11:54:40 +01:00
Jean Boussier 070151f130 Fix require and include call style 2023-12-14 10:48:35 +01:00
Jean Boussier 1bc26d1ada Bump rubocop 2023-12-14 10:41:58 +01:00