Skip to content

Instantly share code, notes, and snippets.

@gemp
Created July 19, 2020 10:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gemp/3a2f552bf0468460a2eb44f66e479e28 to your computer and use it in GitHub Desktop.
Save gemp/3a2f552bf0468460a2eb44f66e479e28 to your computer and use it in GitHub Desktop.
Started GET "/pools/list.json" for 127.0.0.1 at 2020-07-19 12:44:25 +0200
Processing by PoolsController#list as JSON
User Load (2.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT $2 [["id", 1], ["LIMIT", 1]]
Role Load (1.1ms) SELECT "roles".* FROM "roles" INNER JOIN "users_roles" ON "roles"."id" = "users_roles"."role_id" WHERE "users_roles"."user_id" = $1 [["user_id", 1]]
Edition Load (0.7ms) SELECT "editions".* FROM "editions" WHERE "editions"."id" = $1 LIMIT $2 [["id", 22], ["LIMIT", 1]]
Rendering pools/list.json.streamer
(7.2ms) SELECT COUNT(*) AS "size", MAX("users"."updated_at") AS timestamp FROM "users" WHERE ("roles"."name" IN ('admin', 'previewer') OR "roles"."name" IS NULL) AND "users_pools"."edition_id" = $1 [["edition_id", 22]]
Rendered pools/list.json.streamer (16.1ms)
Completed 500 Internal Server Error in 33ms (ActiveRecord: 11.2ms)
ActionView::Template::Error (PG::UndefinedTable: ERROR: missing FROM-clause entry for table "roles"
LINE 1: ...s"."updated_at") AS timestamp FROM "users" WHERE ("roles"."n...
^
: SELECT COUNT(*) AS "size", MAX("users"."updated_at") AS timestamp FROM "users" WHERE ("roles"."name" IN ('admin', 'previewer') OR "roles"."name" IS NULL) AND "users_pools"."edition_id" = $1):
1: json.object! do
2: json.cache! @users do
3: json.users @users do |user|
4: json.object! do
5: json.extract! user, :id, :name, :email, :current_sign_in_at, :last_sign_in_at
rack-mini-profiler (1.1.6) lib/patches/db/pg.rb:113:in `exec'
rack-mini-profiler (1.1.6) lib/patches/db/pg.rb:113:in `async_exec'
activerecord (5.1.6.2) lib/active_record/connection_adapters/postgresql_adapter.rb:616:in `block (2 levels) in exec_no_cache'
activesupport (5.1.6.2) lib/active_support/dependencies/interlock.rb:46:in `block in permit_concurrent_loads'
activesupport (5.1.6.2) lib/active_support/concurrency/share_lock.rb:185:in `yield_shares'
activesupport (5.1.6.2) lib/active_support/dependencies/interlock.rb:45:in `permit_concurrent_loads'
activerecord (5.1.6.2) lib/active_record/connection_adapters/postgresql_adapter.rb:615:in `block in exec_no_cache'
activerecord (5.1.6.2) lib/active_record/connection_adapters/abstract_adapter.rb:613:in `block (2 levels) in log'
/Users/gemp/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/monitor.rb:230:in `mon_synchronize'
activerecord (5.1.6.2) lib/active_record/connection_adapters/abstract_adapter.rb:612:in `block in log'
activesupport (5.1.6.2) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activerecord (5.1.6.2) lib/active_record/connection_adapters/abstract_adapter.rb:604:in `log'
activerecord (5.1.6.2) lib/active_record/connection_adapters/postgresql_adapter.rb:614:in `exec_no_cache'
activerecord (5.1.6.2) lib/active_record/connection_adapters/postgresql_adapter.rb:603:in `execute_and_clear'
activerecord (5.1.6.2) lib/active_record/connection_adapters/postgresql/database_statements.rb:79:in `exec_query'
activerecord (5.1.6.2) lib/active_record/connection_adapters/abstract/database_statements.rb:371:in `select'
activerecord (5.1.6.2) lib/active_record/connection_adapters/abstract/database_statements.rb:42:in `select_all'
activerecord (5.1.6.2) lib/active_record/connection_adapters/abstract/query_cache.rb:95:in `block in select_all'
activerecord (5.1.6.2) lib/active_record/connection_adapters/abstract/query_cache.rb:118:in `block in cache_sql'
/Users/gemp/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/monitor.rb:230:in `mon_synchronize'
activerecord (5.1.6.2) lib/active_record/connection_adapters/abstract/query_cache.rb:104:in `cache_sql'
activerecord (5.1.6.2) lib/active_record/connection_adapters/abstract/query_cache.rb:95:in `select_all'
activerecord (5.1.6.2) lib/active_record/connection_adapters/abstract/database_statements.rb:49:in `select_one'
activerecord (5.1.6.2) lib/active_record/collection_cache_key.rb:30:in `collection_cache_key'
activerecord (5.1.6.2) lib/active_record/relation.rb:322:in `cache_key'
activesupport (5.1.6.2) lib/active_support/cache.rb:91:in `retrieve_cache_key'
activesupport (5.1.6.2) lib/active_support/cache.rb:92:in `block in retrieve_cache_key'
activesupport (5.1.6.2) lib/active_support/cache.rb:92:in `map'
activesupport (5.1.6.2) lib/active_support/cache.rb:92:in `retrieve_cache_key'
activesupport (5.1.6.2) lib/active_support/cache.rb:84:in `expand_cache_key'
actionpack (5.1.6.2) lib/abstract_controller/caching/fragments.rb:67:in `fragment_cache_key'
actionpack (5.1.6.2) lib/abstract_controller/helpers.rb:68:in `fragment_cache_key'
turbostreamer (1.9.0) lib/turbostreamer/template.rb:206:in `_cache_key'
turbostreamer (1.9.0) lib/turbostreamer/template.rb:174:in `_cache_fragment_for'
turbostreamer (1.9.0) lib/turbostreamer/template.rb:59:in `cache!'
app/views/pools/list.json.streamer:2:in `block in _app_views_pools_list_json_streamer__328756617842131282_70185811642240'
turbostreamer (1.9.0) lib/turbostreamer.rb:58:in `block in object!'
turbostreamer (1.9.0) lib/turbostreamer.rb:358:in `_scope'
turbostreamer (1.9.0) lib/turbostreamer.rb:58:in `object!'
app/views/pools/list.json.streamer:1:in `_app_views_pools_list_json_streamer__328756617842131282_70185811642240'
actionview (5.1.6.2) lib/action_view/template.rb:157:in `block in render'
activesupport (5.1.6.2) lib/active_support/notifications.rb:168:in `instrument'
actionview (5.1.6.2) lib/action_view/template.rb:352:in `instrument_render_template'
actionview (5.1.6.2) lib/action_view/template.rb:155:in `render'
rack-mini-profiler (1.1.6) lib/mini_profiler/profiling_methods.rb:104:in `block in profile_method'
actionview (5.1.6.2) lib/action_view/renderer/template_renderer.rb:52:in `block (2 levels) in render_template'
actionview (5.1.6.2) lib/action_view/renderer/abstract_renderer.rb:42:in `block in instrument'
activesupport (5.1.6.2) lib/active_support/notifications.rb:166:in `block in instrument'
activesupport (5.1.6.2) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (5.1.6.2) lib/active_support/notifications.rb:166:in `instrument'
actionview (5.1.6.2) lib/action_view/renderer/abstract_renderer.rb:41:in `instrument'
actionview (5.1.6.2) lib/action_view/renderer/template_renderer.rb:51:in `block in render_template'
actionview (5.1.6.2) lib/action_view/renderer/template_renderer.rb:59:in `render_with_layout'
actionview (5.1.6.2) lib/action_view/renderer/template_renderer.rb:50:in `render_template'
actionview (5.1.6.2) lib/action_view/renderer/template_renderer.rb:14:in `render'
actionview (5.1.6.2) lib/action_view/renderer/renderer.rb:42:in `render_template'
actionview (5.1.6.2) lib/action_view/renderer/renderer.rb:23:in `render'
actionview (5.1.6.2) lib/action_view/rendering.rb:103:in `_render_template'
actionpack (5.1.6.2) lib/action_controller/metal/streaming.rb:217:in `_render_template'
actionview (5.1.6.2) lib/action_view/rendering.rb:83:in `render_to_body'
actionpack (5.1.6.2) lib/action_controller/metal/rendering.rb:52:in `render_to_body'
actionpack (5.1.6.2) lib/action_controller/metal/renderers.rb:141:in `render_to_body'
actionpack (5.1.6.2) lib/abstract_controller/rendering.rb:24:in `render'
actionpack (5.1.6.2) lib/action_controller/metal/rendering.rb:36:in `render'
actionpack (5.1.6.2) lib/action_controller/metal/instrumentation.rb:44:in `block (2 levels) in render'
activesupport (5.1.6.2) lib/active_support/core_ext/benchmark.rb:12:in `block in ms'
/Users/gemp/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/benchmark.rb:308:in `realtime'
activesupport (5.1.6.2) lib/active_support/core_ext/benchmark.rb:12:in `ms'
actionpack (5.1.6.2) lib/action_controller/metal/instrumentation.rb:44:in `block in render'
actionpack (5.1.6.2) lib/action_controller/metal/instrumentation.rb:87:in `cleanup_view_runtime'
activerecord (5.1.6.2) lib/active_record/railties/controller_runtime.rb:29:in `cleanup_view_runtime'
actionpack (5.1.6.2) lib/action_controller/metal/instrumentation.rb:43:in `render'
actionpack (5.1.6.2) lib/action_controller/metal/implicit_render.rb:33:in `default_render'
actionpack (5.1.6.2) lib/action_controller/metal/basic_implicit_render.rb:4:in `block in send_action'
actionpack (5.1.6.2) lib/action_controller/metal/basic_implicit_render.rb:4:in `tap'
actionpack (5.1.6.2) lib/action_controller/metal/basic_implicit_render.rb:4:in `send_action'
actionpack (5.1.6.2) lib/abstract_controller/base.rb:186:in `process_action'
actionpack (5.1.6.2) lib/action_controller/metal/rendering.rb:30:in `process_action'
actionpack (5.1.6.2) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
activesupport (5.1.6.2) lib/active_support/callbacks.rb:131:in `run_callbacks'
actionpack (5.1.6.2) lib/abstract_controller/callbacks.rb:19:in `process_action'
actionpack (5.1.6.2) lib/action_controller/metal/rescue.rb:20:in `process_action'
actionpack (5.1.6.2) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
activesupport (5.1.6.2) lib/active_support/notifications.rb:166:in `block in instrument'
activesupport (5.1.6.2) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (5.1.6.2) lib/active_support/notifications.rb:166:in `instrument'
actionpack (5.1.6.2) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (5.1.6.2) lib/action_controller/metal/params_wrapper.rb:252:in `process_action'
activerecord (5.1.6.2) lib/active_record/railties/controller_runtime.rb:22:in `process_action'
actionpack (5.1.6.2) lib/abstract_controller/base.rb:124:in `process'
actionview (5.1.6.2) lib/action_view/rendering.rb:30:in `process'
rack-mini-profiler (1.1.6) lib/mini_profiler/profiling_methods.rb:104:in `block in profile_method'
actionpack (5.1.6.2) lib/action_controller/metal.rb:189:in `dispatch'
actionpack (5.1.6.2) lib/action_controller/metal.rb:253:in `dispatch'
actionpack (5.1.6.2) lib/action_dispatch/routing/route_set.rb:49:in `dispatch'
actionpack (5.1.6.2) lib/action_dispatch/routing/route_set.rb:31:in `serve'
actionpack (5.1.6.2) lib/action_dispatch/journey/router.rb:50:in `block in serve'
actionpack (5.1.6.2) lib/action_dispatch/journey/router.rb:33:in `each'
actionpack (5.1.6.2) lib/action_dispatch/journey/router.rb:33:in `serve'
actionpack (5.1.6.2) lib/action_dispatch/routing/route_set.rb:844:in `call'
turnout (2.5.0) lib/rack/turnout.rb:25:in `call'
p3p (2.0.0) lib/p3p/middleware.rb:9:in `call'
oink (0.10.1) lib/oink/middleware.rb:17:in `call'
warden (1.2.8) lib/warden/manager.rb:36:in `block in call'
warden (1.2.8) lib/warden/manager.rb:34:in `catch'
warden (1.2.8) lib/warden/manager.rb:34:in `call'
rack (2.1.2) lib/rack/etag.rb:27:in `call'
rack (2.1.2) lib/rack/conditional_get.rb:27:in `call'
rack (2.1.2) lib/rack/head.rb:14:in `call'
rack (2.1.2) lib/rack/session/abstract/id.rb:269:in `context'
rack (2.1.2) lib/rack/session/abstract/id.rb:263:in `call'
actionpack (5.1.6.2) lib/action_dispatch/middleware/cookies.rb:613:in `call'
activerecord (5.1.6.2) lib/active_record/migration.rb:556:in `call'
actionpack (5.1.6.2) lib/action_dispatch/middleware/callbacks.rb:26:in `block in call'
activesupport (5.1.6.2) lib/active_support/callbacks.rb:97:in `run_callbacks'
actionpack (5.1.6.2) lib/action_dispatch/middleware/callbacks.rb:24:in `call'
actionpack (5.1.6.2) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.1.6.2) lib/action_dispatch/middleware/debug_exceptions.rb:59:in `call'
web-console (3.7.0) lib/web_console/middleware.rb:135:in `call_app'
web-console (3.7.0) lib/web_console/middleware.rb:30:in `block in call'
web-console (3.7.0) lib/web_console/middleware.rb:20:in `catch'
web-console (3.7.0) lib/web_console/middleware.rb:20:in `call'
actionpack (5.1.6.2) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
railties (5.1.6.2) lib/rails/rack/logger.rb:36:in `call_app'
railties (5.1.6.2) lib/rails/rack/logger.rb:24:in `block in call'
activesupport (5.1.6.2) lib/active_support/tagged_logging.rb:69:in `block in tagged'
activesupport (5.1.6.2) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (5.1.6.2) lib/active_support/tagged_logging.rb:69:in `tagged'
railties (5.1.6.2) lib/rails/rack/logger.rb:24:in `call'
sprockets-rails (3.2.1) lib/sprockets/rails/quiet_assets.rb:13:in `call'
actionpack (5.1.6.2) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
actionpack (5.1.6.2) lib/action_dispatch/middleware/request_id.rb:25:in `call'
rack (2.1.2) lib/rack/method_override.rb:24:in `call'
rack (2.1.2) lib/rack/runtime.rb:24:in `call'
actionpack (5.1.6.2) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.1.6.2) lib/action_dispatch/middleware/static.rb:125:in `call'
rack (2.1.2) lib/rack/sendfile.rb:113:in `call'
rack-mini-profiler (1.1.6) lib/mini_profiler/profiler.rb:296:in `call'
railties (5.1.6.2) lib/rails/engine.rb:522:in `call'
puma (3.9.1) lib/puma/configuration.rb:224:in `call'
puma (3.9.1) lib/puma/server.rb:602:in `handle_request'
puma (3.9.1) lib/puma/server.rb:435:in `process_client'
puma (3.9.1) lib/puma/server.rb:299:in `block in run'
puma (3.9.1) lib/puma/thread_pool.rb:120:in `block in spawn_thread'
@gemp
Copy link
Author

gemp commented Jul 19, 2020

Error when caching a TurboStreamer template (see issue). This works:

# pools_controller.rb
class PoolsController < ApplicationController
  def index
    @users = User.includes(:roles).with_any_role(:admin, :previewer)
  end

# index.json.streamer
json.object! do
  json.users @users do |user|
    json.object! do
      json.extract! user, :id, :name, :email
        json.roles user.roles do |role| 
          json.object! do
            json.extract! role, :id, :name
          end
        end
      end
    end
  end
end

Adding cache produce this error (with stack trace):

# index.json.streamer
json.object! do
  json.cache! @users do
    json.users @users do |user|
    ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment