From bd539adf20e704d14ab728192bb9278a2f551767 Mon Sep 17 00:00:00 2001 From: vinhjaxt Date: Sun, 13 Aug 2023 23:20:36 +0700 Subject: [PATCH] Fix the issue of full cpus/ram when handling corrupted org (#2886) When the disk was full, some strange things happened. Some files are created but the files are empty. In my case, my disk was full, so an organization's .json.db file was created with zero length content, causing a loop of the startOrg call. This commit will fix that problem by checking if the organization's .json.db file is corrupted. --- services/orgs/orgs.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/orgs/orgs.go b/services/orgs/orgs.go index 9a47b7115a8..9afc3db79bd 100644 --- a/services/orgs/orgs.go +++ b/services/orgs/orgs.go @@ -227,6 +227,12 @@ func (self *OrgManager) Scan() error { delete(existing, org_id) + if org_record.Id == "" || org_record.Nonce == "" { + logger := logging.GetLogger(self.config_obj, &logging.FrontendComponent) + logger.Info("Org is corrupted %v", org_id) + continue + } + _, err = self.GetOrgConfig(org_id) if err != nil { err = self.startOrg(org_record)