phalcon/cphalcon · critical · Phalcon\Acl\Exceptions\InvalidRoleImplementation
Object passed as roleName must implement Phalcon\Acl\RoleAwa
Error message
Object passed as roleName must implement Phalcon\Acl\RoleAwareInterface or Phalcon\Acl\RoleInterface
What it means
BeanstalkConnection maps beanstalkd's 'OUT_OF_MEMORY' reply to an exception: the server could not allocate memory to carry out the command (typically put). This is server-side resource exhaustion — the job may not have been stored, so treat the enqueue as failed.
Source
Thrown at phalcon/Acl/Adapter/Memory.zep:1133
return component;
}
/**
* Resolves a role identifier (object or string) to its name
*/
private function toRoleName(var role)
{
if typeof role === "object" {
if role instanceof RoleAwareInterface {
return role->getRoleName();
}
if role instanceof RoleInterface {
return role->getName();
}
throw new InvalidRoleImplementation();
}
return role;
}
}
View on GitHub (pinned to b7419de9cd)
Solutions
- Check memory on the queue host: free -m, container limits, ps -o rss= -C beanstalkd.
- Restart beanstalkd if it is wedged (drain or accept job loss; consider -b persistent binlog implications).
- Raise the host/container memory limit or reduce max-job-size (-z) so oversized jobs fail client-side first.
- Add monitoring/alerting on beanstalkd RSS and host memory to catch it before enqueue failures.
Example fix
// before
$queue->put($body); // server replies OUT_OF_MEMORY
// after
try {
$queue->put($body);
} catch (\Phalcon\Queue\Exceptions\Exception $e) {
if ($e->getMessage() === 'OUT_OF_MEMORY') {
$alerts->page('beanstalkd OOM', $e->getMessage());
// fall back: persist locally and replay later
}
} Defensive patterns
Strategy: retry
Try / catch
try {
$queue->put($body);
} catch (\Phalcon\Queue\Exceptions\Exception $e) {
if ($e->getMessage() === 'OUT_OF_MEMORY') {
// server-side exhaustion: back off, retry once, alert on repeat
sleep(5);
$queue->put($body);
$alerts->page('beanstalkd OUT_OF_MEMORY', 'put retried after OOM');
} else {
throw $e;
}
} Prevention
- Monitor beanstalkd RSS and host/container memory; alert before the OOM reply appears.
- Cap job size server-side (-z) and client-side so oversized jobs fail predictably.
- Keep a durable local spool so enqueues survive queue-server restarts.
When it happens
Trigger: put() against a beanstalkd process whose host/container is out of memory; very large job bodies repeatedly pressuring the allocator; binlog growth after long uptime.
Common situations: Container memory limits (cgroups) hit by beanstalkd; OS-wide OOM pressure; undersized queue hosts in staging; memory leaks in old beanstalkd builds.
Related errors
- Your passed parameter does not have the same class as the pa
- Access '{access}' does not exist in component '{componentNam
- {elementName} '{element}' does not exist in the {suffix}
- You did not provide all necessary parameters for the defined
- Object passed as componentName must implement Phalcon\Acl\Co
AI-assisted analysis of phalcon/cphalcon@b7419de9cd (2026-08-21).
Data as JSON: /api/errors/a47c8f23fc81ac93.
Report an issue: GitHub.