Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-11002

Insufficient permission will crash checkReadAhead()

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.5.3
    • Affects Version/s: None
    • Component/s: Logging
    • Labels:
    • Environment:
      Linux with Grsec / VM
    • Fully Compatible
    • Linux

      In https://github.com/mongodb/mongo/blob/master/src/mongo/db/db.cpp#L614
      the function checkReadAhead() introduced by Core/SERVER-7335
      https://jira.mongodb.org/browse/SERVER-7335
      uses boost::filesystem::exists() without checks for exceptions.

      An exception will be thrown if the path can't be accessed (due to insufficient access rights in my case). This will crash the startup.

      I gather that checking the readahead is informational only. It would be an improvement to just log the error and carry on.

      The attached patch will catch the filesystem exception and log a line of
      Wed Oct 2 13:52:40.434 [initandlisten] boost::filesystem::status: Permission denied: "/sys/dev/block/9:0/queue/read_ahead_kb"

      See here for the changes:
      https://github.com/zuckschwerdt/mongo/commit/f0b286380b4647ebd7a1e084b84309f12bc8e087

      And here for the complete patch with indentation
      https://github.com/zuckschwerdt/mongo/commit/581f3abe6b1faa2a65168c3044eb1e8f737c07b8

            Assignee:
            matt.kangas Matt Kangas
            Reporter:
            zany Christian Zuckschwerdt
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: