Generated by trace_location at 2019-06-06 08:18:16 +0900
activerecord-5.2.2.1/lib/active_record/connection_handling.rb:89
def connection
retrieve_connection
end
# called from (pry):1
activerecord-5.2.2.1/lib/active_record/connection_handling.rb:117
def retrieve_connection
connection_handler.retrieve_connection(connection_specification_name)
end
# called from activerecord-5.2.2.1/lib/active_record/connection_handling.rb:90
activerecord-5.2.2.1/lib/active_record/core.rb:130
def self.connection_handler
ActiveRecord::RuntimeRegistry.connection_handler || default_connection_handler
end
# called from activerecord-5.2.2.1/lib/active_record/connection_handling.rb:118
activerecord-5.2.2.1/lib/active_record/runtime_registry.rb:20
class_eval %{ def self.#{val}; instance.#{val}; end }, __FILE__, __LINE__
# called from activerecord-5.2.2.1/lib/active_record/core.rb:131
activesupport-5.2.2.1/lib/active_support/per_thread_registry.rb:46
def instance
Thread.current[@per_thread_registry_key] ||= new
end
# called from activerecord-5.2.2.1/lib/active_record/runtime_registry.rb:20
activesupport-5.2.2.1/lib/active_support/core_ext/class/attribute.rb:106
redefine_method(name) { val }
# called from activerecord-5.2.2.1/lib/active_record/core.rb:131
activerecord-5.2.2.1/lib/active_record/connection_handling.rb:96
def connection_specification_name
if !defined?(@connection_specification_name) || @connection_specification_name.nil?
return self == Base ? "primary" : superclass.connection_specification_name
end
@connection_specification_name
end
# called from activerecord-5.2.2.1/lib/active_record/connection_handling.rb:118
activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:1007
def retrieve_connection(spec_name) #:nodoc:
pool = retrieve_connection_pool(spec_name)
raise ConnectionNotEstablished, "No connection pool with '#{spec_name}' found." unless pool
pool.connection
end
# called from activerecord-5.2.2.1/lib/active_record/connection_handling.rb:118
activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:1035
def retrieve_connection_pool(spec_name)
owner_to_pool.fetch(spec_name) do
# Check if a connection was previously established in an ancestor process,
# which may have been forked.
if ancestor_pool = pool_from_any_process_for(spec_name)
# A connection was established in an ancestor process that must have
# subsequently forked. We can't reuse the connection, but we can copy
# the specification and establish a new connection with it.
establish_connection(ancestor_pool.spec.to_hash).tap do |pool|
pool.schema_cache = ancestor_pool.schema_cache if ancestor_pool.schema_cache
end
else
owner_to_pool[spec_name] = nil
end
end
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:1008
activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:1054
def owner_to_pool
@owner_to_pool[Process.pid]
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:1036
concurrent-ruby-1.1.5/lib/concurrent/map.rb:132
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:1055
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:19
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from concurrent-ruby-1.1.5/lib/concurrent/map.rb:133
concurrent-ruby-1.1.5/lib/concurrent/map.rb:168
def fetch(key, default_value = NULL)
if NULL != (value = get_or_default(key, NULL))
value
elsif block_given?
yield key
elsif NULL != default_value
default_value
else
raise_fetch_no_key
end
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:1036
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:108
def get_or_default(key, default_value)
@backend.fetch(key, default_value)
end
# called from concurrent-ruby-1.1.5/lib/concurrent/map.rb:169
activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:381
def connection
@thread_cached_conns[connection_cache_key(@lock_thread || Thread.current)] ||= checkout
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:1010
activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:667
def connection_cache_key(thread)
thread
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:382
concurrent-ruby-1.1.5/lib/concurrent/map.rb:132
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:382
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:19
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from concurrent-ruby-1.1.5/lib/concurrent/map.rb:133
activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:522
def checkout(checkout_timeout = @checkout_timeout)
checkout_and_verify(acquire_connection(checkout_timeout))
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:382
activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:788
def acquire_connection(checkout_timeout)
# NOTE: we rely on <tt>@available.poll</tt> and +try_to_checkout_new_connection+ to
# +conn.lease+ the returned connection (and to do this in a +synchronized+
# section). This is not the cleanest implementation, as ideally we would
# <tt>synchronize { conn.lease }</tt> in this method, but by leaving it to <tt>@available.poll</tt>
# and +try_to_checkout_new_connection+ we can piggyback on +synchronize+ sections
# of the said methods and avoid an additional +synchronize+ overhead.
if conn = @available.poll || try_to_checkout_new_connection
conn
else
reap
@available.poll(checkout_timeout)
end
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:523
activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:144
def poll(timeout = nil)
synchronize { internal_poll(timeout) }
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:795
activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:154
def synchronize(&block)
@lock.synchronize(&block)
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:145
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:227
def mon_synchronize
mon_enter
begin
yield
ensure
mon_exit
end
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:155
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:187
def mon_enter
if @mon_owner != Thread.current
@mon_mutex.lock
@mon_owner = Thread.current
@mon_count = 0
end
@mon_count += 1
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:228
activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:276
def internal_poll(timeout)
conn = super
conn.lease if conn
conn
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:145
activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:150
def internal_poll(timeout)
conn = super
conn.lease if conn
conn
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:277
activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:179
def no_wait_poll
remove if can_remove_no_wait?
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:151
activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:167
def can_remove_no_wait?
@queue.size > @num_waiting
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:180
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:199
def mon_exit
mon_check_owner
@mon_count -=1
if @mon_count == 0
@mon_owner = nil
@mon_mutex.unlock
end
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:232
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:267
def mon_check_owner
if @mon_owner != Thread.current
raise ThreadError, "current thread not owner"
end
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:200
activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:821
def try_to_checkout_new_connection
# first in synchronized section check if establishing new conns is allowed
# and increment @now_connecting, to prevent overstepping this pool's @size
# constraint
do_checkout = synchronize do
if @threads_blocking_new_connections.zero? && (@connections.size + @now_connecting) < @size
@now_connecting += 1
end
end
if do_checkout
begin
# if successfully incremented @now_connecting establish new connection
# outside of synchronized section
conn = checkout_new_connection
ensure
synchronize do
if conn
adopt_connection(conn)
# returned conn needs to be already leased
conn.lease
end
@now_connecting -= 1
end
end
end
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:795
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:227
def mon_synchronize
mon_enter
begin
yield
ensure
mon_exit
end
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:825
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:187
def mon_enter
if @mon_owner != Thread.current
@mon_mutex.lock
@mon_owner = Thread.current
@mon_count = 0
end
@mon_count += 1
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:228
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:199
def mon_exit
mon_check_owner
@mon_count -=1
if @mon_count == 0
@mon_owner = nil
@mon_mutex.unlock
end
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:232
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:267
def mon_check_owner
if @mon_owner != Thread.current
raise ThreadError, "current thread not owner"
end
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:200
activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:853
def checkout_new_connection
raise ConnectionNotEstablished unless @automatic_reconnect
new_connection
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:834
activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:810
def new_connection
Base.send(spec.adapter_method, spec.config).tap do |conn|
conn.schema_cache = schema_cache.dup if schema_cache
end
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:855
activerecord-5.2.2.1/lib/active_record/connection_adapters/mysql2_adapter.rb:12
def mysql2_connection(config)
config = config.symbolize_keys
config[:flags] ||= 0
if config[:flags].kind_of? Array
config[:flags].push "FOUND_ROWS".freeze
else
config[:flags] |= Mysql2::Client::FOUND_ROWS
end
client = Mysql2::Client.new(config)
ConnectionAdapters::Mysql2Adapter.new(client, logger, nil, config)
rescue Mysql2::Error => error
if error.message.include?("Unknown database")
raise ActiveRecord::NoDatabaseError
else
raise
end
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:811
activesupport-5.2.2.1/lib/active_support/core_ext/hash/keys.rb:56
def symbolize_keys
transform_keys { |key| key.to_sym rescue key }
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/mysql2_adapter.rb:13
mysql2-0.5.2/lib/mysql2/client.rb:21
def initialize(opts = {})
raise Mysql2::Error, "Options parameter must be a Hash" unless opts.is_a? Hash
opts = Mysql2::Util.key_hash_as_symbols(opts)
@read_timeout = nil
@query_options = self.class.default_query_options.dup
@query_options.merge! opts
initialize_ext
# Set default connect_timeout to avoid unlimited retries from signal interruption
opts[:connect_timeout] = 120 unless opts.key?(:connect_timeout)
# TODO: stricter validation rather than silent massaging
%i[reconnect connect_timeout local_infile read_timeout write_timeout default_file default_group secure_auth init_command automatic_close enable_cleartext_plugin].each do |key|
next unless opts.key?(key)
case key
when :reconnect, :local_infile, :secure_auth, :automatic_close, :enable_cleartext_plugin
send(:"#{key}=", !!opts[key]) # rubocop:disable Style/DoubleNegation
when :connect_timeout, :read_timeout, :write_timeout
send(:"#{key}=", Integer(opts[key])) unless opts[key].nil?
else
send(:"#{key}=", opts[key])
end
end
# force the encoding to utf8
self.charset_name = opts[:encoding] || 'utf8'
ssl_options = opts.values_at(:sslkey, :sslcert, :sslca, :sslcapath, :sslcipher)
ssl_set(*ssl_options) if ssl_options.any? || opts.key?(:sslverify)
self.ssl_mode = parse_ssl_mode(opts[:ssl_mode]) if opts[:ssl_mode]
flags = case opts[:flags]
when Array
parse_flags_array(opts[:flags], @query_options[:connect_flags])
when String
parse_flags_array(opts[:flags].split(' '), @query_options[:connect_flags])
when Integer
@query_options[:connect_flags] | opts[:flags]
else
@query_options[:connect_flags]
end
# SSL verify is a connection flag rather than a mysql_ssl_set option
flags |= SSL_VERIFY_SERVER_CERT if opts[:sslverify]
if %i[user pass hostname dbname db sock].any? { |k| @query_options.key?(k) }
warn "============= WARNING FROM mysql2 ============="
warn "The options :user, :pass, :hostname, :dbname, :db, and :sock are deprecated and will be removed at some point in the future."
warn "Instead, please use :username, :password, :host, :port, :database, :socket, :flags for the options."
warn "============= END WARNING FROM mysql2 ========="
end
user = opts[:username] || opts[:user]
pass = opts[:password] || opts[:pass]
host = opts[:host] || opts[:hostname]
port = opts[:port]
database = opts[:database] || opts[:dbname] || opts[:db]
socket = opts[:socket] || opts[:sock]
# Correct the data types before passing these values down to the C level
user = user.to_s unless user.nil?
pass = pass.to_s unless pass.nil?
host = host.to_s unless host.nil?
port = port.to_i unless port.nil?
database = database.to_s unless database.nil?
socket = socket.to_s unless socket.nil?
conn_attrs = parse_connect_attrs(opts[:connect_attrs])
connect user, pass, host, port, database, socket, flags, conn_attrs
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/mysql2_adapter.rb:22
mysql2-0.5.2/lib/mysql2.rb:63
def self.key_hash_as_symbols(hash)
return nil unless hash
Hash[hash.map { |k, v| [k.to_sym, v] }]
end
# called from mysql2-0.5.2/lib/mysql2/client.rb:23
mysql2-0.5.2/lib/mysql2/client.rb:5
def self.default_query_options
@default_query_options ||= {
as: :hash, # the type of object you want each row back as; also supports :array (an array of values)
async: false, # don't wait for a result after sending the query, you'll have to monitor the socket yourself then eventually call Mysql2::Client#async_result
cast_booleans: false, # cast tinyint(1) fields as true/false in ruby
symbolize_keys: false, # return field names as symbols instead of strings
database_timezone: :local, # timezone Mysql2 will assume datetime objects are stored in
application_timezone: nil, # timezone Mysql2 will convert to before handing the object back to the caller
cache_rows: true, # tells Mysql2 to use its internal row cache for results
connect_flags: REMEMBER_OPTIONS | LONG_PASSWORD | LONG_FLAG | TRANSACTIONS | PROTOCOL_41 | SECURE_CONNECTION | CONNECT_ATTRS,
cast: true,
default_file: nil,
default_group: nil,
}
end
# called from mysql2-0.5.2/lib/mysql2/client.rb:25
mysql2-0.5.2/lib/mysql2/client.rb:120
def parse_connect_attrs(conn_attrs)
return {} if Mysql2::Client::CONNECT_ATTRS.zero?
conn_attrs ||= {}
conn_attrs[:program_name] ||= $PROGRAM_NAME
conn_attrs.each_with_object({}) do |(key, value), hash|
hash[key.to_s] = value.to_s
end
end
# called from mysql2-0.5.2/lib/mysql2/client.rb:88
activesupport-5.2.2.1/lib/active_support/core_ext/module/attribute_accessors.rb:60
def self.#{sym}
@@#{sym}
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/mysql2_adapter.rb:23
activerecord-5.2.2.1/lib/active_record/connection_adapters/mysql2_adapter.rb:39
def initialize(connection, logger, connection_options, config)
super
@prepared_statements = false unless config.key?(:prepared_statements)
configure_connection
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/mysql2_adapter.rb:23
activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:53
def initialize(connection, logger, connection_options, config)
super
@prepared_statements = false unless config.key?(:prepared_statements)
configure_connection
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/mysql2_adapter.rb:40
activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:99
def initialize(connection, logger, connection_options, config)
super
@prepared_statements = false unless config.key?(:prepared_statements)
configure_connection
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:54
activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/query_cache.rb:51
def initialize(connection, logger, connection_options, config)
super
@prepared_statements = false unless config.key?(:prepared_statements)
configure_connection
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:100
activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:6
def initialize(connection, logger, connection_options, config)
super
@prepared_statements = false unless config.key?(:prepared_statements)
configure_connection
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/query_cache.rb:52
activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:273
def reset_transaction #:nodoc:
@transaction_manager = ConnectionAdapters::TransactionManager.new(self)
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:8
activesupport-5.2.2.1/lib/active_support/dependencies.rb:289
def require(file)
result = false
load_dependency(file) { result = super }
result
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:274
activesupport-5.2.2.1/lib/active_support/dependencies.rb:251
def load_dependency(file)
if Dependencies.load? && Dependencies.constant_watch_stack.watching?
descs = Dependencies.constant_watch_stack.watching.flatten.uniq
Dependencies.new_constants_in(*descs) { yield }
else
yield
end
rescue Exception => exception # errors from loading file
exception.blame_file! file if exception.respond_to? :blame_file!
raise
end
# called from activesupport-5.2.2.1/lib/active_support/dependencies.rb:291
activesupport-5.2.2.1/lib/active_support/dependencies.rb:328
def load?
mechanism == :load
end
# called from activesupport-5.2.2.1/lib/active_support/dependencies.rb:252
activesupport-5.2.2.1/lib/active_support/core_ext/module/attribute_accessors.rb:60
def self.#{sym}
@@#{sym}
end
# called from activesupport-5.2.2.1/lib/active_support/dependencies.rb:329
activesupport-5.2.2.1/lib/active_support/core_ext/module/attribute_accessors.rb:60
def self.#{sym}
@@#{sym}
end
# called from activesupport-5.2.2.1/lib/active_support/dependencies.rb:252
activesupport-5.2.2.1/lib/active_support/dependencies.rb:111
def watching?
!@watching.empty?
end
# called from activesupport-5.2.2.1/lib/active_support/dependencies.rb:252
bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:26
def require(file)
result = false
load_dependency(file) { result = super }
result
end
# called from activesupport-5.2.2.1/lib/active_support/dependencies.rb:291
bootsnap-1.4.4/lib/bootsnap/load_path_cache/loaded_features_index.rb:67
def key?(feature)
@mutex.synchronize { @lfi.key?(feature) }
end
# called from bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:27
bootsnap-1.4.4/lib/bootsnap/load_path_cache/cache.rb:47
def find(feature)
reinitialize if (@has_relative_paths && dir_changed?) || stale?
feature = feature.to_s
return feature if absolute_path?(feature)
return expand_path(feature) if feature.start_with?('./')
@mutex.synchronize do
x = search_index(feature)
return x if x
# Ruby has some built-in features that require lies about.
# For example, 'enumerator' is built in. If you require it, ruby
# returns false as if it were already loaded; however, there is no
# file to find on disk. We've pre-built a list of these, and we
# return false if any of them is loaded.
raise(LoadPathCache::ReturnFalse, '', []) if BUILTIN_FEATURES.key?(feature)
# The feature wasn't found on our preliminary search through the index.
# We resolve this differently depending on what the extension was.
case File.extname(feature)
# If the extension was one of the ones we explicitly cache (.rb and the
# native dynamic extension, e.g. .bundle or .so), we know it was a
# failure and there's nothing more we can do to find the file.
# no extension, .rb, (.bundle or .so)
when '', *CACHED_EXTENSIONS # rubocop:disable Performance/CaseWhenSplat
nil
# Ruby allows specifying native extensions as '.so' even when DLEXT
# is '.bundle'. This is where we handle that case.
when DOT_SO
x = search_index(feature[0..-4] + DLEXT)
return x if x
if DLEXT2
x = search_index(feature[0..-4] + DLEXT2)
return x if x
end
else
# other, unknown extension. For example, `.rake`. Since we haven't
# cached these, we legitimately need to run the load path search.
raise(LoadPathCache::FallbackScan, '', [])
end
end
# In development mode, we don't want to confidently return failures for
# cases where the file doesn't appear to be on the load path. We should
# be able to detect newly-created files without rebooting the
# application.
raise(LoadPathCache::FallbackScan, '', []) if @development_mode
end
# called from bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29
bootsnap-1.4.4/lib/bootsnap/load_path_cache/cache.rb:171
def stale?
@development_mode && @generated_at + AGE_THRESHOLD < now
end
# called from bootsnap-1.4.4/lib/bootsnap/load_path_cache/cache.rb:48
bootsnap-1.4.4/lib/bootsnap/load_path_cache/cache.rb:175
def now
Process.clock_gettime(Process::CLOCK_MONOTONIC).to_i
end
# called from bootsnap-1.4.4/lib/bootsnap/load_path_cache/cache.rb:172
bootsnap-1.4.4/lib/bootsnap/load_path_cache/cache.rb:100
def absolute_path?(path)
path.start_with?(SLASH)
end
# called from bootsnap-1.4.4/lib/bootsnap/load_path_cache/cache.rb:50
bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20
def require_with_bootsnap_lfi(path, resolved = nil)
Bootsnap::LoadPathCache.loaded_features_index.register(path, resolved) do
require_without_bootsnap(resolved || path)
end
end
# called from bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30
bootsnap-1.4.4/lib/bootsnap/load_path_cache/loaded_features_index.rb:85
def register(short, long = nil)
if long.nil?
pat = %r{/#{Regexp.escape(short)}(\.[^/]+)?$}
len = $LOADED_FEATURES.size
ret = yield
long = $LOADED_FEATURES[len..-1].detect { |feat| feat =~ pat }
else
ret = yield
end
hash = long.hash
# do we have 'bundler' or 'bundler.rb'?
altname = if File.extname(short) != ''
# strip the path from 'bundler.rb' -> 'bundler'
strip_extension(short)
elsif long && (ext = File.extname(long))
# get the extension from the expanded path if given
# 'bundler' + '.rb'
short + ext
end
@mutex.synchronize do
@lfi[short] = hash
(@lfi[altname] = hash) if altname
end
ret
end
# called from bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21
bootsnap-1.4.4/lib/bootsnap/compile_cache/iseq.rb:33
def load_iseq(path)
# Having coverage enabled prevents iseq dumping/loading.
return nil if defined?(Coverage) && Bootsnap::CompileCache::Native.coverage_running?
Bootsnap::CompileCache::Native.fetch(
Bootsnap::CompileCache::ISeq.cache_dir,
path.to_s,
Bootsnap::CompileCache::ISeq
)
rescue Errno::EACCES
Bootsnap::CompileCache.permission_error(path)
rescue RuntimeError => e
if e.message =~ /unmatched platform/
puts("unmatched platform for file #{path}")
end
raise
end
# called from bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22
bootsnap-1.4.4/lib/bootsnap/compile_cache/iseq.rb:17
def self.storage_to_output(binary)
RubyVM::InstructionSequence.load_from_binary(binary)
rescue RuntimeError => e
if e.message == 'broken binary format'
STDERR.puts("[Bootsnap::CompileCache] warning: rejecting broken binary")
nil
else
raise
end
end
# called from bootsnap-1.4.4/lib/bootsnap/compile_cache/iseq.rb:37
activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/transaction.rb:85
def initialize; end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/transaction.rb:273
bootsnap-1.4.4/lib/bootsnap/load_path_cache/loaded_features_index.rb:120
def strip_extension(f)
f.sub(STRIP_EXTENSION, '')
end
# called from bootsnap-1.4.4/lib/bootsnap/load_path_cache/loaded_features_index.rb:100
activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/transaction.rb:191
def initialize(connection)
@stack = []
@connection = connection
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:274
activesupport-5.2.2.1/lib/active_support/notifications.rb:189
def instrumenter
InstrumentationRegistry.instance.instrumenter_for(notifier)
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:104
activesupport-5.2.2.1/lib/active_support/per_thread_registry.rb:46
def instance
Thread.current[@per_thread_registry_key] ||= new
end
# called from activesupport-5.2.2.1/lib/active_support/notifications.rb:190
activesupport-5.2.2.1/lib/active_support/notifications.rb:209
def instrumenter_for(notifier)
@registry[notifier] ||= Instrumenter.new(notifier)
end
# called from activesupport-5.2.2.1/lib/active_support/notifications.rb:190
concurrent-ruby-1.1.5/lib/concurrent/utility/monotonic_time.rb:53
def monotonic_time
GLOBAL_MONOTONIC_CLOCK.get_time
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:108
concurrent-ruby-1.1.5/lib/concurrent/utility/monotonic_time.rb:13
def get_time
Process.clock_gettime(Process::CLOCK_MONOTONIC)
end
# called from concurrent-ruby-1.1.5/lib/concurrent/utility/monotonic_time.rb:54
activerecord-5.2.2.1/lib/active_record/connection_adapters/schema_cache.rb:9
def initialize(conn)
@connection = conn
@columns = {}
@columns_hash = {}
@primary_keys = {}
@data_sources = {}
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:109
activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:802
def arel_visitor
Arel::Visitors::MySQL.new(self)
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:111
arel-9.0.0/lib/arel/visitors/to_sql.rb:68
def initialize connection
super()
@connection = connection
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:803
arel-9.0.0/lib/arel/visitors/visitor.rb:5
def initialize connection
super()
@connection = connection
end
# called from arel-9.0.0/lib/arel/visitors/to_sql.rb:69
arel-9.0.0/lib/arel/visitors/visitor.rb:21
def get_dispatch_cache
self.class.dispatch_cache
end
# called from arel-9.0.0/lib/arel/visitors/visitor.rb:6
arel-9.0.0/lib/arel/visitors/visitor.rb:15
def self.dispatch_cache
Hash.new do |hash, klass|
hash[klass] = "visit_#{(klass.name || '').gsub('::', '_')}"
end
end
# called from arel-9.0.0/lib/arel/visitors/visitor.rb:22
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:250
def initialize(*args)
super
mon_initialize
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:112
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:257
def mon_initialize
if defined?(@mon_mutex) && @mon_mutex_owner_object_id == object_id
raise ThreadError, "already initialized"
end
@mon_mutex = Thread::Mutex.new
@mon_mutex_owner_object_id = object_id
@mon_owner = nil
@mon_count = 0
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:252
activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:91
def self.type_cast_config_to_boolean(config)
if config == "false"
false
else
config
end
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:114
activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:83
def self.type_cast_config_to_integer(config)
if config =~ SIMPLE_INT
config.to_i
else
config
end
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:56
activerecord-5.2.2.1/lib/active_record/connection_adapters/statement_pool.rb:10
def initialize(statement_limit = nil)
@cache = Hash.new { |h, pid| h[pid] = {} }
@statement_limit = statement_limit || DEFAULT_STATEMENT_LIMIT
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:56
activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:63
def version #:nodoc:
@version ||= Version.new(version_string)
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:58
activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:849
def version_string
full_version.match(/^(?:5\.5\.5-)?(\d+\.\d+\.\d+)/)[1]
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:64
activerecord-5.2.2.1/lib/active_record/connection_adapters/mysql2_adapter.rb:124
def full_version
@full_version ||= @connection.server_info[:version]
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:850
activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:133
def initialize(version_string)
@version = version_string.split(".").map(&:to_i)
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:64
activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:137
def <=>(version_string)
@version <=> version_string.split(".").map(&:to_i)
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:58
activerecord-5.2.2.1/lib/active_record/connection_adapters/mysql2_adapter.rb:119
def configure_connection
@connection.query_options.merge!(as: :array)
super
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/mysql2_adapter.rb:42
activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:739
def configure_connection
@connection.query_options.merge!(as: :array)
super
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/mysql2_adapter.rb:121
activesupport-5.2.2.1/lib/active_support/core_ext/hash/keys.rb:39
def stringify_keys
transform_keys(&:to_s)
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:740
activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:83
def self.type_cast_config_to_integer(config)
if config =~ SIMPLE_INT
config.to_i
else
config
end
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:746
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/set.rb:814
def to_set(klass = Set, *args, &block)
klass.new(self, *args, &block)
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:750
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/set.rb:93
def initialize(enum = nil, &block) # :yields: o
@hash ||= Hash.new(false)
enum.nil? and return
if block
do_with_enum(enum) { |o| add(block[o]) }
else
merge(enum)
end
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/set.rb:815
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/set.rb:432
def merge(enum)
if enum.instance_of?(self.class)
@hash.update(enum.instance_variable_get(:@hash))
else
do_with_enum(enum) { |o| add(o) }
end
self
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/set.rb:101
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/set.rb:122
def do_with_enum(enum, &block) # :nodoc:
if enum.respond_to?(:each_entry)
enum.each_entry(&block) if block
elsif enum.respond_to?(:each)
enum.each(&block) if block
else
raise ArgumentError, "value must be enumerable"
end
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/set.rb:436
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/set.rb:348
def add(o)
@hash[o] = true
self
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/set.rb:436
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/set.rb:348
def add(o)
@hash[o] = true
self
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/set.rb:436
activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:521
def strict_mode?
self.class.type_cast_config_to_boolean(@config.fetch(:strict, true))
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:757
activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:91
def self.type_cast_config_to_boolean(config)
if config == "false"
false
else
config
end
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:522
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/set.rb:253
def include?(o)
@hash[o]
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:757
activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:521
def strict_mode?
self.class.type_cast_config_to_boolean(@config.fetch(:strict, true))
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:758
activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:91
def self.type_cast_config_to_boolean(config)
if config == "false"
false
else
config
end
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:522
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/set.rb:253
def include?(o)
@hash[o]
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:780
activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/quoting.rb:11
def quote(value)
value = id_value_for_database(value) if value.is_a?(Base)
if value.respond_to?(:value_for_database)
value = value.value_for_database
end
_quote(value)
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:783
activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/quoting.rb:164
def _quote(value)
case value
when String, ActiveSupport::Multibyte::Chars
"'#{quote_string(value.to_s)}'"
when true then quoted_true
when false then quoted_false
when nil then "NULL"
# BigDecimals need to be put in a non-normalized form and quoted.
when BigDecimal then value.to_s("F")
when Numeric, ActiveSupport::Duration then value.to_s
when Type::Binary::Data then quoted_binary(value)
when Type::Time::Value then "'#{quoted_time(value)}'"
when Date, Time then "'#{quoted_date(value)}'"
when Symbol then "'#{quote_string(value.to_s)}'"
when Class then "'#{value}'"
else raise TypeError, "can't quote #{value.class.name}"
end
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/quoting.rb:18
activesupport-5.2.2.1/lib/active_support/core_ext/numeric/conversions.rb:104
def to_s(format = nil, options = nil)
case format
when nil
super()
when Integer, String
super(format)
when :phone
ActiveSupport::NumberHelper.number_to_phone(self, options || {})
when :currency
ActiveSupport::NumberHelper.number_to_currency(self, options || {})
when :percentage
ActiveSupport::NumberHelper.number_to_percentage(self, options || {})
when :delimited
ActiveSupport::NumberHelper.number_to_delimited(self, options || {})
when :rounded
ActiveSupport::NumberHelper.number_to_rounded(self, options || {})
when :human
ActiveSupport::NumberHelper.number_to_human(self, options || {})
when :human_size
ActiveSupport::NumberHelper.number_to_human_size(self, options || {})
when Symbol
super()
else
super(format)
end
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/quoting.rb:173
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/set.rb:253
def include?(o)
@hash[o]
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:780
activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/quoting.rb:11
def quote(value)
value = id_value_for_database(value) if value.is_a?(Base)
if value.respond_to?(:value_for_database)
value = value.value_for_database
end
_quote(value)
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:783
activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/quoting.rb:164
def _quote(value)
case value
when String, ActiveSupport::Multibyte::Chars
"'#{quote_string(value.to_s)}'"
when true then quoted_true
when false then quoted_false
when nil then "NULL"
# BigDecimals need to be put in a non-normalized form and quoted.
when BigDecimal then value.to_s("F")
when Numeric, ActiveSupport::Duration then value.to_s
when Type::Binary::Data then quoted_binary(value)
when Type::Time::Value then "'#{quoted_time(value)}'"
when Date, Time then "'#{quoted_date(value)}'"
when Symbol then "'#{quote_string(value.to_s)}'"
when Class then "'#{value}'"
else raise TypeError, "can't quote #{value.class.name}"
end
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/quoting.rb:18
activesupport-5.2.2.1/lib/active_support/core_ext/numeric/conversions.rb:104
def to_s(format = nil, options = nil)
case format
when nil
super()
when Integer, String
super(format)
when :phone
ActiveSupport::NumberHelper.number_to_phone(self, options || {})
when :currency
ActiveSupport::NumberHelper.number_to_currency(self, options || {})
when :percentage
ActiveSupport::NumberHelper.number_to_percentage(self, options || {})
when :delimited
ActiveSupport::NumberHelper.number_to_delimited(self, options || {})
when :rounded
ActiveSupport::NumberHelper.number_to_rounded(self, options || {})
when :human
ActiveSupport::NumberHelper.number_to_human(self, options || {})
when :human_size
ActiveSupport::NumberHelper.number_to_human_size(self, options || {})
when Symbol
super()
else
super(format)
end
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/quoting.rb:173
activerecord-5.2.2.1/lib/active_record/connection_adapters/mysql/database_statements.rb:23
def execute(sql, name = nil)
# make sure we carry over any changes to ActiveRecord::Base.default_timezone that have been
# made since we established the connection
@connection.query_options[:database_timezone] = ActiveRecord::Base.default_timezone
super
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:789
activesupport-5.2.2.1/lib/active_support/core_ext/module/attribute_accessors.rb:60
def self.#{sym}
@@#{sym}
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/mysql/database_statements.rb:26
activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:184
def execute(sql, name = nil)
# make sure we carry over any changes to ActiveRecord::Base.default_timezone that have been
# made since we established the connection
@connection.query_options[:database_timezone] = ActiveRecord::Base.default_timezone
super
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/mysql/database_statements.rb:28
activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:568
def log(sql, name = "SQL", binds = [], type_casted_binds = [], statement_name = nil) # :doc:
@instrumenter.instrument(
"sql.active_record",
sql: sql,
name: name,
binds: binds,
type_casted_binds: type_casted_binds,
statement_name: statement_name,
connection_id: object_id) do
begin
@lock.synchronize do
yield
end
rescue => e
raise translate_exception_class(e, sql)
end
end
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:185
activesupport-5.2.2.1/lib/active_support/notifications/instrumenter.rb:19
def instrument(name, payload = {})
# some of the listeners might have state
listeners_state = start name, payload
begin
yield payload
rescue Exception => e
payload[:exception] = [e.class.name, e.message]
payload[:exception_object] = e
raise e
ensure
finish_with_state listeners_state, name, payload
end
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:569
activesupport-5.2.2.1/lib/active_support/notifications/instrumenter.rb:34
def start(name, payload)
@notifier.start name, @id, payload
end
# called from activesupport-5.2.2.1/lib/active_support/notifications/instrumenter.rb:21
activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:43
def start(name, id, payload)
listeners_for(name).each { |s| s.start(name, id, payload) }
end
# called from activesupport-5.2.2.1/lib/active_support/notifications/instrumenter.rb:35
activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:55
def listeners_for(name)
# this is correctly done double-checked locking (Concurrent::Map's lookups have volatile semantics)
@listeners_for[name] || synchronize do
# use synchronisation when accessing @subscribers
@listeners_for[name] ||= @subscribers.select { |s| s.subscribed_to?(name) }
end
end
# called from activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:44
concurrent-ruby-1.1.5/lib/concurrent/map.rb:132
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:57
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:19
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from concurrent-ruby-1.1.5/lib/concurrent/map.rb:133
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/mutex_m.rb:77
def mu_synchronize(&block)
@_mutex.synchronize(&block)
end
# called from activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:57
concurrent-ruby-1.1.5/lib/concurrent/map.rb:132
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:59
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:19
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from concurrent-ruby-1.1.5/lib/concurrent/map.rb:133
activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:107
def subscribed_to?(name)
@pattern === name
end
# called from activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:59
activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:107
def subscribed_to?(name)
@pattern === name
end
# called from activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:59
activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:107
def subscribed_to?(name)
@pattern === name
end
# called from activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:59
activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:107
def subscribed_to?(name)
@pattern === name
end
# called from activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:59
activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:107
def subscribed_to?(name)
@pattern === name
end
# called from activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:59
activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:107
def subscribed_to?(name)
@pattern === name
end
# called from activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:59
activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:107
def subscribed_to?(name)
@pattern === name
end
# called from activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:59
activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:107
def subscribed_to?(name)
@pattern === name
end
# called from activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:59
activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:107
def subscribed_to?(name)
@pattern === name
end
# called from activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:59
concurrent-ruby-1.1.5/lib/concurrent/collection/map/mri_map_backend.rb:17
def []=(key, value)
@write_lock.synchronize { super }
end
# called from activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:59
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:23
def []=(key, value)
@write_lock.synchronize { super }
end
# called from concurrent-ruby-1.1.5/lib/concurrent/collection/map/mri_map_backend.rb:18
activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:99
def start(name, id, payload)
@delegate.start name, id, payload
end
# called from activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:44
activesupport-5.2.2.1/lib/active_support/log_subscriber.rb:79
def start(name, id, payload)
super if logger
end
# called from activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:100
activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:90
def logger
ActiveRecord::Base.logger
end
# called from activesupport-5.2.2.1/lib/active_support/log_subscriber.rb:80
activesupport-5.2.2.1/lib/active_support/core_ext/module/attribute_accessors.rb:60
def self.#{sym}
@@#{sym}
end
# called from activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:91
activesupport-5.2.2.1/lib/active_support/subscriber.rb:86
def start(name, id, payload)
super if logger
end
# called from activesupport-5.2.2.1/lib/active_support/log_subscriber.rb:80
activesupport-5.2.2.1/lib/active_support/subscriber.rb:110
def now
Process.clock_gettime(Process::CLOCK_MONOTONIC)
end
# called from activesupport-5.2.2.1/lib/active_support/subscriber.rb:87
activesupport-5.2.2.1/lib/active_support/notifications/instrumenter.rb:58
def initialize(name, start, ending, transaction_id, payload)
@name = name
@payload = payload.dup
@time = start
@transaction_id = transaction_id
@end = ending
@children = []
@duration = nil
end
# called from activesupport-5.2.2.1/lib/active_support/subscriber.rb:87
activesupport-5.2.2.1/lib/active_support/subscriber.rb:106
def event_stack
SubscriberQueueRegistry.instance.get_queue(@queue_key)
end
# called from activesupport-5.2.2.1/lib/active_support/subscriber.rb:88
activesupport-5.2.2.1/lib/active_support/per_thread_registry.rb:46
def instance
Thread.current[@per_thread_registry_key] ||= new
end
# called from activesupport-5.2.2.1/lib/active_support/subscriber.rb:107
activesupport-5.2.2.1/lib/active_support/subscriber.rb:122
def initialize
@registry = {}
end
# called from activesupport-5.2.2.1/lib/active_support/per_thread_registry.rb:47
activesupport-5.2.2.1/lib/active_support/subscriber.rb:126
def get_queue(queue_key)
@registry[queue_key] ||= []
end
# called from activesupport-5.2.2.1/lib/active_support/subscriber.rb:107
activesupport-5.2.2.1/lib/active_support/subscriber.rb:106
def event_stack
SubscriberQueueRegistry.instance.get_queue(@queue_key)
end
# called from activesupport-5.2.2.1/lib/active_support/subscriber.rb:91
activesupport-5.2.2.1/lib/active_support/per_thread_registry.rb:46
def instance
Thread.current[@per_thread_registry_key] ||= new
end
# called from activesupport-5.2.2.1/lib/active_support/subscriber.rb:107
activesupport-5.2.2.1/lib/active_support/subscriber.rb:126
def get_queue(queue_key)
@registry[queue_key] ||= []
end
# called from activesupport-5.2.2.1/lib/active_support/subscriber.rb:107
activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:99
def start(name, id, payload)
@delegate.start name, id, payload
end
# called from activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:44
activerecord-5.2.2.1/lib/active_record/explain_subscriber.rb:8
def start(name, id, payload)
# unused
end
# called from activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:100
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:227
def mon_synchronize
mon_enter
begin
yield
ensure
mon_exit
end
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:578
activesupport-5.2.2.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:11
def mon_enter
mon_try_enter ||
ActiveSupport::Dependencies.interlock.permit_concurrent_loads { super }
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:228
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:170
def mon_try_enter
if @mon_owner != Thread.current
unless @mon_mutex.try_lock
return false
end
@mon_owner = Thread.current
@mon_count = 0
end
@mon_count += 1
return true
end
# called from activesupport-5.2.2.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:12
activesupport-5.2.2.1/lib/active_support/core_ext/module/attribute_accessors.rb:60
def self.#{sym}
@@#{sym}
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:186
activesupport-5.2.2.1/lib/active_support/dependencies/interlock.rb:46
def permit_concurrent_loads
@lock.yield_shares(compatible: [:load]) do
yield
end
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:186
activesupport-5.2.2.1/lib/active_support/concurrency/share_lock.rb:171
def yield_shares(purpose: nil, compatible: [], block_share: false)
loose_shares = previous_wait = nil
synchronize do
if loose_shares = @sharing.delete(Thread.current)
if previous_wait = @waiting[Thread.current]
purpose = nil unless purpose == previous_wait[0]
compatible &= previous_wait[1]
end
compatible |= [false] unless block_share
@waiting[Thread.current] = [purpose, compatible]
end
@cv.broadcast
end
begin
yield
ensure
synchronize do
wait_for(:yield_shares) { @exclusive_thread && @exclusive_thread != Thread.current }
if previous_wait
@waiting[Thread.current] = previous_wait
else
@waiting.delete Thread.current
end
@sharing[Thread.current] = loose_shares if loose_shares
end
end
end
# called from activesupport-5.2.2.1/lib/active_support/dependencies/interlock.rb:47
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:227
def mon_synchronize
mon_enter
begin
yield
ensure
mon_exit
end
end
# called from activesupport-5.2.2.1/lib/active_support/concurrency/share_lock.rb:173
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:187
def mon_enter
if @mon_owner != Thread.current
@mon_mutex.lock
@mon_owner = Thread.current
@mon_count = 0
end
@mon_count += 1
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:228
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:149
def broadcast
@monitor.__send__(:mon_check_owner)
@cond.broadcast
end
# called from activesupport-5.2.2.1/lib/active_support/concurrency/share_lock.rb:183
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:267
def mon_check_owner
if @mon_owner != Thread.current
raise ThreadError, "current thread not owner"
end
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:150
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:199
def mon_exit
mon_check_owner
@mon_count -=1
if @mon_count == 0
@mon_owner = nil
@mon_mutex.unlock
end
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:232
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:267
def mon_check_owner
if @mon_owner != Thread.current
raise ThreadError, "current thread not owner"
end
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:200
mysql2-0.5.2/lib/mysql2/client.rb:129
def query(sql, options = {})
Thread.handle_interrupt(::Mysql2::Util::TIMEOUT_ERROR_CLASS => :never) do
_query(sql, @query_options.merge(options))
end
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:187
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:227
def mon_synchronize
mon_enter
begin
yield
ensure
mon_exit
end
end
# called from activesupport-5.2.2.1/lib/active_support/concurrency/share_lock.rb:189
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:187
def mon_enter
if @mon_owner != Thread.current
@mon_mutex.lock
@mon_owner = Thread.current
@mon_count = 0
end
@mon_count += 1
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:228
activesupport-5.2.2.1/lib/active_support/concurrency/share_lock.rb:219
def wait_for(method)
@sleeping[Thread.current] = method
@cv.wait_while { yield }
ensure
@sleeping.delete Thread.current
end
# called from activesupport-5.2.2.1/lib/active_support/concurrency/share_lock.rb:190
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:123
def wait_while
while yield
wait
end
end
# called from activesupport-5.2.2.1/lib/active_support/concurrency/share_lock.rb:221
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:199
def mon_exit
mon_check_owner
@mon_count -=1
if @mon_count == 0
@mon_owner = nil
@mon_mutex.unlock
end
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:232
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:267
def mon_check_owner
if @mon_owner != Thread.current
raise ThreadError, "current thread not owner"
end
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:200
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:199
def mon_exit
mon_check_owner
@mon_count -=1
if @mon_count == 0
@mon_owner = nil
@mon_mutex.unlock
end
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:232
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:267
def mon_check_owner
if @mon_owner != Thread.current
raise ThreadError, "current thread not owner"
end
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:200
activesupport-5.2.2.1/lib/active_support/notifications/instrumenter.rb:43
def finish_with_state(listeners_state, name, payload)
@notifier.finish name, @id, payload, listeners_state
end
# called from activesupport-5.2.2.1/lib/active_support/notifications/instrumenter.rb:29
activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:47
def finish(name, id, payload, listeners = listeners_for(name))
listeners.each { |s| s.finish(name, id, payload) }
end
# called from activesupport-5.2.2.1/lib/active_support/notifications/instrumenter.rb:44
activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:103
def finish(name, id, payload)
@delegate.finish name, id, payload
end
# called from activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:48
activesupport-5.2.2.1/lib/active_support/log_subscriber.rb:83
def finish(name, id, payload)
super if logger
rescue => e
if logger
logger.error "Could not log #{name.inspect} event. #{e.class}: #{e.message} #{e.backtrace}"
end
end
# called from activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:104
activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:90
def logger
ActiveRecord::Base.logger
end
# called from activesupport-5.2.2.1/lib/active_support/log_subscriber.rb:84
activesupport-5.2.2.1/lib/active_support/core_ext/module/attribute_accessors.rb:60
def self.#{sym}
@@#{sym}
end
# called from activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:91
activesupport-5.2.2.1/lib/active_support/subscriber.rb:94
def finish(name, id, payload)
super if logger
rescue => e
if logger
logger.error "Could not log #{name.inspect} event. #{e.class}: #{e.message} #{e.backtrace}"
end
end
# called from activesupport-5.2.2.1/lib/active_support/log_subscriber.rb:84
activesupport-5.2.2.1/lib/active_support/subscriber.rb:110
def now
Process.clock_gettime(Process::CLOCK_MONOTONIC)
end
# called from activesupport-5.2.2.1/lib/active_support/subscriber.rb:95
activesupport-5.2.2.1/lib/active_support/subscriber.rb:106
def event_stack
SubscriberQueueRegistry.instance.get_queue(@queue_key)
end
# called from activesupport-5.2.2.1/lib/active_support/subscriber.rb:96
activesupport-5.2.2.1/lib/active_support/per_thread_registry.rb:46
def instance
Thread.current[@per_thread_registry_key] ||= new
end
# called from activesupport-5.2.2.1/lib/active_support/subscriber.rb:107
activesupport-5.2.2.1/lib/active_support/subscriber.rb:126
def get_queue(queue_key)
@registry[queue_key] ||= []
end
# called from activesupport-5.2.2.1/lib/active_support/subscriber.rb:107
activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:20
def sql(event)
self.class.runtime += event.duration
return unless logger.debug?
payload = event.payload
return if IGNORE_PAYLOAD_NAMES.include?(payload[:name])
name = "#{payload[:name]} (#{event.duration.round(1)}ms)"
name = "CACHE #{name}" if payload[:cached]
sql = payload[:sql]
binds = nil
unless (payload[:binds] || []).empty?
casted_params = type_casted_binds(payload[:type_casted_binds])
binds = " " + payload[:binds].zip(casted_params).map { |attr, value|
render_bind(attr, value)
}.inspect
end
name = colorize_payload_name(name, payload[:name])
sql = color(sql, sql_color(sql), true)
debug " #{name} #{sql}#{binds}"
end
# called from activesupport-5.2.2.1/lib/active_support/subscriber.rb:101
activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:11
def self.runtime
ActiveRecord::RuntimeRegistry.sql_runtime ||= 0
end
# called from activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:21
activerecord-5.2.2.1/lib/active_record/runtime_registry.rb:20
class_eval %{ def self.#{val}; instance.#{val}; end }, __FILE__, __LINE__
# called from activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:12
activesupport-5.2.2.1/lib/active_support/per_thread_registry.rb:46
def instance
Thread.current[@per_thread_registry_key] ||= new
end
# called from activerecord-5.2.2.1/lib/active_record/runtime_registry.rb:20
activerecord-5.2.2.1/lib/active_record/runtime_registry.rb:21
class_eval %{ def self.#{val}=(x); instance.#{val}=x; end }, __FILE__, __LINE__
# called from activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:12
activesupport-5.2.2.1/lib/active_support/per_thread_registry.rb:46
def instance
Thread.current[@per_thread_registry_key] ||= new
end
# called from activerecord-5.2.2.1/lib/active_record/runtime_registry.rb:21
activesupport-5.2.2.1/lib/active_support/notifications/instrumenter.rb:80
def duration
@duration ||= 1000.0 * (self.end - time)
end
# called from activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:21
activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:7
def self.runtime=(value)
ActiveRecord::RuntimeRegistry.sql_runtime = value
end
# called from activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:21
activerecord-5.2.2.1/lib/active_record/runtime_registry.rb:21
class_eval %{ def self.#{val}=(x); instance.#{val}=x; end }, __FILE__, __LINE__
# called from activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:8
activesupport-5.2.2.1/lib/active_support/per_thread_registry.rb:46
def instance
Thread.current[@per_thread_registry_key] ||= new
end
# called from activerecord-5.2.2.1/lib/active_record/runtime_registry.rb:21
activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:90
def logger
ActiveRecord::Base.logger
end
# called from activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:22
activesupport-5.2.2.1/lib/active_support/core_ext/module/attribute_accessors.rb:60
def self.#{sym}
@@#{sym}
end
# called from activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:91
activesupport-5.2.2.1/lib/active_support/logger.rb:94
def #{severity.downcase}? # def debug?
Logger::#{severity} >= level # DEBUG >= level
end # end
EOT
end
# called from activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:22
activesupport-5.2.2.1/lib/active_support/logger_thread_safe_level.rb:29
def level
local_level || super
end
# called from activesupport-5.2.2.1/lib/active_support/logger.rb:95
activesupport-5.2.2.1/lib/active_support/logger_thread_safe_level.rb:17
def local_level
@local_levels[local_log_id]
end
# called from activesupport-5.2.2.1/lib/active_support/logger_thread_safe_level.rb:30
activesupport-5.2.2.1/lib/active_support/logger_thread_safe_level.rb:13
def local_log_id
Thread.current.__id__
end
# called from activesupport-5.2.2.1/lib/active_support/logger_thread_safe_level.rb:18
concurrent-ruby-1.1.5/lib/concurrent/map.rb:132
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from activesupport-5.2.2.1/lib/active_support/logger_thread_safe_level.rb:18
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:19
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from concurrent-ruby-1.1.5/lib/concurrent/map.rb:133
activesupport-5.2.2.1/lib/active_support/notifications/instrumenter.rb:80
def duration
@duration ||= 1000.0 * (self.end - time)
end
# called from activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:28
activesupport-5.2.2.1/lib/active_support/core_ext/numeric/conversions.rb:104
def to_s(format = nil, options = nil)
case format
when nil
super()
when Integer, String
super(format)
when :phone
ActiveSupport::NumberHelper.number_to_phone(self, options || {})
when :currency
ActiveSupport::NumberHelper.number_to_currency(self, options || {})
when :percentage
ActiveSupport::NumberHelper.number_to_percentage(self, options || {})
when :delimited
ActiveSupport::NumberHelper.number_to_delimited(self, options || {})
when :rounded
ActiveSupport::NumberHelper.number_to_rounded(self, options || {})
when :human
ActiveSupport::NumberHelper.number_to_human(self, options || {})
when :human_size
ActiveSupport::NumberHelper.number_to_human_size(self, options || {})
when Symbol
super()
else
super(format)
end
end
# called from activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:28
activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:61
def colorize_payload_name(name, payload_name)
if payload_name.blank? || payload_name == "SQL" # SQL vs Model Load/Exists
color(name, MAGENTA, true)
else
color(name, CYAN, true)
end
end
# called from activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:40
activesupport-5.2.2.1/lib/active_support/core_ext/object/blank.rb:57
def blank?
true
end
# called from activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:62
activesupport-5.2.2.1/lib/active_support/log_subscriber.rb:105
def color(text, color, bold = false) # :doc:
return text unless colorize_logging
color = self.class.const_get(color.upcase) if color.is_a?(Symbol)
bold = bold ? BOLD : ""
"#{bold}#{color}#{text}#{CLEAR}"
end
# called from activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:63
activesupport-5.2.2.1/lib/active_support/core_ext/module/attribute_accessors.rb:67
def #{sym}
@@#{sym}
end
# called from activesupport-5.2.2.1/lib/active_support/log_subscriber.rb:106
activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:69
def sql_color(sql)
case sql
when /\A\s*rollback/mi
RED
when /select .*for update/mi, /\A\s*lock/mi
WHITE
when /\A\s*select/i
BLUE
when /\A\s*insert/i
GREEN
when /\A\s*update/i
YELLOW
when /\A\s*delete/i
RED
when /transaction\s*\Z/i
CYAN
else
MAGENTA
end
end
# called from activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:41
activesupport-5.2.2.1/lib/active_support/log_subscriber.rb:105
def color(text, color, bold = false) # :doc:
return text unless colorize_logging
color = self.class.const_get(color.upcase) if color.is_a?(Symbol)
bold = bold ? BOLD : ""
"#{bold}#{color}#{text}#{CLEAR}"
end
# called from activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:41
activesupport-5.2.2.1/lib/active_support/core_ext/module/attribute_accessors.rb:67
def #{sym}
@@#{sym}
end
# called from activesupport-5.2.2.1/lib/active_support/log_subscriber.rb:106
activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:94
def debug(progname = nil, &block)
return unless super
if ActiveRecord::Base.verbose_query_logs
log_query_source
end
end
# called from activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:43
activesupport-5.2.2.1/lib/active_support/log_subscriber.rb:95
def debug(progname = nil, &block)
return unless super
if ActiveRecord::Base.verbose_query_logs
log_query_source
end
end
# called from activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:95
activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:90
def logger
ActiveRecord::Base.logger
end
# called from activesupport-5.2.2.1/lib/active_support/log_subscriber.rb:96
activesupport-5.2.2.1/lib/active_support/core_ext/module/attribute_accessors.rb:60
def self.#{sym}
@@#{sym}
end
# called from activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:91
activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:90
def logger
ActiveRecord::Base.logger
end
# called from activesupport-5.2.2.1/lib/active_support/log_subscriber.rb:96
activesupport-5.2.2.1/lib/active_support/core_ext/module/attribute_accessors.rb:60
def self.#{sym}
@@#{sym}
end
# called from activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:91
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/logger.rb:490
def debug(progname = nil, &block)
add(DEBUG, nil, progname, &block)
end
# called from activesupport-5.2.2.1/lib/active_support/log_subscriber.rb:96
activesupport-5.2.2.1/lib/active_support/logger.rb:26
define_method(:add) do |*args, &block|
logger.add(*args, &block)
super(*args, &block)
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/logger.rb:491
activesupport-5.2.2.1/lib/active_support/logger.rb:87
def add(severity, message = nil, progname = nil, &block)
return true if @logdev.nil? || (severity || UNKNOWN) < level
super
end
# called from activesupport-5.2.2.1/lib/active_support/logger.rb:27
activesupport-5.2.2.1/lib/active_support/logger_thread_safe_level.rb:29
def level
local_level || super
end
# called from activesupport-5.2.2.1/lib/active_support/logger.rb:88
activesupport-5.2.2.1/lib/active_support/logger_thread_safe_level.rb:17
def local_level
@local_levels[local_log_id]
end
# called from activesupport-5.2.2.1/lib/active_support/logger_thread_safe_level.rb:30
activesupport-5.2.2.1/lib/active_support/logger_thread_safe_level.rb:13
def local_log_id
Thread.current.__id__
end
# called from activesupport-5.2.2.1/lib/active_support/logger_thread_safe_level.rb:18
concurrent-ruby-1.1.5/lib/concurrent/map.rb:132
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from activesupport-5.2.2.1/lib/active_support/logger_thread_safe_level.rb:18
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:19
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from concurrent-ruby-1.1.5/lib/concurrent/map.rb:133
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/logger.rb:455
def add(severity, message = nil, progname = nil, &block)
return true if @logdev.nil? || (severity || UNKNOWN) < level
super
end
# called from activesupport-5.2.2.1/lib/active_support/logger.rb:89
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/logger.rb:577
def format_severity(severity)
SEV_LABEL[severity] || 'ANY'
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/logger.rb:472
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/logger.rb:581
def format_message(severity, datetime, progname, msg)
(@formatter || @default_formatter).call(severity, datetime, progname, msg)
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/logger.rb:472
activesupport-5.2.2.1/lib/active_support/logger.rb:103
def call(severity, timestamp, progname, msg)
"#{String === msg ? msg : msg.inspect}\n"
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/logger.rb:582
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/logger.rb:684
def write(message)
begin
synchronize do
if @shift_age and @dev.respond_to?(:stat)
begin
check_shift_log
rescue
warn("log shifting failed. #{$!}")
end
end
begin
@dev.write(message)
rescue
warn("log writing failed. #{$!}")
end
end
rescue Exception => ignored
warn("log writing failed. #{ignored}")
end
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/logger.rb:471
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:227
def mon_synchronize
mon_enter
begin
yield
ensure
mon_exit
end
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/logger.rb:686
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:187
def mon_enter
if @mon_owner != Thread.current
@mon_mutex.lock
@mon_owner = Thread.current
@mon_count = 0
end
@mon_count += 1
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:228
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:199
def mon_exit
mon_check_owner
@mon_count -=1
if @mon_count == 0
@mon_owner = nil
@mon_mutex.unlock
end
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:232
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:267
def mon_check_owner
if @mon_owner != Thread.current
raise ThreadError, "current thread not owner"
end
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:200
activesupport-5.2.2.1/lib/active_support/logger.rb:87
define_method(:add) do |*args, &block|
logger.add(*args, &block)
super(*args, &block)
end
# called from activesupport-5.2.2.1/lib/active_support/logger.rb:28
activesupport-5.2.2.1/lib/active_support/logger_thread_safe_level.rb:29
def level
local_level || super
end
# called from activesupport-5.2.2.1/lib/active_support/logger.rb:88
activesupport-5.2.2.1/lib/active_support/logger_thread_safe_level.rb:17
def local_level
@local_levels[local_log_id]
end
# called from activesupport-5.2.2.1/lib/active_support/logger_thread_safe_level.rb:30
activesupport-5.2.2.1/lib/active_support/logger_thread_safe_level.rb:13
def local_log_id
Thread.current.__id__
end
# called from activesupport-5.2.2.1/lib/active_support/logger_thread_safe_level.rb:18
concurrent-ruby-1.1.5/lib/concurrent/map.rb:132
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from activesupport-5.2.2.1/lib/active_support/logger_thread_safe_level.rb:18
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:19
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from concurrent-ruby-1.1.5/lib/concurrent/map.rb:133
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/logger.rb:455
define_method(:add) do |*args, &block|
logger.add(*args, &block)
super(*args, &block)
end
# called from activesupport-5.2.2.1/lib/active_support/logger.rb:89
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/logger.rb:577
def format_severity(severity)
SEV_LABEL[severity] || 'ANY'
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/logger.rb:472
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/logger.rb:581
def format_message(severity, datetime, progname, msg)
(@formatter || @default_formatter).call(severity, datetime, progname, msg)
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/logger.rb:472
activesupport-5.2.2.1/lib/active_support/tagged_logging.rb:22
def call(severity, timestamp, progname, msg)
super(severity, timestamp, progname, "#{tags_text}#{msg}")
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/logger.rb:582
activesupport-5.2.2.1/lib/active_support/tagged_logging.rb:53
def tags_text
tags = current_tags
if tags.any?
tags.collect { |tag| "[#{tag}] " }.join
end
end
# called from activesupport-5.2.2.1/lib/active_support/tagged_logging.rb:23
activesupport-5.2.2.1/lib/active_support/tagged_logging.rb:47
def current_tags
# We use our object ID here to avoid conflicting with other instances
thread_key = @thread_key ||= "activesupport_tagged_logging_tags:#{object_id}".freeze
Thread.current[thread_key] ||= []
end
# called from activesupport-5.2.2.1/lib/active_support/tagged_logging.rb:54
activesupport-5.2.2.1/lib/active_support/logger.rb:103
def call(severity, timestamp, progname, msg)
super(severity, timestamp, progname, "#{tags_text}#{msg}")
end
# called from activesupport-5.2.2.1/lib/active_support/tagged_logging.rb:23
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/logger.rb:684
def write(message)
begin
synchronize do
if @shift_age and @dev.respond_to?(:stat)
begin
check_shift_log
rescue
warn("log shifting failed. #{$!}")
end
end
begin
@dev.write(message)
rescue
warn("log writing failed. #{$!}")
end
end
rescue Exception => ignored
warn("log writing failed. #{ignored}")
end
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/logger.rb:471
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:227
def mon_synchronize
mon_enter
begin
yield
ensure
mon_exit
end
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/logger.rb:686
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:187
def mon_enter
if @mon_owner != Thread.current
@mon_mutex.lock
@mon_owner = Thread.current
@mon_count = 0
end
@mon_count += 1
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:228
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:199
def mon_exit
mon_check_owner
@mon_count -=1
if @mon_count == 0
@mon_owner = nil
@mon_mutex.unlock
end
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:232
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:267
def mon_check_owner
if @mon_owner != Thread.current
raise ThreadError, "current thread not owner"
end
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:200
activesupport-5.2.2.1/lib/active_support/core_ext/module/attribute_accessors.rb:60
def self.#{sym}
@@#{sym}
end
# called from activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:97
activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:103
def finish(name, id, payload)
@delegate.finish name, id, payload
end
# called from activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:48
activerecord-5.2.2.1/lib/active_record/explain_subscriber.rb:12
def finish(name, id, payload)
if ExplainRegistry.collect? && !ignore_payload?(payload)
ExplainRegistry.queries << payload.values_at(:sql, :binds)
end
end
# called from activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:104
activesupport-5.2.2.1/lib/active_support/per_thread_registry.rb:51
def method_missing(name, *args, &block)
# Caches the method definition as a singleton method of the receiver.
#
# By letting #delegate handle it, we avoid an enclosure that'll capture args.
singleton_class.delegate name, to: :instance
send(name, *args, &block)
end
# called from activerecord-5.2.2.1/lib/active_record/explain_subscriber.rb:13
activesupport-5.2.2.1/lib/active_support/core_ext/module/delegation.rb:154
def delegate(*methods, to: nil, prefix: nil, allow_nil: nil)
unless to
raise ArgumentError, "Delegation needs a target. Supply an options hash with a :to key as the last argument (e.g. delegate :hello, to: :greeter)."
end
if prefix == true && /^[^a-z_]/.match?(to)
raise ArgumentError, "Can only automatically set the delegation prefix when delegating to a method."
end
method_prefix = \
if prefix
"#{prefix == true ? to : prefix}_"
else
""
end
location = caller_locations(1, 1).first
file, line = location.path, location.lineno
to = to.to_s
to = "self.#{to}" if DELEGATION_RESERVED_METHOD_NAMES.include?(to)
methods.map do |method|
# Attribute writer methods only accept one argument. Makes sure []=
# methods still accept two arguments.
definition = /[^\]]=$/.match?(method) ? "arg" : "*args, &block"
# The following generated method calls the target exactly once, storing
# the returned value in a dummy variable.
#
# Reason is twofold: On one hand doing less calls is in general better.
# On the other hand it could be that the target has side-effects,
# whereas conceptually, from the user point of view, the delegator should
# be doing one call.
if allow_nil
method_def = [
"def #{method_prefix}#{method}(#{definition})",
"_ = #{to}",
"if !_.nil? || nil.respond_to?(:#{method})",
" _.#{method}(#{definition})",
"end",
"end"
].join ";"
else
exception = %(raise DelegationError, "#{self}##{method_prefix}#{method} delegated to #{to}.#{method}, but #{to} is nil: \#{self.inspect}")
method_def = [
"def #{method_prefix}#{method}(#{definition})",
" _ = #{to}",
" _.#{method}(#{definition})",
"rescue NoMethodError => e",
" if _.nil? && e.name == :#{method}",
" #{exception}",
" else",
" raise",
" end",
"end"
].join ";"
end
module_eval(method_def, file, line)
end
end
# called from activesupport-5.2.2.1/lib/active_support/per_thread_registry.rb:55
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/set.rb:253
def include?(o)
@hash[o]
end
# called from activesupport-5.2.2.1/lib/active_support/core_ext/module/delegation.rb:174
activesupport-5.2.2.1/lib/active_support/per_thread_registry.rb:55
singleton_class.delegate name, to: :instance
# called from activesupport-5.2.2.1/lib/active_support/per_thread_registry.rb:57
activesupport-5.2.2.1/lib/active_support/per_thread_registry.rb:46
def instance
Thread.current[@per_thread_registry_key] ||= new
end
# called from activesupport-5.2.2.1/lib/active_support/per_thread_registry.rb:55
activerecord-5.2.2.1/lib/active_record/explain_registry.rb:19
def initialize
reset
end
# called from activesupport-5.2.2.1/lib/active_support/per_thread_registry.rb:47
activerecord-5.2.2.1/lib/active_record/explain_registry.rb:27
def reset
@collect = false
@queries = []
end
# called from activerecord-5.2.2.1/lib/active_record/explain_registry.rb:20
activerecord-5.2.2.1/lib/active_record/explain_registry.rb:23
def collect?
@collect
end
# called from activesupport-5.2.2.1/lib/active_support/per_thread_registry.rb:55
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:227
def mon_synchronize
mon_enter
begin
yield
ensure
mon_exit
end
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:836
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:187
def mon_enter
if @mon_owner != Thread.current
@mon_mutex.lock
@mon_owner = Thread.current
@mon_count = 0
end
@mon_count += 1
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:228
activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:848
def adopt_connection(conn)
conn.pool = self
@connections << conn
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:838
activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:147
def lease
if in_use?
msg = "Cannot lease connection, ".dup
if @owner == Thread.current
msg << "it is already leased by the current thread."
else
msg << "it is already in use by a different thread: #{@owner}. " \
"Current thread: #{Thread.current}."
end
raise ActiveRecordError, msg
end
@owner = Thread.current
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:840
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:199
def mon_exit
mon_check_owner
@mon_count -=1
if @mon_count == 0
@mon_owner = nil
@mon_mutex.unlock
end
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:232
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:267
def mon_check_owner
if @mon_owner != Thread.current
raise ThreadError, "current thread not owner"
end
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:200
activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:858
def checkout_and_verify(c)
c._run_checkout_callbacks do
c.verify!
end
c
rescue
remove c
c.disconnect!
raise
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:523
activesupport-5.2.2.1/lib/active_support/callbacks.rb:815
def _run_#{name}_callbacks(&block)
run_callbacks #{name.inspect}, &block
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:859
activesupport-5.2.2.1/lib/active_support/callbacks.rb:94
def run_callbacks(kind)
callbacks = __callbacks[kind.to_sym]
if callbacks.empty?
yield if block_given?
else
env = Filters::Environment.new(self, false, nil)
next_sequence = callbacks.compile
invoke_sequence = Proc.new do
skipped = nil
while true
current = next_sequence
current.invoke_before(env)
if current.final?
env.value = !env.halted && (!block_given? || yield)
elsif current.skip?(env)
(skipped ||= []) << current
next_sequence = next_sequence.nested
next
else
next_sequence = next_sequence.nested
begin
target, block, method, *arguments = current.expand_call_template(env, invoke_sequence)
target.send(method, *arguments, &block)
ensure
next_sequence = current
end
end
current.invoke_after(env)
skipped.pop.invoke_after(env) while skipped && skipped.first
break env.value
end
end
# Common case: no 'around' callbacks defined
if next_sequence.final?
next_sequence.invoke_before(env)
env.value = !env.halted && (!block_given? || yield)
next_sequence.invoke_after(env)
env.value
else
invoke_sequence.call
end
end
end
# called from activesupport-5.2.2.1/lib/active_support/callbacks.rb:816
activesupport-5.2.2.1/lib/active_support/core_ext/class/attribute.rb:124
redefine_method(name) do
if instance_variable_defined?(ivar)
instance_variable_get ivar
else
self.class.public_send name
end
end
# called from activesupport-5.2.2.1/lib/active_support/callbacks.rb:95
activesupport-5.2.2.1/lib/active_support/core_ext/class/attribute.rb:106
redefine_method(name) { val }
# called from activesupport-5.2.2.1/lib/active_support/core_ext/class/attribute.rb:128
activesupport-5.2.2.1/lib/active_support/callbacks.rb:539
def empty?; @chain.empty?; end
# called from activesupport-5.2.2.1/lib/active_support/callbacks.rb:97
activesupport-5.2.2.1/lib/active_support/callbacks.rb:563
def compile
@callbacks || @mutex.synchronize do
final_sequence = CallbackSequence.new
@callbacks ||= @chain.reverse.inject(final_sequence) do |callback_sequence, callback|
callback.apply callback_sequence
end
end
end
# called from activesupport-5.2.2.1/lib/active_support/callbacks.rb:101
activesupport-5.2.2.1/lib/active_support/callbacks.rb:473
def initialize(nested = nil, call_template = nil, user_conditions = nil)
@nested = nested
@call_template = call_template
@user_conditions = user_conditions
@before = []
@after = []
end
# called from activesupport-5.2.2.1/lib/active_support/callbacks.rb:565
activesupport-5.2.2.1/lib/active_support/callbacks.rb:334
def apply(callback_sequence)
user_conditions = conditions_lambdas
user_callback = CallTemplate.build(@filter, self)
case kind
when :before
Filters::Before.build(callback_sequence, user_callback.make_lambda, user_conditions, chain_config, @filter)
when :after
Filters::After.build(callback_sequence, user_callback.make_lambda, user_conditions, chain_config)
when :around
callback_sequence.around(user_callback, user_conditions)
end
end
# called from activesupport-5.2.2.1/lib/active_support/callbacks.rb:567
activesupport-5.2.2.1/lib/active_support/callbacks.rb:374
def conditions_lambdas
@if.map { |c| CallTemplate.build(c, self).make_lambda } +
@unless.map { |c| CallTemplate.build(c, self).inverted_lambda }
end
# called from activesupport-5.2.2.1/lib/active_support/callbacks.rb:335
activesupport-5.2.2.1/lib/active_support/callbacks.rb:447
def self.build(filter, callback)
case filter
when Symbol
new(nil, filter, [], nil)
when Conditionals::Value
new(filter, :call, [:target, :value], nil)
when ::Proc
if filter.arity > 1
new(nil, :instance_exec, [:target, :block], filter)
elsif filter.arity > 0
new(nil, :instance_exec, [:target], filter)
else
new(nil, :instance_exec, [], filter)
end
else
method_to_call = callback.current_scopes.join("_")
new(filter, method_to_call, [:target], nil)
end
end
# called from activesupport-5.2.2.1/lib/active_support/callbacks.rb:336
activesupport-5.2.2.1/lib/active_support/callbacks.rb:383
def initialize(target, method, arguments, block)
@override_target = target
@method_name = method
@arguments = arguments
@override_block = block
end
# called from activesupport-5.2.2.1/lib/active_support/callbacks.rb:450
activesupport-5.2.2.1/lib/active_support/callbacks.rb:423
def make_lambda
lambda do |target, value, &block|
target, block, method, *arguments = expand(target, value, block)
target.send(method, *arguments, &block)
end
end
# called from activesupport-5.2.2.1/lib/active_support/callbacks.rb:342
activesupport-5.2.2.1/lib/active_support/callbacks.rb:213
def self.build(callback_sequence, user_callback, user_conditions, chain_config)
if chain_config[:skip_after_callbacks_if_terminated]
if user_conditions.any?
halting_and_conditional(callback_sequence, user_callback, user_conditions)
else
halting(callback_sequence, user_callback)
end
else
if user_conditions.any?
conditional callback_sequence, user_callback, user_conditions
else
simple callback_sequence, user_callback
end
end
end
# called from activesupport-5.2.2.1/lib/active_support/callbacks.rb:342
activesupport-5.2.2.1/lib/active_support/callbacks.rb:269
def self.simple(callback_sequence, user_callback)
callback_sequence.after do |env|
user_callback.call env.target, env.value
env
end
end
# called from activesupport-5.2.2.1/lib/active_support/callbacks.rb:224
activesupport-5.2.2.1/lib/active_support/callbacks.rb:487
def after(&after)
@after.push(after)
self
end
# called from activesupport-5.2.2.1/lib/active_support/callbacks.rb:270
activesupport-5.2.2.1/lib/active_support/callbacks.rb:504
def final?
!@call_template
end
# called from activesupport-5.2.2.1/lib/active_support/callbacks.rb:130
activesupport-5.2.2.1/lib/active_support/callbacks.rb:512
def invoke_before(arg)
@before.each { |b| b.call(arg) }
end
# called from activesupport-5.2.2.1/lib/active_support/callbacks.rb:131
activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:434
def verify!
reconnect! unless active?
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:860
activerecord-5.2.2.1/lib/active_record/connection_adapters/mysql2_adapter.rb:89
def active?
@connection.ping
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:435
activesupport-5.2.2.1/lib/active_support/callbacks.rb:516
def invoke_after(arg)
@after.each { |a| a.call(arg) }
end
# called from activesupport-5.2.2.1/lib/active_support/callbacks.rb:133
activesupport-5.2.2.1/lib/active_support/callbacks.rb:403
def expand(target, value, block)
result = @arguments.map { |arg|
case arg
when :value; value
when :target; target
when :block; block || raise(ArgumentError)
end
}
result.unshift @method_name
result.unshift @override_block || block
result.unshift @override_target || target
# target, block, method, *arguments = result
# target.send(method, *arguments, &block)
result
end
# called from activesupport-5.2.2.1/lib/active_support/callbacks.rb:425
activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/query_cache.rb:135
def configure_query_cache!
enable_query_cache! if pool.query_cache_enabled
end
# called from activesupport-5.2.2.1/lib/active_support/callbacks.rb:426
activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/query_cache.rb:44
def query_cache_enabled
@query_cache_enabled[connection_cache_key(Thread.current)]
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/query_cache.rb:136
activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:667
def connection_cache_key(thread)
thread
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/query_cache.rb:45
concurrent-ruby-1.1.5/lib/concurrent/map.rb:132
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/query_cache.rb:45
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:19
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from concurrent-ruby-1.1.5/lib/concurrent/map.rb:133
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:108
def get_or_default(key, default_value)
@backend.fetch(key, default_value)
end
# called from concurrent-ruby-1.1.5/lib/concurrent/map.rb:139
concurrent-ruby-1.1.5/lib/concurrent/collection/map/mri_map_backend.rb:17
def []=(key, value)
@write_lock.synchronize { super }
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:382
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:23
def []=(key, value)
@write_lock.synchronize { super }
end
# called from concurrent-ruby-1.1.5/lib/concurrent/collection/map/mri_map_backend.rb:18
activerecord-5.2.2.1/lib/active_record/connection_adapters/mysql/database_statements.rb:23
def execute(sql, name = nil)
# make sure we carry over any changes to ActiveRecord::Base.default_timezone that have been
# made since we established the connection
@connection.query_options[:database_timezone] = ActiveRecord::Base.default_timezone
super
end
# called from (pry):1
activesupport-5.2.2.1/lib/active_support/core_ext/module/attribute_accessors.rb:60
def self.#{sym}
@@#{sym}
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/mysql/database_statements.rb:26
activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:184
def execute(sql, name = nil)
# make sure we carry over any changes to ActiveRecord::Base.default_timezone that have been
# made since we established the connection
@connection.query_options[:database_timezone] = ActiveRecord::Base.default_timezone
super
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/mysql/database_statements.rb:28
activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:568
def log(sql, name = "SQL", binds = [], type_casted_binds = [], statement_name = nil) # :doc:
@instrumenter.instrument(
"sql.active_record",
sql: sql,
name: name,
binds: binds,
type_casted_binds: type_casted_binds,
statement_name: statement_name,
connection_id: object_id) do
begin
@lock.synchronize do
yield
end
rescue => e
raise translate_exception_class(e, sql)
end
end
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:185
activesupport-5.2.2.1/lib/active_support/notifications/instrumenter.rb:19
def instrument(name, payload = {})
# some of the listeners might have state
listeners_state = start name, payload
begin
yield payload
rescue Exception => e
payload[:exception] = [e.class.name, e.message]
payload[:exception_object] = e
raise e
ensure
finish_with_state listeners_state, name, payload
end
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:569
activesupport-5.2.2.1/lib/active_support/notifications/instrumenter.rb:34
def start(name, payload)
@notifier.start name, @id, payload
end
# called from activesupport-5.2.2.1/lib/active_support/notifications/instrumenter.rb:21
activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:43
def start(name, id, payload)
listeners_for(name).each { |s| s.start(name, id, payload) }
end
# called from activesupport-5.2.2.1/lib/active_support/notifications/instrumenter.rb:35
activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:55
def listeners_for(name)
# this is correctly done double-checked locking (Concurrent::Map's lookups have volatile semantics)
@listeners_for[name] || synchronize do
# use synchronisation when accessing @subscribers
@listeners_for[name] ||= @subscribers.select { |s| s.subscribed_to?(name) }
end
end
# called from activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:44
concurrent-ruby-1.1.5/lib/concurrent/map.rb:132
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:57
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:19
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from concurrent-ruby-1.1.5/lib/concurrent/map.rb:133
activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:99
def start(name, id, payload)
@delegate.start name, id, payload
end
# called from activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:44
activesupport-5.2.2.1/lib/active_support/log_subscriber.rb:79
def start(name, id, payload)
super if logger
end
# called from activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:100
activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:90
def logger
ActiveRecord::Base.logger
end
# called from activesupport-5.2.2.1/lib/active_support/log_subscriber.rb:80
activesupport-5.2.2.1/lib/active_support/core_ext/module/attribute_accessors.rb:60
def self.#{sym}
@@#{sym}
end
# called from activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:91
activesupport-5.2.2.1/lib/active_support/subscriber.rb:86
def start(name, id, payload)
super if logger
end
# called from activesupport-5.2.2.1/lib/active_support/log_subscriber.rb:80
activesupport-5.2.2.1/lib/active_support/subscriber.rb:110
def now
Process.clock_gettime(Process::CLOCK_MONOTONIC)
end
# called from activesupport-5.2.2.1/lib/active_support/subscriber.rb:87
activesupport-5.2.2.1/lib/active_support/notifications/instrumenter.rb:58
def initialize(name, start, ending, transaction_id, payload)
@name = name
@payload = payload.dup
@time = start
@transaction_id = transaction_id
@end = ending
@children = []
@duration = nil
end
# called from activesupport-5.2.2.1/lib/active_support/subscriber.rb:87
activesupport-5.2.2.1/lib/active_support/subscriber.rb:106
def event_stack
SubscriberQueueRegistry.instance.get_queue(@queue_key)
end
# called from activesupport-5.2.2.1/lib/active_support/subscriber.rb:88
activesupport-5.2.2.1/lib/active_support/per_thread_registry.rb:46
def instance
Thread.current[@per_thread_registry_key] ||= new
end
# called from activesupport-5.2.2.1/lib/active_support/subscriber.rb:107
activesupport-5.2.2.1/lib/active_support/subscriber.rb:126
def get_queue(queue_key)
@registry[queue_key] ||= []
end
# called from activesupport-5.2.2.1/lib/active_support/subscriber.rb:107
activesupport-5.2.2.1/lib/active_support/subscriber.rb:106
def event_stack
SubscriberQueueRegistry.instance.get_queue(@queue_key)
end
# called from activesupport-5.2.2.1/lib/active_support/subscriber.rb:91
activesupport-5.2.2.1/lib/active_support/per_thread_registry.rb:46
def instance
Thread.current[@per_thread_registry_key] ||= new
end
# called from activesupport-5.2.2.1/lib/active_support/subscriber.rb:107
activesupport-5.2.2.1/lib/active_support/subscriber.rb:126
def get_queue(queue_key)
@registry[queue_key] ||= []
end
# called from activesupport-5.2.2.1/lib/active_support/subscriber.rb:107
activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:99
def start(name, id, payload)
@delegate.start name, id, payload
end
# called from activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:44
activerecord-5.2.2.1/lib/active_record/explain_subscriber.rb:8
def start(name, id, payload)
# unused
end
# called from activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:100
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:227
def mon_synchronize
mon_enter
begin
yield
ensure
mon_exit
end
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:578
activesupport-5.2.2.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:11
def mon_enter
mon_try_enter ||
ActiveSupport::Dependencies.interlock.permit_concurrent_loads { super }
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:228
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:170
def mon_try_enter
if @mon_owner != Thread.current
unless @mon_mutex.try_lock
return false
end
@mon_owner = Thread.current
@mon_count = 0
end
@mon_count += 1
return true
end
# called from activesupport-5.2.2.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:12
activesupport-5.2.2.1/lib/active_support/core_ext/module/attribute_accessors.rb:60
def self.#{sym}
@@#{sym}
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:186
activesupport-5.2.2.1/lib/active_support/dependencies/interlock.rb:46
def permit_concurrent_loads
@lock.yield_shares(compatible: [:load]) do
yield
end
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:186
activesupport-5.2.2.1/lib/active_support/concurrency/share_lock.rb:171
def yield_shares(purpose: nil, compatible: [], block_share: false)
loose_shares = previous_wait = nil
synchronize do
if loose_shares = @sharing.delete(Thread.current)
if previous_wait = @waiting[Thread.current]
purpose = nil unless purpose == previous_wait[0]
compatible &= previous_wait[1]
end
compatible |= [false] unless block_share
@waiting[Thread.current] = [purpose, compatible]
end
@cv.broadcast
end
begin
yield
ensure
synchronize do
wait_for(:yield_shares) { @exclusive_thread && @exclusive_thread != Thread.current }
if previous_wait
@waiting[Thread.current] = previous_wait
else
@waiting.delete Thread.current
end
@sharing[Thread.current] = loose_shares if loose_shares
end
end
end
# called from activesupport-5.2.2.1/lib/active_support/dependencies/interlock.rb:47
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:227
def mon_synchronize
mon_enter
begin
yield
ensure
mon_exit
end
end
# called from activesupport-5.2.2.1/lib/active_support/concurrency/share_lock.rb:173
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:187
def mon_enter
if @mon_owner != Thread.current
@mon_mutex.lock
@mon_owner = Thread.current
@mon_count = 0
end
@mon_count += 1
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:228
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:149
def broadcast
@monitor.__send__(:mon_check_owner)
@cond.broadcast
end
# called from activesupport-5.2.2.1/lib/active_support/concurrency/share_lock.rb:183
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:267
def mon_check_owner
if @mon_owner != Thread.current
raise ThreadError, "current thread not owner"
end
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:150
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:199
def mon_exit
mon_check_owner
@mon_count -=1
if @mon_count == 0
@mon_owner = nil
@mon_mutex.unlock
end
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:232
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:267
def mon_check_owner
if @mon_owner != Thread.current
raise ThreadError, "current thread not owner"
end
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:200
mysql2-0.5.2/lib/mysql2/client.rb:129
def query(sql, options = {})
Thread.handle_interrupt(::Mysql2::Util::TIMEOUT_ERROR_CLASS => :never) do
_query(sql, @query_options.merge(options))
end
end
# called from activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:187
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:227
def mon_synchronize
mon_enter
begin
yield
ensure
mon_exit
end
end
# called from activesupport-5.2.2.1/lib/active_support/concurrency/share_lock.rb:189
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:187
def mon_enter
if @mon_owner != Thread.current
@mon_mutex.lock
@mon_owner = Thread.current
@mon_count = 0
end
@mon_count += 1
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:228
activesupport-5.2.2.1/lib/active_support/concurrency/share_lock.rb:219
def wait_for(method)
@sleeping[Thread.current] = method
@cv.wait_while { yield }
ensure
@sleeping.delete Thread.current
end
# called from activesupport-5.2.2.1/lib/active_support/concurrency/share_lock.rb:190
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:123
def wait_while
while yield
wait
end
end
# called from activesupport-5.2.2.1/lib/active_support/concurrency/share_lock.rb:221
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:199
def mon_exit
mon_check_owner
@mon_count -=1
if @mon_count == 0
@mon_owner = nil
@mon_mutex.unlock
end
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:232
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:267
def mon_check_owner
if @mon_owner != Thread.current
raise ThreadError, "current thread not owner"
end
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:200
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:199
def mon_exit
mon_check_owner
@mon_count -=1
if @mon_count == 0
@mon_owner = nil
@mon_mutex.unlock
end
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:232
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:267
def mon_check_owner
if @mon_owner != Thread.current
raise ThreadError, "current thread not owner"
end
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:200
activesupport-5.2.2.1/lib/active_support/notifications/instrumenter.rb:43
def finish_with_state(listeners_state, name, payload)
@notifier.finish name, @id, payload, listeners_state
end
# called from activesupport-5.2.2.1/lib/active_support/notifications/instrumenter.rb:29
activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:47
def finish(name, id, payload, listeners = listeners_for(name))
listeners.each { |s| s.finish(name, id, payload) }
end
# called from activesupport-5.2.2.1/lib/active_support/notifications/instrumenter.rb:44
activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:103
def finish(name, id, payload)
@delegate.finish name, id, payload
end
# called from activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:48
activesupport-5.2.2.1/lib/active_support/log_subscriber.rb:83
def finish(name, id, payload)
super if logger
rescue => e
if logger
logger.error "Could not log #{name.inspect} event. #{e.class}: #{e.message} #{e.backtrace}"
end
end
# called from activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:104
activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:90
def logger
ActiveRecord::Base.logger
end
# called from activesupport-5.2.2.1/lib/active_support/log_subscriber.rb:84
activesupport-5.2.2.1/lib/active_support/core_ext/module/attribute_accessors.rb:60
def self.#{sym}
@@#{sym}
end
# called from activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:91
activesupport-5.2.2.1/lib/active_support/subscriber.rb:94
def finish(name, id, payload)
super if logger
rescue => e
if logger
logger.error "Could not log #{name.inspect} event. #{e.class}: #{e.message} #{e.backtrace}"
end
end
# called from activesupport-5.2.2.1/lib/active_support/log_subscriber.rb:84
activesupport-5.2.2.1/lib/active_support/subscriber.rb:110
def now
Process.clock_gettime(Process::CLOCK_MONOTONIC)
end
# called from activesupport-5.2.2.1/lib/active_support/subscriber.rb:95
activesupport-5.2.2.1/lib/active_support/subscriber.rb:106
def event_stack
SubscriberQueueRegistry.instance.get_queue(@queue_key)
end
# called from activesupport-5.2.2.1/lib/active_support/subscriber.rb:96
activesupport-5.2.2.1/lib/active_support/per_thread_registry.rb:46
def instance
Thread.current[@per_thread_registry_key] ||= new
end
# called from activesupport-5.2.2.1/lib/active_support/subscriber.rb:107
activesupport-5.2.2.1/lib/active_support/subscriber.rb:126
def get_queue(queue_key)
@registry[queue_key] ||= []
end
# called from activesupport-5.2.2.1/lib/active_support/subscriber.rb:107
activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:20
def sql(event)
self.class.runtime += event.duration
return unless logger.debug?
payload = event.payload
return if IGNORE_PAYLOAD_NAMES.include?(payload[:name])
name = "#{payload[:name]} (#{event.duration.round(1)}ms)"
name = "CACHE #{name}" if payload[:cached]
sql = payload[:sql]
binds = nil
unless (payload[:binds] || []).empty?
casted_params = type_casted_binds(payload[:type_casted_binds])
binds = " " + payload[:binds].zip(casted_params).map { |attr, value|
render_bind(attr, value)
}.inspect
end
name = colorize_payload_name(name, payload[:name])
sql = color(sql, sql_color(sql), true)
debug " #{name} #{sql}#{binds}"
end
# called from activesupport-5.2.2.1/lib/active_support/subscriber.rb:101
activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:11
def self.runtime
ActiveRecord::RuntimeRegistry.sql_runtime ||= 0
end
# called from activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:21
activerecord-5.2.2.1/lib/active_record/runtime_registry.rb:20
class_eval %{ def self.#{val}; instance.#{val}; end }, __FILE__, __LINE__
# called from activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:12
activesupport-5.2.2.1/lib/active_support/per_thread_registry.rb:46
def instance
Thread.current[@per_thread_registry_key] ||= new
end
# called from activerecord-5.2.2.1/lib/active_record/runtime_registry.rb:20
activesupport-5.2.2.1/lib/active_support/notifications/instrumenter.rb:80
def duration
@duration ||= 1000.0 * (self.end - time)
end
# called from activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:21
activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:7
def self.runtime=(value)
ActiveRecord::RuntimeRegistry.sql_runtime = value
end
# called from activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:21
activerecord-5.2.2.1/lib/active_record/runtime_registry.rb:21
class_eval %{ def self.#{val}=(x); instance.#{val}=x; end }, __FILE__, __LINE__
# called from activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:8
activesupport-5.2.2.1/lib/active_support/per_thread_registry.rb:46
def instance
Thread.current[@per_thread_registry_key] ||= new
end
# called from activerecord-5.2.2.1/lib/active_record/runtime_registry.rb:21
activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:90
def logger
ActiveRecord::Base.logger
end
# called from activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:22
activesupport-5.2.2.1/lib/active_support/core_ext/module/attribute_accessors.rb:60
def self.#{sym}
@@#{sym}
end
# called from activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:91
activesupport-5.2.2.1/lib/active_support/logger.rb:94
def #{severity.downcase}? # def debug?
Logger::#{severity} >= level # DEBUG >= level
end # end
EOT
end
# called from activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:22
activesupport-5.2.2.1/lib/active_support/logger_thread_safe_level.rb:29
def level
local_level || super
end
# called from activesupport-5.2.2.1/lib/active_support/logger.rb:95
activesupport-5.2.2.1/lib/active_support/logger_thread_safe_level.rb:17
def local_level
@local_levels[local_log_id]
end
# called from activesupport-5.2.2.1/lib/active_support/logger_thread_safe_level.rb:30
activesupport-5.2.2.1/lib/active_support/logger_thread_safe_level.rb:13
def local_log_id
Thread.current.__id__
end
# called from activesupport-5.2.2.1/lib/active_support/logger_thread_safe_level.rb:18
concurrent-ruby-1.1.5/lib/concurrent/map.rb:132
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from activesupport-5.2.2.1/lib/active_support/logger_thread_safe_level.rb:18
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:19
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from concurrent-ruby-1.1.5/lib/concurrent/map.rb:133
activesupport-5.2.2.1/lib/active_support/notifications/instrumenter.rb:80
def duration
@duration ||= 1000.0 * (self.end - time)
end
# called from activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:28
activesupport-5.2.2.1/lib/active_support/core_ext/numeric/conversions.rb:104
def to_s(format = nil, options = nil)
case format
when nil
super()
when Integer, String
super(format)
when :phone
ActiveSupport::NumberHelper.number_to_phone(self, options || {})
when :currency
ActiveSupport::NumberHelper.number_to_currency(self, options || {})
when :percentage
ActiveSupport::NumberHelper.number_to_percentage(self, options || {})
when :delimited
ActiveSupport::NumberHelper.number_to_delimited(self, options || {})
when :rounded
ActiveSupport::NumberHelper.number_to_rounded(self, options || {})
when :human
ActiveSupport::NumberHelper.number_to_human(self, options || {})
when :human_size
ActiveSupport::NumberHelper.number_to_human_size(self, options || {})
when Symbol
super()
else
super(format)
end
end
# called from activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:28
activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:61
def colorize_payload_name(name, payload_name)
if payload_name.blank? || payload_name == "SQL" # SQL vs Model Load/Exists
color(name, MAGENTA, true)
else
color(name, CYAN, true)
end
end
# called from activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:40
activesupport-5.2.2.1/lib/active_support/core_ext/object/blank.rb:57
def blank?
true
end
# called from activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:62
activesupport-5.2.2.1/lib/active_support/log_subscriber.rb:105
def color(text, color, bold = false) # :doc:
return text unless colorize_logging
color = self.class.const_get(color.upcase) if color.is_a?(Symbol)
bold = bold ? BOLD : ""
"#{bold}#{color}#{text}#{CLEAR}"
end
# called from activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:63
activesupport-5.2.2.1/lib/active_support/core_ext/module/attribute_accessors.rb:67
def #{sym}
@@#{sym}
end
# called from activesupport-5.2.2.1/lib/active_support/log_subscriber.rb:106
activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:69
def sql_color(sql)
case sql
when /\A\s*rollback/mi
RED
when /select .*for update/mi, /\A\s*lock/mi
WHITE
when /\A\s*select/i
BLUE
when /\A\s*insert/i
GREEN
when /\A\s*update/i
YELLOW
when /\A\s*delete/i
RED
when /transaction\s*\Z/i
CYAN
else
MAGENTA
end
end
# called from activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:41
activesupport-5.2.2.1/lib/active_support/log_subscriber.rb:105
def color(text, color, bold = false) # :doc:
return text unless colorize_logging
color = self.class.const_get(color.upcase) if color.is_a?(Symbol)
bold = bold ? BOLD : ""
"#{bold}#{color}#{text}#{CLEAR}"
end
# called from activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:41
activesupport-5.2.2.1/lib/active_support/core_ext/module/attribute_accessors.rb:67
def #{sym}
@@#{sym}
end
# called from activesupport-5.2.2.1/lib/active_support/log_subscriber.rb:106
activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:94
def debug(progname = nil, &block)
return unless super
if ActiveRecord::Base.verbose_query_logs
log_query_source
end
end
# called from activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:43
activesupport-5.2.2.1/lib/active_support/log_subscriber.rb:95
def debug(progname = nil, &block)
return unless super
if ActiveRecord::Base.verbose_query_logs
log_query_source
end
end
# called from activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:95
activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:90
def logger
ActiveRecord::Base.logger
end
# called from activesupport-5.2.2.1/lib/active_support/log_subscriber.rb:96
activesupport-5.2.2.1/lib/active_support/core_ext/module/attribute_accessors.rb:60
def self.#{sym}
@@#{sym}
end
# called from activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:91
activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:90
def logger
ActiveRecord::Base.logger
end
# called from activesupport-5.2.2.1/lib/active_support/log_subscriber.rb:96
activesupport-5.2.2.1/lib/active_support/core_ext/module/attribute_accessors.rb:60
def self.#{sym}
@@#{sym}
end
# called from activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:91
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/logger.rb:490
def debug(progname = nil, &block)
add(DEBUG, nil, progname, &block)
end
# called from activesupport-5.2.2.1/lib/active_support/log_subscriber.rb:96
activesupport-5.2.2.1/lib/active_support/logger.rb:26
define_method(:add) do |*args, &block|
logger.add(*args, &block)
super(*args, &block)
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/logger.rb:491
activesupport-5.2.2.1/lib/active_support/logger.rb:87
def add(severity, message = nil, progname = nil, &block)
return true if @logdev.nil? || (severity || UNKNOWN) < level
super
end
# called from activesupport-5.2.2.1/lib/active_support/logger.rb:27
activesupport-5.2.2.1/lib/active_support/logger_thread_safe_level.rb:29
def level
local_level || super
end
# called from activesupport-5.2.2.1/lib/active_support/logger.rb:88
activesupport-5.2.2.1/lib/active_support/logger_thread_safe_level.rb:17
def local_level
@local_levels[local_log_id]
end
# called from activesupport-5.2.2.1/lib/active_support/logger_thread_safe_level.rb:30
activesupport-5.2.2.1/lib/active_support/logger_thread_safe_level.rb:13
def local_log_id
Thread.current.__id__
end
# called from activesupport-5.2.2.1/lib/active_support/logger_thread_safe_level.rb:18
concurrent-ruby-1.1.5/lib/concurrent/map.rb:132
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from activesupport-5.2.2.1/lib/active_support/logger_thread_safe_level.rb:18
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:19
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from concurrent-ruby-1.1.5/lib/concurrent/map.rb:133
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/logger.rb:455
def add(severity, message = nil, progname = nil, &block)
return true if @logdev.nil? || (severity || UNKNOWN) < level
super
end
# called from activesupport-5.2.2.1/lib/active_support/logger.rb:89
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/logger.rb:577
def format_severity(severity)
SEV_LABEL[severity] || 'ANY'
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/logger.rb:472
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/logger.rb:581
def format_message(severity, datetime, progname, msg)
(@formatter || @default_formatter).call(severity, datetime, progname, msg)
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/logger.rb:472
activesupport-5.2.2.1/lib/active_support/logger.rb:103
def call(severity, timestamp, progname, msg)
"#{String === msg ? msg : msg.inspect}\n"
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/logger.rb:582
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/logger.rb:684
def write(message)
begin
synchronize do
if @shift_age and @dev.respond_to?(:stat)
begin
check_shift_log
rescue
warn("log shifting failed. #{$!}")
end
end
begin
@dev.write(message)
rescue
warn("log writing failed. #{$!}")
end
end
rescue Exception => ignored
warn("log writing failed. #{ignored}")
end
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/logger.rb:471
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:227
def mon_synchronize
mon_enter
begin
yield
ensure
mon_exit
end
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/logger.rb:686
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:187
def mon_enter
if @mon_owner != Thread.current
@mon_mutex.lock
@mon_owner = Thread.current
@mon_count = 0
end
@mon_count += 1
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:228
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:199
def mon_exit
mon_check_owner
@mon_count -=1
if @mon_count == 0
@mon_owner = nil
@mon_mutex.unlock
end
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:232
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:267
def mon_check_owner
if @mon_owner != Thread.current
raise ThreadError, "current thread not owner"
end
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:200
activesupport-5.2.2.1/lib/active_support/logger.rb:87
define_method(:add) do |*args, &block|
logger.add(*args, &block)
super(*args, &block)
end
# called from activesupport-5.2.2.1/lib/active_support/logger.rb:28
activesupport-5.2.2.1/lib/active_support/logger_thread_safe_level.rb:29
def level
local_level || super
end
# called from activesupport-5.2.2.1/lib/active_support/logger.rb:88
activesupport-5.2.2.1/lib/active_support/logger_thread_safe_level.rb:17
def local_level
@local_levels[local_log_id]
end
# called from activesupport-5.2.2.1/lib/active_support/logger_thread_safe_level.rb:30
activesupport-5.2.2.1/lib/active_support/logger_thread_safe_level.rb:13
def local_log_id
Thread.current.__id__
end
# called from activesupport-5.2.2.1/lib/active_support/logger_thread_safe_level.rb:18
concurrent-ruby-1.1.5/lib/concurrent/map.rb:132
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from activesupport-5.2.2.1/lib/active_support/logger_thread_safe_level.rb:18
concurrent-ruby-1.1.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb:19
def [](key)
if value = super # non-falsy value is an existing mapping, return it right away
value
# re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call
# a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value
# would be returned)
# note: nil == value check is not technically necessary
elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL))
@default_proc.call(self, key)
else
value
end
end
# called from concurrent-ruby-1.1.5/lib/concurrent/map.rb:133
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/logger.rb:455
define_method(:add) do |*args, &block|
logger.add(*args, &block)
super(*args, &block)
end
# called from activesupport-5.2.2.1/lib/active_support/logger.rb:89
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/logger.rb:577
def format_severity(severity)
SEV_LABEL[severity] || 'ANY'
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/logger.rb:472
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/logger.rb:581
def format_message(severity, datetime, progname, msg)
(@formatter || @default_formatter).call(severity, datetime, progname, msg)
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/logger.rb:472
activesupport-5.2.2.1/lib/active_support/tagged_logging.rb:22
def call(severity, timestamp, progname, msg)
super(severity, timestamp, progname, "#{tags_text}#{msg}")
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/logger.rb:582
activesupport-5.2.2.1/lib/active_support/tagged_logging.rb:53
def tags_text
tags = current_tags
if tags.any?
tags.collect { |tag| "[#{tag}] " }.join
end
end
# called from activesupport-5.2.2.1/lib/active_support/tagged_logging.rb:23
activesupport-5.2.2.1/lib/active_support/tagged_logging.rb:47
def current_tags
# We use our object ID here to avoid conflicting with other instances
thread_key = @thread_key ||= "activesupport_tagged_logging_tags:#{object_id}".freeze
Thread.current[thread_key] ||= []
end
# called from activesupport-5.2.2.1/lib/active_support/tagged_logging.rb:54
activesupport-5.2.2.1/lib/active_support/logger.rb:103
def call(severity, timestamp, progname, msg)
super(severity, timestamp, progname, "#{tags_text}#{msg}")
end
# called from activesupport-5.2.2.1/lib/active_support/tagged_logging.rb:23
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/logger.rb:684
def write(message)
begin
synchronize do
if @shift_age and @dev.respond_to?(:stat)
begin
check_shift_log
rescue
warn("log shifting failed. #{$!}")
end
end
begin
@dev.write(message)
rescue
warn("log writing failed. #{$!}")
end
end
rescue Exception => ignored
warn("log writing failed. #{ignored}")
end
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/logger.rb:471
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:227
def mon_synchronize
mon_enter
begin
yield
ensure
mon_exit
end
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/logger.rb:686
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:187
def mon_enter
if @mon_owner != Thread.current
@mon_mutex.lock
@mon_owner = Thread.current
@mon_count = 0
end
@mon_count += 1
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:228
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:199
def mon_exit
mon_check_owner
@mon_count -=1
if @mon_count == 0
@mon_owner = nil
@mon_mutex.unlock
end
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:232
/Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:267
def mon_check_owner
if @mon_owner != Thread.current
raise ThreadError, "current thread not owner"
end
end
# called from /Users/yhirano/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:200
activesupport-5.2.2.1/lib/active_support/core_ext/module/attribute_accessors.rb:60
def self.#{sym}
@@#{sym}
end
# called from activerecord-5.2.2.1/lib/active_record/log_subscriber.rb:97
activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:103
def finish(name, id, payload)
@delegate.finish name, id, payload
end
# called from activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:48
activerecord-5.2.2.1/lib/active_record/explain_subscriber.rb:12
def finish(name, id, payload)
if ExplainRegistry.collect? && !ignore_payload?(payload)
ExplainRegistry.queries << payload.values_at(:sql, :binds)
end
end
# called from activesupport-5.2.2.1/lib/active_support/notifications/fanout.rb:104
activesupport-5.2.2.1/lib/active_support/per_thread_registry.rb:55
singleton_class.delegate name, to: :instance
# called from activerecord-5.2.2.1/lib/active_record/explain_subscriber.rb:13
activesupport-5.2.2.1/lib/active_support/per_thread_registry.rb:46
def instance
Thread.current[@per_thread_registry_key] ||= new
end
# called from activesupport-5.2.2.1/lib/active_support/per_thread_registry.rb:55