Skip to content

Commit

Permalink
[Disk Manager] add feature for disabling memory locking (currently we…
Browse files Browse the repository at this point in the history
… are facing crashes on start inside containers) (#1200)
  • Loading branch information
SvartMetal authored May 14, 2024
1 parent 1885db7 commit 64b9257
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,5 @@ message ServerConfig {
optional placementgroup.Config PlacementGroupConfig = 14;
optional dataplane.DataplaneConfig DataplaneConfig = 15;
optional performance.PerformanceConfig PerformanceConfig = 16;
optional bool LockProcessMemory = 17 [default = true];
}
16 changes: 10 additions & 6 deletions cloud/disk_manager/pkg/app/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
"github.com/ydb-platform/nbs/cloud/disk_manager/internal/pkg/util"
"github.com/ydb-platform/nbs/cloud/disk_manager/pkg/auth"
"github.com/ydb-platform/nbs/cloud/tasks"
"github.com/ydb-platform/nbs/cloud/tasks/errors"
"github.com/ydb-platform/nbs/cloud/tasks/logging"
"github.com/ydb-platform/nbs/cloud/tasks/persistence"
tasks_storage "github.com/ydb-platform/nbs/cloud/tasks/storage"
Expand Down Expand Up @@ -83,17 +82,22 @@ func run(
ctx = logging.SetLogger(ctx, logger)

logging.Info(ctx, "Locking process memory")
err := util.LockProcessMemory()
if err != nil {
logging.Error(ctx, "Failed to lock process memory: %v", err)
return err

if config.GetLockProcessMemory() {
err := util.LockProcessMemory()
if err != nil {
logging.Error(ctx, "Failed to lock process memory: %v", err)
return err
}
}

var err error

if len(hostname) == 0 {
hostname, err = os.Hostname()
if err != nil {
logging.Error(ctx, "Failed to get hostname from OS: %v", err)
return errors.NewNonRetriableError(err)
return err
}
}

Expand Down

0 comments on commit 64b9257

Please sign in to comment.