cmogstored dev/user discussion/issues/patches/etc
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [ANN] cmogstored 1.6.0 - a mogstored alternative
@ 2016-08-31 16:46  5% Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2016-08-31 16:46 UTC (permalink / raw)
  To: mogile, cmogstored-public

cmogstored is an alternative implementation of the "mogstored" storage
component of MogileFS.  cmogstored is implemented in C and does not use
Perl at runtime.  cmogstored is the only component you need to install
on a MogileFS storage node.

    cmogstored 1.6.0 - minor fixes on allocation errors

    There are minor robustness fixes on handling errors when
    allocating memory or spawn failures on otherwise-hosed systems.
    These bugfixes will not affect real users unless the system
    is already hosed or in badly overtaxed, so there's no real
    need to upgrade.

    There are minor portability improvements and I now test under
    FreeBSD 10.x.

    The iostat test cases are relaxed a bit to account for
    virtualized devices (as iostat is less useful with modern

    17 changes since 1.5.0 (Nov 2015):
          Rakefile: add missing <div> for Atom feed
          test/pwrite-wrap: remove unused variable and comment
          test/pwrite_wrap: squelch unnecessary output
          test/pwrite_wrap: reduce space overhead required
          update copyrights for 2016
          build-aux/txt2pre: drop CGI.pm requirement
          stdin is always redirected to /dev/null
          minor vfork/fork safety fixes
          process: try to handle OOM gracefully
          http_put: gracefully handle path allocation errors
          iostat_process: declare environ extern
          test/mgmt: relax checks for iostat mapping
          gnulib copyright update for 2016
          upgrade: avoid syslog call if execve fails
          rely on gnulib for environ portability
          INSTALL: update latest Debian stable version to 8.x
          README: stop mentioning cgit

http://bogomips.org/cmogstored/files/cmogstored-1.6.0.tar.gz
SHA-1: b35767444a9a993ee2c25c27192de7152a041682
SHA-256: f50d3449f3cdf8e6b67a77e42c6fc2055a7708090a52a7bebd601e3827e8a22f

* homepage: http://bogomips.org/cmogstored/README
* git clone git://bogomips.org/cmogstored.git
* git clone http://bogomips.org/cmogstored.git
* gitweb: http://repo.or.cz/w/cmogstored.git
* list: cmogstored-public@bogomips.org (subscription optional)
* archives: http://bogomips.org/cmogstored-public/
* nntp://news.public-inbox.org/inbox.comp.file-systems.mogilefs.cmogstored

^ permalink raw reply	[relevance 5%]

* [PATCH] process: try to handle OOM gracefully
@ 2016-06-01 22:32  7% Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2016-06-01 22:32 UTC (permalink / raw)
  To: cmogstored-public

If we fail to register a process, it is not fatal since
a process is already running.  However, we may not know
about when to restart it when it dies.
---
 cmogstored.c |  4 +++-
 process.c    | 26 ++++++++++++++++++--------
 2 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/cmogstored.c b/cmogstored.c
index 5625775..2e57def 100644
--- a/cmogstored.c
+++ b/cmogstored.c
@@ -476,9 +476,11 @@ static void process_died(pid_t pid, int status)
 	default:
 		/* could be an inherited iostat if we're using worker+master */
 		name = mog_process_name(id);
+		if (!name)
+			syslog(LOG_ERR, "OOM: %m");
 		syslog(LOG_INFO,
 		       "reaped %s pid=%d with status=%d, ignoring",
-		       name, (int)pid, status);
+		       name ? name : "unknown", (int)pid, status);
 		free(name);
 	}
 }
diff --git a/process.c b/process.c
index 3122e08..8dfa10a 100644
--- a/process.c
+++ b/process.c
@@ -49,16 +49,17 @@ void mog_process_reset(void)
 
 char *mog_process_name(unsigned id)
 {
+	char *s;
 	if (mog_process_is_worker(id))
-		return xasprintf("worker[%u]", id);
+		return asprintf(&s, "worker[%u]", id) >= 0 ? s : 0;
 
 	switch (id) {
-	case MOG_PROC_UNKNOWN: return xstrdup("unknown");
-	case MOG_PROC_IOSTAT: return xstrdup("iostat");
-	case MOG_PROC_UPGRADE: return xstrdup("upgrade");
+	case MOG_PROC_UNKNOWN: return 0;
+	case MOG_PROC_IOSTAT: return strdup("iostat");
+	case MOG_PROC_UPGRADE: return strdup("upgrade");
 	}
-	assert(0 && "Unknown ID");
-	return xasprintf("BUG[%u]", id);
+
+	return asprintf(&s, "BUG[%u]", id) >= 0 ? s : 0;
 }
 
 bool mog_process_is_worker(unsigned id)
@@ -114,15 +115,24 @@ size_t mog_kill_each_worker(int signo)
 /* Registers a process with a given id */
 void mog_process_register(pid_t pid, unsigned id)
 {
-	struct mog_process *p = xmalloc(sizeof(struct mog_process));
+	struct mog_process *p = malloc(sizeof(struct mog_process));
 
 	assert(id != MOG_PROC_UNKNOWN &&
 	      "MOG_PROC_UNKNOWN may not be registered");
 
+	if (!p)
+		goto err;
+
 	p->pid = pid;
 	p->id = id;
 
-	mog_oom_if_null(hash_insert(processes, p));
+	if (hash_insert(processes, p))
+		return; /* success */
+
+	PRESERVE_ERRNO(free(p));
+err:
+	syslog(LOG_ERR, "unable to register PID:%d with id=%u: %m",
+		(int)pid, id);
 }
 
 /*
-- 
EW


^ permalink raw reply related	[relevance 7%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2016-06-01 22:32  7% [PATCH] process: try to handle OOM gracefully Eric Wong
2016-08-31 16:46  5% [ANN] cmogstored 1.6.0 - a mogstored alternative Eric Wong

Code repositories for project(s) associated with this public inbox

	https://yhbt.net/cmogstored.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).