{"record":{"id":"a47c8f23fc81ac93","repo":"phalcon/cphalcon","slug":"object-passed-as-rolename-must-implement-phalcon-a","errorCode":null,"errorMessage":"Object passed as roleName must implement Phalcon\\Acl\\RoleAwareInterface or Phalcon\\Acl\\RoleInterface","messagePattern":"Object passed as roleName must implement Phalcon\\\\Acl\\\\RoleAwareInterface or Phalcon\\\\Acl\\\\RoleInterface","errorType":"exception","errorClass":"Phalcon\\Acl\\Exceptions\\InvalidRoleImplementation","httpStatus":null,"severity":"critical","filePath":"phalcon/Acl/Adapter/Memory.zep","lineNumber":1133,"sourceCode":"\n        return component;\n    }\n\n    /**\n     * Resolves a role identifier (object or string) to its name\n     */\n    private function toRoleName(var role)\n    {\n        if typeof role === \"object\" {\n            if role instanceof RoleAwareInterface {\n                return role->getRoleName();\n            }\n\n            if role instanceof RoleInterface {\n                return role->getName();\n            }\n\n            throw new InvalidRoleImplementation();\n        }\n\n        return role;\n    }\n}\n","sourceCodeStart":1115,"sourceCodeEnd":1139,"githubUrl":"https://github.com/phalcon/cphalcon/blob/b7419de9cd0a8a3f48441ead84c9f8415d463e25/phalcon/Acl/Adapter/Memory.zep#L1115-L1139","documentation":"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.","triggerScenarios":"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.","commonSituations":"Container memory limits (cgroups) hit by beanstalkd; OS-wide OOM pressure; undersized queue hosts in staging; memory leaks in old beanstalkd builds.","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."],"exampleFix":"// before\n$queue->put($body); // server replies OUT_OF_MEMORY\n\n// after\ntry {\n    $queue->put($body);\n} catch (\\Phalcon\\Queue\\Exceptions\\Exception $e) {\n    if ($e->getMessage() === 'OUT_OF_MEMORY') {\n        $alerts->page('beanstalkd OOM', $e->getMessage());\n        // fall back: persist locally and replay later\n    }\n}","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    $queue->put($body);\n} catch (\\Phalcon\\Queue\\Exceptions\\Exception $e) {\n    if ($e->getMessage() === 'OUT_OF_MEMORY') {\n        // server-side exhaustion: back off, retry once, alert on repeat\n        sleep(5);\n        $queue->put($body);\n        $alerts->page('beanstalkd OUT_OF_MEMORY', 'put retried after OOM');\n    } else {\n        throw $e;\n    }\n}","preventionTips":["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."],"tags":["queue","beanstalk","memory","server-error","capacity"],"backgroundTag":"server-out-of-memory","analyzedSha":"b7419de9cd0a8a3f48441ead84c9f8415d463e25","analyzedAt":"2026-08-21T06:21:18.811Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}