bjfish
(Brandon Fish)
4월 28, 2022, 5:06오후
1
TruffleRuby에서 Discourse를 실행하는 데 도움이 되는 다음과 같은 3가지 변경 사항을 요청합니다:
요청된 변경 사항
bin/rails를 업데이트하여 fork가 지원되지 않는 경우 unicorn을 비활성화합니다.
오류
<internal:core> core/kernel.rb:764:in `fork': fork is not available (NotImplementedError)
파일
bin/rails
#!/usr/bin/env ruby
# frozen_string_literal: true
if !ENV["RAILS_ENV"] && (ARGV[0] == "s" || ARGV[0] == "server")
ENV["UNICORN_PORT"] ||= "3000"
if ARGV[1] == "-p" && (port = ARGV[2].to_i) > 0
ENV["UNICORN_PORT"] = port.to_s
end
ENV["RAILS_LOGS_STDOUT"] ||= "1"
exec File.expand_path("unicorn", __dir__)
end
APP_PATH = File.expand_path('../config/application', __dir__)
require_relative '../config/boot'
require 'rails/commands'
이유
TruffleRuby는 forking을 지원하지 않습니다.
제안
!Process.respond_to?(:fork)인 경우 unicorn을 비활성화합니다.
========================================================
요청된 변경 사항
TruffleRuby에서 mini_profiler를 비활성화합니다
오류
<internal:core> core/kernel.rb:236:in `gem_original_require': cannot load such file -- stackprof (LoadError)
파일
config/initializers/006-mini_profiler.rb
# frozen_string_literal: true
# If Mini Profiler is included via gem
if Rails.configuration.respond_to?(:load_mini_profiler) && Rails.configuration.load_mini_profiler
require 'rack-mini-profiler'
require 'stackprof'
begin
require 'memory_profiler'
rescue => e
STDERR.put "#{e} failed to require mini profiler"
end
# initialization is skipped so trigger it
Rack::MiniProfilerRails.initialize!(Rails.application)
end
if defined?(Rack::MiniProfiler) && defined?(Rack::MiniProfiler::Config)
# note, we may want to add some extra security here that disables mini profiler in a multi hosted env unless user global admin
# raw_connection means results are not namespaced
This file has been truncated. show original
이유
Stackprof은 현재 TruffleRuby에서 지원되지 않습니다
제안
RUBY_ENGINE이 "TruffleRuby"인 경우 mini_profiler 로딩을 비활성화합니다
========================================================
요청된 변경 사항
rbtrace 로딩을 방지합니다
rb_trace 로딩을 방지하는 유사한 기존 사용 예:
config.hosts.concat(hosts.split(","))
end
require 'middleware/turbo_dev'
config.middleware.insert 0, Middleware::TurboDev
require 'middleware/missing_avatars'
config.middleware.insert 1, Middleware::MissingAvatars
config.enable_anon_caching = false
if RUBY_ENGINE == "ruby"
require 'rbtrace'
end
if emails = GlobalSetting.developer_emails
config.developer_emails = emails.split(",").map(&:downcase).map(&:strip)
end
if ENV["DISCOURSE_SKIP_CSS_WATCHER"] != "1" && (defined?(Rails::Server) || defined?(Puma) || defined?(Unicorn))
require 'stylesheet/watcher'
STDERR.puts "Starting CSS change watcher"
@watcher = Stylesheet::Watcher.watch
오류
Failure/Error: require ‘rbtrace’
제안
rbtrace 로딩을 방지하기 위해 위의 링크에 있는 방법 중 하나를 사용합니다
파일
spec/rails_helper.rb
SimpleCov.start 'rails' do
add_group 'Libraries', /^\/lib\/(?!tasks).*$/
add_group 'Scripts', 'script'
add_group 'Serializers', 'app/serializers'
add_group 'Services', 'app/services'
add_group 'Tasks', 'lib/tasks'
end
end
require 'rubygems'
require 'rbtrace'
require 'pry'
require 'pry-byebug'
require 'pry-rails'
require 'fabrication'
require 'mocha/api'
require 'certified'
require 'webmock/rspec'
class RspecErrorTracker
def self.last_exception=(ex)
gerhard
(Gerhard Schlager)
4월 29, 2022, 12:12오후
5
그 요청들은 합리적인 것 같습니다.
참고로: TruffleRuby에서 mini_racer가 지원되지 않는다는 점에 대해 변경된 내용이 있나요? 이것이 큰 장애 요인입니다.
Sure I just too care of this there are a few others I left which I am unsure about, what should I do with them? (byebug, ruby-prof, better_errors, rbtrace, gc_tracer, stackprof, memory_profiler)
That said we are totally blocked on truffle till we get mini_racer working per:
https://github.com/oracle/truffleruby/issues/1827
Discourse is not really properly functional if you can not cook Markdown to HTML on the server.
bjfish
(Brandon Fish)
4월 29, 2022, 6:55오후
6
참고: TruffleRuby에서 mini_racer가 지원되지 않는다는 것에 대해 변화가 있었나요? 이는 주요 장애 요소입니다.
TruffleRuby에서 GraalJS를 사용하여 mini_racer 기능의 대부분이 테스트 스위트를 통과하는 브랜치를 가지고 있습니다. Discourse에 필요한 모든 기능을 처리한다고 생각합니다. 검토만 필요하며, 검토 후 병합을 시도하겠습니다. 로컬에서 이렇게 실행하고 있습니다: https://twitter.com/brandonfish/status/1486755128577253376
bjfish
(Brandon Fish)
5월 2, 2022, 3:44오후
7
수정 사항:
RUBY_ENGINE가 “truffleruby”일 때 mini_profiler 로딩을 비활성화하세요
sam
(Sam Saffron)
5월 3, 2022, 5:04오전
8
mini_profiler은 여전히 문제없을 것 같습니다. rbtrace/stackprof 등을 로드하지 않도록 하는 것이 좋겠습니다. 느슨한 의존성이 있습니다.
mini_profiler은 Truffle 환경에서도 여전히 상당한 가치를 제공할 수 있으며, MRI에 특화된 부분은 없습니다.
gerhard
(Gerhard Schlager)
5월 4, 2022, 8:10오후
9
요청하신 변경 사항이 포함된 PR입니다.
main ← truffleruby
merged 01:50AM - 05 May 22 UTC
여전히 성공적으로 실행되지 않았으며 java.lang.NullPointerException이 발생했습니다. 하지만 이는 제가 mini_racer를 대충 비활성화했기 때문일 수도 있습니다. TruffleRuby에서 완전히 기능적으로 동작하는 Discourse를 볼 수 있기를 정말 기대하고 있습니다.
이 부분에 대해 더 깊이 파고들지는 않았지만, stackprof와 memory_profiler의 로딩만 비활성화했을 때 오류를 발견했습니다. 그래서 당분간 mini_profiler를 완전히 비활성화했습니다.
2022-05-04 21:48:13 +0200 Rack app ("POST /mini-profiler-resources/results" - (127.0.0.1)): #<SystemStackError: stack level too deep
from StackOverflowCheckImpl.java:328:in `com.oracle.svm.core.graal.snippets.StackOverflowCheckImpl.newStackOverflowError0'>
다른 문제들의 부수적인 결과일 수도 있습니다. 다른 문제들이 해결된 후에 조사해 볼 수 있을 것 같습니다.