phalcon/cphalcon · error · Phalcon\Queue\Exceptions\Exception

Connection timed out

Error message

Connection timed out

What it means

Raised in the Beanstalk connection read path when stream_get_meta_data() reports 'timed_out' on the socket after a read. The beanstalkd server accepted the connection but did not reply with a complete line (length + '\r\n') within the socket timeout, usually under server load or with an overly short timeout setting.

Solutions

  1. Increase the connection 'timeout' option when creating the BeanstalkConnection
  2. Retry the command; transient timeouts under load often succeed on retry
  3. Check beanstalkd server health/load (e.g. slow buried job processing)
  4. Investigate network latency or packet loss between app and server
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at phalcon/Queue/Adapter/Beanstalk/BeanstalkConnection.zep:222 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of phalcon/cphalcon@b7419de9cd (2026-08-21). Data as JSON: /api/errors/d83385f75a1802f9. Report an issue: GitHub.

Appendix: source

Thrown at phalcon/Queue/Adapter/Beanstalk/BeanstalkConnection.zep:222

    {
        var connection, data, meta;

        let connection = this->connection;

        if typeof connection != "resource" {
            let connection = this->connect();
        }

        if length {
            if feof(connection) {
                return false;
            }

            let data = rtrim(stream_get_line(connection, length + 2), "\r\n"),
                meta = stream_get_meta_data(connection);

            if meta["timed_out"] {
                throw new Exception("Connection timed out");
            }
        } else {
            let data = stream_get_line(connection, 16384, "\r\n");
        }

        if data === "UNKNOWN_COMMAND" {
            throw new Exception("UNKNOWN_COMMAND");
        }

        if data === "JOB_TOO_BIG" {
            throw new Exception("JOB_TOO_BIG");
        }

        if data === "BAD_FORMAT" {
            throw new Exception("BAD_FORMAT");
        }

        if data === "OUT_OF_MEMORY" {

View on GitHub (pinned to b7419de9cd)