Skip to content

Instantly share code, notes, and snippets.

@tripleee
Created October 20, 2021 20:20
Show Gist options
  • Save tripleee/6b2dcef28a3d15e00b45ede805bc7ddc to your computer and use it in GitHub Desktop.
Save tripleee/6b2dcef28a3d15e00b45ede805bc7ddc to your computer and use it in GitHub Desktop.
metasmoke rails db:seed failure
#20 18.45 + rails db:seed
#20 22.52 /usr/src/app/config/initializers/appconfig.rb:3: warning: already initialized constant AppConfig
#20 22.52 /usr/src/app/config/application.rb:50: warning: previous definition of AppConfig was here
#20 24.28 rails aborted!
#20 24.29 NoMethodError: undefined method `count' for nil:NilClass
#20 24.29 /usr/src/app/app/helpers/sites_helper.rb:9:in `update_sites'
#20 24.29 /usr/src/app/db/seeds.rb:16:in `<top (required)>'
#20 24.29 /usr/local/bundle/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:285:in `load'
#20 24.29 /usr/local/bundle/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:285:in `block in load'
#20 24.29 /usr/local/bundle/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:257:in `load_dependency'
#20 24.29 /usr/local/bundle/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:285:in `load'
#20 24.29 /usr/local/bundle/gems/railties-5.2.6/lib/rails/engine.rb:554:in `block in load_seed'
#20 24.29 /usr/local/bundle/gems/railties-5.2.6/lib/rails/engine.rb:672:in `with_inline_jobs'
#20 24.29 /usr/local/bundle/gems/railties-5.2.6/lib/rails/engine.rb:554:in `load_seed'
#20 24.29 /usr/local/bundle/gems/activerecord-5.2.6/lib/active_record/tasks/database_tasks.rb:281:in `load_seed'
#20 24.29 /usr/local/bundle/gems/activerecord-5.2.6/lib/active_record/railties/databases.rake:194:in `block (2 levels) in <top (required)>'
#20 24.29 /usr/local/bundle/gems/railties-5.2.6/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
#20 24.29 /usr/local/bundle/gems/railties-5.2.6/lib/rails/commands/rake/rake_command.rb:20:in `perform'
#20 24.29 /usr/local/bundle/gems/railties-5.2.6/lib/rails/command.rb:48:in `invoke'
#20 24.29 /usr/local/bundle/gems/railties-5.2.6/lib/rails/commands.rb:18:in `<top (required)>'
#20 24.29 bin/rails:11:in `require'
#20 24.29 bin/rails:11:in `<main>'
#20 24.29 Tasks: TOP => db:seed
#20 24.29 (See full trace by running task with --trace)
#20 24.31 <table>
#20 24.31 <thead>
#20 24.31 <tr><td><strong>Path</strong></td><td><strong>Description</strong></td></tr>
#20 24.31 </thead>
#20 24.31 <tbody>
#20 24.31 </tbody>
#20 24.31 </table>
@tripleee
Copy link
Author

Pardon the prefixes from Docker, #20 simply means this was the 20th build step in my Dockerfile and the number after it is a timestamp.

@tripleee
Copy link
Author

I guess the warnings here are benign ...?

#20 14.04 + rails c
#20 18.23 /usr/src/app/config/initializers/appconfig.rb:3: warning: already initialized constant AppConfig
#20 18.23 /usr/src/app/config/application.rb:50: warning: previous definition of AppConfig was here
#20 18.80 Loading development environment (Rails 5.2.6)
#20 18.80 Switch to inspect mode.
#20 18.80 u = User.create(
#20 18.80       username: 'metasmoke', email: 'metasmoke@localhost', password: 'password')
#20 18.81    (0.4ms)  SET NAMES utf8,  @@SESSION.sql_mode = CONCAT(CONCAT(@@sql_mode, ',STRICT_ALL_TABLES'), ',NO_AUTO_VALUE_ON_ZERO'),  @@SESSION.sql_auto_is_null = 0, @@SESSION.wait_timeout = 2147483
#20 18.89    (0.3ms)  BEGIN
#20 18.91   User Exists (0.5ms)  SELECT  1 AS one FROM `users` WHERE `users`.`email` = BINARY 'metasmoke@localhost' LIMIT 1
#20 18.91   User Create (0.4ms)  INSERT INTO `users` (`email`, `encrypted_password`, `created_at`, `updated_at`, `username`) VALUES ('metasmoke@localhost', '$2a$10$K2AsBTfJkQ6GxT6kjAzQKuK9Oyptm1KcWyfBnuhKLbid0c7a9zgIm', '2021-10-20 20:22:06', '2021-10-20 20:22:06', 'metasmoke')
#20 18.91 [ActionCable] Broadcasting to api:users_create: {:event_type=>"create", :event_class=>"User", :object=>{"id"=>1, "remember_created_at"=>nil, "created_at"=>Wed, 20 Oct 2021 20:22:06 UTC +00:00, "updated_at"=>Wed, 20 Oct 2021 20:22:06 UTC +00:00, "username"=>"metasmoke", "stackexchange_chat_id"=>nil, "meta_stackexchange_chat_id"=>nil, "stackoverflow_chat_id"=>nil, "stack_exchange_account_id"=>nil, "flags_enabled"=>false, "encrypted_api_token_legacy"=>nil, "enabled_2fa"=>nil, "announcement_emails"=>nil, "oauth_created"=>nil, "eu_resident"=>nil, "privacy_accepted"=>nil, "token_migrated_legacy"=>false, "write_authenticated"=>false}}
#20 18.92   SiteSetting Load (0.4ms)  SELECT  `site_settings`.* FROM `site_settings` WHERE `site_settings`.`name` = 'auto_flagger_role' LIMIT 1
#20 18.93   SiteSetting Load (0.3ms)  SELECT  `site_settings`.* FROM `site_settings` WHERE `site_settings`.`name` = 'new_account_messages_enabled' LIMIT 1
#20 18.93    (0.8ms)  COMMIT
#20 18.93 Errno::ENOTTY (Inappropriate ioctl for device)
#20 18.93 	from /usr/local/lib/ruby/2.7.0/irb/input-method.rb:42:in `winsize'
#20 18.93 	from /usr/local/lib/ruby/2.7.0/irb/input-method.rb:42:in `winsize'
#20 18.93 	from /usr/local/lib/ruby/2.7.0/irb.rb:753:in `output_value'
#20 18.93 	from /usr/local/lib/ruby/2.7.0/irb.rb:545:in `block (2 levels) in eval_input'
#20 18.93 	from /usr/local/lib/ruby/2.7.0/irb.rb:704:in `signal_status'
#20 18.93 	from /usr/local/lib/ruby/2.7.0/irb.rb:538:in `block in eval_input'
#20 18.93 	from /usr/local/lib/ruby/2.7.0/irb/ruby-lex.rb:166:in `block (2 levels) in each_top_level_statement'
#20 18.93 	from /usr/local/lib/ruby/2.7.0/irb/ruby-lex.rb:151:in `loop'
#20 18.93 	from /usr/local/lib/ruby/2.7.0/irb/ruby-lex.rb:151:in `block in each_top_level_statement'
#20 18.93 	from /usr/local/lib/ruby/2.7.0/irb/ruby-lex.rb:150:in `catch'
#20 18.93 	from /usr/local/lib/ruby/2.7.0/irb/ruby-lex.rb:150:in `each_top_level_statement'
#20 18.93 	from /usr/local/lib/ruby/2.7.0/irb.rb:537:in `eval_input'
#20 18.93 	from /usr/local/lib/ruby/2.7.0/irb.rb:472:in `block in run'
#20 18.93 	from /usr/local/lib/ruby/2.7.0/irb.rb:471:in `catch'
#20 18.93 	from /usr/local/lib/ruby/2.7.0/irb.rb:471:in `run'
#20 18.93 	from /usr/local/lib/ruby/2.7.0/irb.rb:400:in `start'
#20 18.93 Maybe IRB bug!
#20 18.93 u.add_role(:admin)
#20 18.93   Role Load (0.5ms)  SELECT  `roles`.* FROM `roles` WHERE `roles`.`name` = 'admin' AND `roles`.`resource_type` IS NULL AND `roles`.`resource_id` IS NULL ORDER BY `roles`.`id` ASC LIMIT 1
#20 18.94    (0.3ms)  BEGIN
#20 18.94   Role Create (0.4ms)  INSERT INTO `roles` (`name`, `created_at`, `updated_at`) VALUES ('admin', '2021-10-20 20:22:06', '2021-10-20 20:22:06')
#20 18.94 [ActionCable] Broadcasting to api:roles_create: {:event_type=>"create", :event_class=>"Role", :object=>{"id"=>1, "name"=>"admin", "resource_type"=>nil, "resource_id"=>nil, "created_at"=>Wed, 20 Oct 2021 20:22:06 UTC +00:00, "updated_at"=>Wed, 20 Oct 2021 20:22:06 UTC +00:00}}
#20 18.94    (0.7ms)  COMMIT
#20 18.96   Role Exists (0.7ms)  SELECT  1 AS one FROM `roles` INNER JOIN `users_roles` ON `roles`.`id` = `users_roles`.`role_id` WHERE `users_roles`.`user_id` = 1 AND `roles`.`id` = 1 LIMIT 1
#20 18.97   Role Exists (0.4ms)  SELECT  1 AS one FROM `roles` INNER JOIN `users_roles` ON `roles`.`id` = `users_roles`.`role_id` WHERE `users_roles`.`user_id` = 1 AND `roles`.`id` = 1 LIMIT 1
#20 18.97    (0.2ms)  BEGIN
#20 18.98   User::HABTM_Roles Create (0.4ms)  INSERT INTO `users_roles` (`user_id`, `role_id`) VALUES (1, 1)
#20 18.98    (0.6ms)  COMMIT
#20 18.98 #<Role id: 1, name: "admin", resource_type: nil, resource_id: nil, created_at: "2021-10-20 20:22:06", updated_at: "2021-10-20 20:22:06">
#20 18.98 u.add_role(:developer)
#20 18.98   Role Load (0.4ms)  SELECT  `roles`.* FROM `roles` WHERE `roles`.`name` = 'developer' AND `roles`.`resource_type` IS NULL AND `roles`.`resource_id` IS NULL ORDER BY `roles`.`id` ASC LIMIT 1
#20 18.98    (0.2ms)  BEGIN
#20 18.98   Role Create (0.3ms)  INSERT INTO `roles` (`name`, `created_at`, `updated_at`) VALUES ('developer', '2021-10-20 20:22:06', '2021-10-20 20:22:06')
#20 18.98 [ActionCable] Broadcasting to api:roles_create: {:event_type=>"create", :event_class=>"Role", :object=>{"id"=>2, "name"=>"developer", "resource_type"=>nil, "resource_id"=>nil, "created_at"=>Wed, 20 Oct 2021 20:22:06 UTC +00:00, "updated_at"=>Wed, 20 Oct 2021 20:22:06 UTC +00:00}}
#20 18.98    (0.6ms)  COMMIT
#20 18.98   Role Exists (0.4ms)  SELECT  1 AS one FROM `roles` INNER JOIN `users_roles` ON `roles`.`id` = `users_roles`.`role_id` WHERE `users_roles`.`user_id` = 1 AND `roles`.`id` = 2 LIMIT 1
#20 18.99   Role Exists (0.7ms)  SELECT  1 AS one FROM `roles` INNER JOIN `users_roles` ON `roles`.`id` = `users_roles`.`role_id` WHERE `users_roles`.`user_id` = 1 AND `roles`.`id` = 2 LIMIT 1
#20 18.99    (0.3ms)  BEGIN
#20 18.99   User::HABTM_Roles Create (0.3ms)  INSERT INTO `users_roles` (`user_id`, `role_id`) VALUES (1, 2)
#20 18.99    (0.5ms)  COMMIT
#20 18.99 #<Role id: 2, name: "developer", resource_type: nil, resource_id: nil, created_at: "2021-10-20 20:22:06", updated_at: "2021-10-20 20:22:06">
#20 18.99 SiteSetting.create(name: 'registration_enabled', value: 1)
#20 18.99    (0.3ms)  BEGIN
#20 19.00   SiteSetting Exists (0.4ms)  SELECT  1 AS one FROM `site_settings` WHERE `site_settings`.`name` = BINARY 'registration_enabled' LIMIT 1
#20 19.00   SiteSetting Create (0.3ms)  INSERT INTO `site_settings` (`name`, `value`, `created_at`, `updated_at`) VALUES ('registration_enabled', '1', '2021-10-20 20:22:06', '2021-10-20 20:22:06')
#20 19.00    (0.6ms)  COMMIT
#20 19.00 #<SiteSetting id: 1, name: "registration_enabled", value: "1", value_type: nil, created_at: "2021-10-20 20:22:06", updated_at: "2021-10-20 20:22:06">

@tripleee
Copy link
Author

... As well as these.

#22 [18/18] RUN yarn install
#22 sha256:72b942afd84bc5695a40915bfe289749373252792b2c063eb3b29ca3f1600fa4
#22 0.830 yarn install v1.22.10
#22 1.130 [1/4] Resolving packages...
#22 1.779 [2/4] Fetching packages...
#22 18.91 info [email protected]: The platform "linux" is incompatible with this module.
#22 18.91 info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
#22 18.91 info [email protected]: The platform "linux" is incompatible with this module.
#22 18.91 info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
#22 18.93 [3/4] Linking dependencies...
#22 18.93 warning " > [email protected]" has unmet peer dependency "bootstrap@>=3.0.0".
#22 18.94 warning " > [email protected]" has unmet peer dependency "node-sass@^4.0.0".
#22 18.94 warning " > [email protected]" has incorrect peer dependency "[email protected]".
#22 26.71 [4/4] Building fresh packages...
#22 28.07 Done in 27.27s.

@tripleee
Copy link
Author

Hmm, I was able to log in and play around with it for a while but then it froze. Maybe I touched something I shouldn't have?

The last things I can see on the console are

205:M 20 Oct 2021 21:06:05.211 * 100 changes in 300 seconds. Saving...
205:M 20 Oct 2021 21:06:05.212 * Background saving started by pid 351
351:C 20 Oct 2021 21:06:05.218 * DB saved on disk
351:C 20 Oct 2021 21:06:05.219 * Fork CoW for RDB: current 0 MB, peak 0 MB, average 0 MB
205:M 20 Oct 2021 21:06:05.314 * Background saving terminated with success

@tripleee
Copy link
Author

It happened again, this time without anything interesting on the console. The site icon in the browser tab is replaced with a spinner, I can still click open menus but attempting to select something in them or otherwise clicking on anything doesn't navigate away from the page where I was when it happened. But it looks like there are probably just a few routes which trigger this. For example, just now, it clearly happened when I clicked http://localhost:5000/dev/request-log/user/1 and I think the earlier occurrences were also related to clicking on dev stuff related to logging or dumps.

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