phalcon/cphalcon · error · Phalcon\Queue\Exceptions\Exception
Can't connect to the Beanstalk server
Error message
Can't connect to the Beanstalk server
What it means
BeanstalkConnection::connect() failed to open a TCP socket to the configured Beanstalk host/port: fsockopen (or pfsockopen for persistent connections) returned a non-resource. Typical causes are the beanstalkd daemon not running, wrong host/port, DNS failure, or firewall blocking the connection. The PHP warning is deliberately suppressed and the failure surfaced as this exception instead.
Solutions
- Verify beanstalkd is running and reachable: `telnet <host> <port>` or `nc -zv <host> <port>`
- Check the 'host' and 'port' connection options for typos
- Check firewall/network rules between the app and the beanstalkd server
- If using persistent connections, also verify allowed persistent socket limits
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at phalcon/Queue/Adapter/Beanstalk/BeanstalkConnection.zep:111 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of phalcon/cphalcon@b7419de9cd (2026-08-21).
Data as JSON: /api/errors/f44890aabbb0aeea.
Report an issue: GitHub.
Appendix: source
Thrown at phalcon/Queue/Adapter/Beanstalk/BeanstalkConnection.zep:111
}
/**
* Suppress the connection warning; the failure is handled by the
* typeof check below. Zephir has no `@` operator, so error reporting
* is toggled around the call instead.
*/
let errorLevel = error_reporting(0);
if this->persistent {
let connection = pfsockopen(this->host, this->port, null, null);
} else {
let connection = fsockopen(this->host, this->port, null, null);
}
error_reporting(errorLevel);
if typeof connection != "resource" {
throw new Exception("Can't connect to the Beanstalk server");
}
stream_set_timeout(connection, -1, 0);
let this->connection = connection;
this->restoreSession();
return connection;
}
/**
* Removes a job from the server entirely.
*/
public function deleteJob(string id) -> bool
{
this->write("delete " . id);
View on GitHub (pinned to b7419de9cd)