Project

General

Profile

Feature #11525

improve OPTION macro to add a check function for invalid options.

Added by Kefu Chai over 4 years ago. Updated over 4 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
common
Target version:
-
Start date:
05/04/2015
Due date:
% Done:

0%

Source:
other
Tags:
Backport:
Reviewed:
Affected Versions:
Pull request ID:

Description

see #11484, where user input a very large number for the journal_queue_max_bytes settings. this number overflows and ceph interprets it as a negative number which crashes ceph-osd.

and elder one proposed a way to prevent this from happening again.

I propose if any value in config file is out of range, Ceph could use default value for that and warn about that on startup.

and IMO, we should stop at seeing such an error, and report it to the user immediately, instead of swallowing it. if user tries to change a valid setting to an invalid one, we should reject it

maybe we should shutdown gracefully at seeing a bad config value when starting up, but reject it at runtime.

probably we can

  1. wire up a checker functor to an option when defining it using the OPTION macros
  2. run this functor (it throws on bad option) in md_config_t::set_val() before applying the new setting
  3. reject this setting, and prompt user
  4. stop the daemon if it is booting up

Related issues

Related to Ceph - Bug #11484: OPT_INT option interprets "3221225472" as -1073741824, and crashes in Throttle::Throttle() Resolved 04/27/2015

History

#1 Updated by Kefu Chai over 4 years ago

  • Subject changed from improve OPTION macro to add min,max check for an numeric option. to improve OPTION macro to add a check function for invalid options.

Also available in: Atom PDF