Trying to send any user a private message results in 500 error

(Paul Apostolos) #1

When trying to send a private message to an user returns a 500 error and the Log (thanks for that @sam) says

FloatDomainError (Infinity):
  lib/text_sentinel.rb:19:in `to_i'
  lib/text_sentinel.rb:19:in `body_sentinel'
  lib/validators/post_validator.rb:31:in `raw_quality'
  lib/validators/post_validator.rb:7:in `validate'
  lib/post_creator.rb:224:in `save_post'
  lib/post_creator.rb:60:in `block in create'
  lib/post_creator.rb:56:in `create'
  app/controllers/posts_controller.rb:36:in `block in create'
  lib/distributed_memoizer.rb:28:in `memoize'
  app/controllers/posts_controller.rb:34:in `create'
  lib/middleware/anonymous_cache.rb:119:in `call'
  config/initializers/quiet_logger.rb:10:in `call_with_quiet_assets'
  config/initializers/silence_logger.rb:24:in `call'
  lib/middleware/unicorn_oobgc.rb:95:in `process_client'

The title of the PM was “Testing out this private message” and the body was “I am adding a private message to test out that functionality”

Other users ran in to the same issue with longer body/title combinations.

min_post_length zero makes PM's crash
(Jens Maier) #2

Site settings min_private_message_post_length and min_post_length should not be zero…

TIL… Ruby does not raise a division by zero error when dividing by 0.0. :open_mouth:

Internal Server Error 500 when trying to send private message
(Paul Apostolos) #3

Boom! That was it.

The client (who is also an administrator) decided to make a bunch of site settings changes; including minimum post length.

She set them to 0. I set them back and it’s all working again.

(Jeff Atwood) #4

@neil we need to make sure some of the site settings validation prevents these problems before they happen. I guess put it on the list…

edit: validation is now in place

    client: true
    min: 1
      test: 5
      default: 20
    client: true
    min: 1
      test: 5
      default: 10

(Jeff Atwood) #5