We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

502 Error when get models data (ubuntu 14.04,nginx,php-fpm)

2015/04/24 20:06:24 [error] 12488#0: *6 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 127.0.0.1, server: namivam, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "namivam"

This error throw when i trying execute any model "find" or "findFirst" method. And it is not permanent behavior, 2 times is ok, 2 times is 502 error. How improve it? I tried reinstall php5-fpm, phalcon (from repository and directly,by making of source),disable opcache,xdebug, but it has no effect. On 1.3.4 version i hadn't such problem.

I am using mariaDb instead mysql, maybe it cause problem?

If I can provide any info - let me know. Thanks.



2.5k
edited Apr '15

I have exactly the same problem with phalcon2 and postgresql. When pressing F5, 2 requests ok, 2 requests 502. I spent lot of time on this bug and found out that it's somehow related to Dialect (maybe in \Phalcon\Db\Dialect method select or getSqlTable). Whenever I try to extend the built-in dialect class the bug shows up.

$di->setShared('db', function () use ($config) {

    $conn = new Phalcon\Db\Adapter\Pdo\Postgresql([
        'host'     => $config->database->host,
        'username' => $config->database->username,
        'password' => $config->database->password,
        'dbname'   => $config->database->dbname,
    ]);

    $conn->setDialect(new CustomDialect()); // without this line, no error!!

    return $conn;
});
<?php

class CustomDialect extends \Phalcon\Db\Dialect\Postgresql
{
    // no code needed here to demonstrate the bug
}

My config is:

  • Ubuntu 14.04.2 LTS
  • Nginx 1.4.7
  • PHP 5.5.9
  • Postgresql 9.3.6

I dont use any custom dialect

$di -> set('db', function () use ($config) {
    return new DbAdapter(array (
        'host'     => $config -> database -> host,
        'username' => $config -> database -> username,
        'password' => $config -> database -> password,
        'dbname'   => $config -> database -> dbname,
        "charset"  => $config -> database -> charset
    ));
}, true);


2.5k

Hmmm, then it's more interesting... I'm trying to trace this bug since weeks with no luck.

One important note:

When I compile Phalcon with cphalcon/ext/install-test this bug disappears.

edited Apr '15

Hmmm, then it's more interesting... I'm trying to trace this bug since weeks with no luck.

One important note:

When I compile Phalcon with cphalcon/ext/install-test this bug disappears.

How can i try it? It is command-line flag?



2.5k
edited Apr '15

Phalcon can be installed 2 ways (normal and test)

See: https://forum.phalcon.io/discussion/2936/phalcon2-filesize-200mb-on-64-bit#C9777

With normal install this bug exist, with install-test it's ok.

@phalcon @andresgutierrez any idea?



98.9k
edited May '15

This must be fixed now in master

edited May '15

This must be fixed now in master

i tried install from ppa 5 minutes ago, no profit. Should i build from sources?



98.9k

Could you please post this as an issue on Github alongside with a script that allow us to reproduce the issue?

This must be fixed now in master

i tried install 5 minutes ago, no profit.

edited May '15

Surely, You need php sources only, or sth else?

Everything necessary to reproduce the issue, if you want to set up a Github repo, that's fine too