Rails Active Storage продолжает давать сбой, но как отладить?

У меня все еще возникает проблема срыва рельсов при доступе к прикрепленным файлам изображений. По крайней мере, я так думаю.

Я понятия не имею, как понять, в чем настоящая проблема.

Я заметил, что есть некоторая информация о сбоях в работе own_to_association, но я не уверен, связана ли это с проблемой или с активным хранилищем. Я попробовал переключить сериализатор json, но возникла та же проблема.

Ruby: 2.5.5 Rails: 6.0.0 (та же ошибка, что и в предыдущей версии) Доступ через интерфейс ember.js.

Модель:

class Boat < ApplicationRecord
  has_many :histories
  has_and_belongs_to_many :boat_collection
  has_many_attached :images
  has_one_attached :thumbnail
end
  • в данный момент используются только эскизы

Сериализатор:

module BoatHelper
  extend ActiveSupport::Concern
  include Rails.application.routes.url_helpers

  class_methods do
    def thumbnail_url(object)
      Rails.application.routes.url_helpers.rails_blob_url(object.thumbnail, :host => 'localhost:3000') if object.thumbnail.attachment
    end
  end
end

class BoatSerializer < ActiveModel::Serializer
  include FastJsonapi::ObjectSerializer
  include BoatHelper

  set_key_transform :dash

  attributes :id, :listing_title, :url, :price, :currency, :first_found, :listing_id, :total_inches, :country, :state, :city, :year, :make, :model, :cabins, :latitude, :longitude, :location, :title
  # has_and_belongs_to_many :boat_collection

  attribute :thumbnail do |object|
    thumbnail_url(object)
  end
end

Контроллер:

def index
  @boats = Boat.all
  render json: BoatSerializer.new(@boats).serialized_json
end

Информация о сбое:

Started GET "/rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBaXdFIiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--0891bcd5249ef8908c621dfb51faa206dcbfcde6/thumbnail-yachthub-237523.jpg" for ::1 at 2019-09-08 13:05:24 +1000
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/puma-3.12.1/lib/puma/client.rb:315: [BUG] object allocation during garbage collection phase
ruby 2.5.5p157 (2019-03-15 revision 67260) [x64-mingw32]

 1436 C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/activerecord-6.0.0/lib/active_record/associations/builder/has_and_belongs_to_many.rb
 1437 C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/activerecord-6.0.0/lib/active_record/associations/builder/belongs_to.rb
 1438 C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/activerecord-6.0.0/lib/active_record/associations/association.rb
 1439 C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/activerecord-6.0.0/lib/active_record/associations/singular_association.rb
 1440 C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/activerecord-6.0.0/lib/active_record/associations/foreign_association.rb
 1441 C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/activerecord-6.0.0/lib/active_record/associations/has_one_association.rb
 1442 C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/activerecord-6.0.0/lib/active_record/associations/association_scope.rb
 1443 C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/activerecord-6.0.0/lib/active_record/associations/alias_tracker.rb
 1444 C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/activerecord-6.0.0/lib/active_record/statement_cache.rb
 1445 C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/activerecord-6.0.0/lib/active_record/associations/belongs_to_association.rb
 1446 C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/activerecord-6.0.0/lib/active_record/associations/belongs_to_polymorphic_association.rb
 1447 C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/activestorage-6.0.0/lib/active_storage/downloader.rb
 1448 C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/activestorage-6.0.0/lib/active_storage/analyzer/null_analyzer.rb
 1449 C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/activerecord-6.0.0/lib/active_record/coders/json.rb
 1450 C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/activestorage-6.0.0/lib/active_storage/log_subscriber.rb
 1451 C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/activestorage-6.0.0/lib/active_storage/service.rb
 1452 C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/activestorage-6.0.0/lib/active_storage/service/configurator.rb
 1453 C:/Ruby25-x64/lib/ruby/2.5.0/x64-mingw32/digest/md5.so
 1454 C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/activestorage-6.0.0/lib/active_storage/service/disk_service.rb

[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.

person Joshua Jenkins    schedule 12.09.2019    source источник
comment
Это похоже на настоящую ошибку в исходном коде rails, а не на проблему, которую вы создали - возможно, стоит поднять заявку с ними - guides.rubyonrails.org/   -  person Mark    schedule 12.09.2019


Ответы (1)


Ruby: 2.5.5 Rails: 6.0.0 У меня была такая же проблема, я исправил ее, удалив Ruby и установив 2.6.5

person Robertylious    schedule 10.10.2019