镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
- 0.14.1 - 14-08-2024

- No longer use mini_racer_loader if LD_PRELOAD is defined and adds a malloc provider. This resolves segfaults when people LD_PRELOAD jemalloc or tcmalloc.

- 0.14.0 - 06-08-2024

Expand Down
25 changes: 17 additions & 8 deletions lib/mini_racer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,23 @@
if RUBY_ENGINE == "truffleruby"
require "mini_racer/truffleruby"
else
require "mini_racer_loader"
ext_filename = "mini_racer_extension.#{RbConfig::CONFIG['DLEXT']}"
ext_path = Gem.loaded_specs['mini_racer'].require_paths
.map { |p| (p = Pathname.new(p)).absolute? ? p : Pathname.new(__dir__).parent + p }
ext_found = ext_path.map { |p| p + ext_filename }.find { |p| p.file? }

raise LoadError, "Could not find #{ext_filename} in #{ext_path.map(&:to_s)}" unless ext_found
MiniRacer::Loader.load(ext_found.to_s)
if ENV["LD_PRELOAD"].to_s.include?("malloc")
require "mini_racer_extension"
else
require "mini_racer_loader"
ext_filename = "mini_racer_extension.#{RbConfig::CONFIG["DLEXT"]}"
ext_path =
Gem.loaded_specs["mini_racer"].require_paths.map do |p|
(p = Pathname.new(p)).absolute? ? p : Pathname.new(__dir__).parent + p
end
ext_found = ext_path.map { |p| p + ext_filename }.find { |p| p.file? }

unless ext_found
raise LoadError,
"Could not find #{ext_filename} in #{ext_path.map(&:to_s)}"
end
MiniRacer::Loader.load(ext_found.to_s)
end
end

require "thread"
Expand Down
2 changes: 1 addition & 1 deletion lib/mini_racer/version.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

module MiniRacer
VERSION = "0.14.0"
VERSION = "0.14.1"
LIBV8_NODE_VERSION = "~> 18.19.0.0"
end
7 changes: 3 additions & 4 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'mini_racer'
$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
require "mini_racer"

require 'minitest/pride'
require 'minitest/autorun'
require "minitest/autorun"