Sporadically getting 500s when creating a post


(Dan Friedman) #1

On my Azure test server, this happens infrequently, but I see it every so often. I would expect to never see it.


(Michael Brown) #2

Are there any hints in the production.log file as to the nature of the errors?

If you could find an error in the logfile and post a snippet from around the error, that would be helpful.


(Dan Friedman) #3

Sorry for the delay. They both appear to be due to uniqueness constraint violations. This happened in 0.9.3.0.

Started POST "/posts" for 207.108.200.122 at 2013-09-27 17:19:49 +0000
Processing by PostsController#create as */*
  Parameters: {"raw"=>"Roar Roar Roar Roar Roar Roar ", "reply_to_post_number"=>"", "archetype"=>"regular", "title"=>"I got the eye of the tiger"}
Completed 500 Internal Server Error in 31ms

ActiveRecord::RecordNotUnique (PG::Error: ERROR:  duplicate key value violates unique constraint "forum_threads_pkey"
DETAIL:  Key (id)=(1) already exists.
: INSERT INTO "topics" ("archetype", "archived", "auto_close_at", "auto_close_started_at", "auto_close_user_id", "avg_time", "bookmark_count", "bumped_at", "category_id", "closed", "created_at", "deleted_at", "deleted_by_id", "featured_$
  lib/topic_creator.rb:71:in `save_topic'
  lib/topic_creator.rb:22:in `create'
  lib/post_creator.rb:159:in `setup_topic'
  lib/post_creator.rb:61:in `block in create'
  lib/post_creator.rb:60:in `create'
  app/controllers/posts_controller.rb:35:in `block in create'
  lib/distributed_memoizer.rb:26:in `memoize'
  app/controllers/posts_controller.rb:33:in `create'
  config/initializers/quiet_logger.rb:10:in `call_with_quiet_assets'
  config/initializers/silence_logger.rb:19:in `call'
  config/initializers/99-rack-cache.rb:18:in `call'
Started POST "/posts" for 207.108.200.122 at 2013-09-27 17:31:18 +0000
Processing by PostsController#create as */*
  Parameters: {"raw"=>"Roar Roar Roar Roar Roar Roar so I sit quietly", "reply_to_post_number"=>"", "archetype"=>"regular", "title"=>"I got the eye of the tiger"}
Completed 500 Internal Server Error in 74ms

ActiveRecord::RecordNotUnique (PG::Error: ERROR:  duplicate key value violates unique constraint "posts_pkey"
DETAIL:  Key (id)=(1) already exists.
: INSERT INTO "posts" ("avg_time", "bookmark_count", "cached_version", "cooked", "created_at", "deleted_at", "deleted_by_id", "hidden", "hidden_reason_id", "illegal_count", "inappropriate_count", "incoming_link_count", "last_editor_id",$
  lib/post_creator.rb:207:in `save_post'
  lib/post_creator.rb:64:in `block in create'
  lib/post_creator.rb:60:in `create'
  app/controllers/posts_controller.rb:35:in `block in create'
  lib/distributed_memoizer.rb:26:in `memoize'
  app/controllers/posts_controller.rb:33:in `create'
  config/initializers/quiet_logger.rb:10:in `call_with_quiet_assets'
  config/initializers/silence_logger.rb:19:in `call'
  config/initializers/99-rack-cache.rb:18:in `call'

(Jacob) #4

You should update to the latest 0.9.6.4


(Dan Friedman) #5

I most definitely will. But this issue was found before that release and I didn’t see a commit for a fix, so I want to make sure that this issue has either been recorded or fixed.


(Jeff Atwood) #6