Skip to content

Commit

Permalink
Show process name in all spawn error messages
Browse files Browse the repository at this point in the history
Refs #87, #629
  • Loading branch information
mnaberez committed Aug 18, 2015
1 parent cc218a1 commit 8569e3f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 20 deletions.
8 changes: 4 additions & 4 deletions supervisor/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,8 @@ def spawn(self):
# too many file descriptors open
msg = 'too many open files to spawn %r' % self.config.name
else:
msg = ('unknown error making dispatchers: %s' %
errno.errorcode.get(code, code))
msg = 'unknown error making dispatchers for %r: %s' % (
self.config.name, errno.errorcode.get(code, code))
self.record_spawnerr(msg)
self._assertInState(ProcessStates.STARTING)
self.change_state(ProcessStates.BACKOFF)
Expand All @@ -243,8 +243,8 @@ def spawn(self):
msg = ('Too many processes in process table to spawn %r' %
self.config.name)
else:
msg = ('unknown error during fork: %s' %
errno.errorcode.get(code, code))
msg = 'unknown error during fork for %r: %s' % (
self.config.name, errno.errorcode.get(code, code))
self.record_spawnerr(msg)
self._assertInState(ProcessStates.STARTING)
self.change_state(ProcessStates.BACKOFF)
Expand Down
28 changes: 12 additions & 16 deletions supervisor/tests/test_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,9 @@ def test_spawn_fail_make_pipes_other(self):
events.subscribe(events.ProcessStateEvent, lambda x: L.append(x))
result = instance.spawn()
self.assertEqual(result, None)
self.assertEqual(instance.spawnerr,
'unknown error making dispatchers: EPERM')
self.assertEqual(options.logger.data[0],
"spawnerr: unknown error making dispatchers: EPERM")
msg = "unknown error making dispatchers for 'good': EPERM"
self.assertEqual(instance.spawnerr, msg)
self.assertEqual(options.logger.data[0], "spawnerr: %s" % msg)
self.assertTrue(instance.delay)
self.assertTrue(instance.backoff)
from supervisor.states import ProcessStates
Expand All @@ -275,10 +274,9 @@ def raise_eisdir(envelope):
events.subscribe(events.ProcessStateEvent, lambda x: L.append(x))
result = instance.spawn()
self.assertEqual(result, None)
self.assertEqual(instance.spawnerr,
"unknown error making dispatchers: EISDIR")
self.assertEqual(options.logger.data[0],
"spawnerr: unknown error making dispatchers: EISDIR")
msg = "unknown error making dispatchers for 'cat': EISDIR"
self.assertEqual(instance.spawnerr, msg)
self.assertEqual(options.logger.data[0], "spawnerr: %s" % msg)
self.assertTrue(instance.delay)
self.assertTrue(instance.backoff)
from supervisor.states import ProcessStates
Expand All @@ -300,10 +298,9 @@ def test_spawn_fork_fail_eagain(self):
events.subscribe(events.ProcessStateEvent, lambda x: L.append(x))
result = instance.spawn()
self.assertEqual(result, None)
self.assertEqual(instance.spawnerr,
"Too many processes in process table to spawn 'good'")
self.assertEqual(options.logger.data[0],
"spawnerr: Too many processes in process table to spawn 'good'")
msg = "Too many processes in process table to spawn 'good'"
self.assertEqual(instance.spawnerr, msg)
self.assertEqual(options.logger.data[0], "spawnerr: %s" % msg)
self.assertEqual(len(options.parent_pipes_closed), 6)
self.assertEqual(len(options.child_pipes_closed), 6)
self.assertTrue(instance.delay)
Expand All @@ -327,10 +324,9 @@ def test_spawn_fork_fail_other(self):
events.subscribe(events.ProcessStateEvent, lambda x: L.append(x))
result = instance.spawn()
self.assertEqual(result, None)
self.assertEqual(instance.spawnerr,
'unknown error during fork: EPERM')
self.assertEqual(options.logger.data[0],
"spawnerr: unknown error during fork: EPERM")
msg = "unknown error during fork for 'good': EPERM"
self.assertEqual(instance.spawnerr, msg)
self.assertEqual(options.logger.data[0], "spawnerr: %s" % msg)
self.assertEqual(len(options.parent_pipes_closed), 6)
self.assertEqual(len(options.child_pipes_closed), 6)
self.assertTrue(instance.delay)
Expand Down

0 comments on commit 8569e3f

Please sign in to comment.