pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #15459: no connection to the server
2+ messages / 2 participants
[nested] [flat]

* BUG #15459: no connection to the server
@ 2018-10-26 05:33  PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 1 reply; 2+ messages in thread

From: PG Bug reporting form @ 2018-10-26 05:33 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: jay.medivh@gmail.com

The following bug has been logged on the website:

Bug reference:      15459
Logged by:          medivhJay
Email address:      jay.medivh@gmail.com
PostgreSQL version: 9.6.8
Operating system:   debian
Description:        

Hello 

I used php7.1 + PDO connect to postgresql

when I use fork , like this 

<?php
$pid = pcntl_fork();
            if ( $pid === 1 ) {
                TaskManager::log('error');
            } elseif ( $pid ) {
                pcntl_wait($status);
            } else {
                try {
                    call_user_func_array($func, $argv);
                } catch ( \Exception $e ) {
                    TaskManager::log($e);
                }
                exit(0);
            }


PDO throw an exception

like this
[2018-10-26 13:12:02] PDOException: SQLSTATE[HY000]: General error: 7 no
connection to the server in

if I don't use pcntl_fork , nothing 

I don't know how to fix it , I need your help

Thank you!



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #15459: no connection to the server
@ 2018-10-26 14:08  Jeff Janes <jeff.janes@gmail.com>
  parent: PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Jeff Janes @ 2018-10-26 14:08 UTC (permalink / raw)
  To: jay.medivh@gmail.com; pgsql-bugs@lists.postgresql.org

On Fri, Oct 26, 2018 at 1:34 AM PG Bug reporting form <
noreply@postgresql.org> wrote:

> The following bug has been logged on the website:
>
> Bug reference:      15459
> Logged by:          medivhJay
> Email address:      jay.medivh@gmail.com
> PostgreSQL version: 9.6.8
> Operating system:   debian
> Description:
>
> Hello
>
> I used php7.1 + PDO connect to postgresql
>
> when I use fork , like this
>
> <?php
> $pid = pcntl_fork();
>             if ( $pid === 1 ) {
>                 TaskManager::log('error');
>             } elseif ( $pid ) {
>                 pcntl_wait($status);
>             } else {
>                 try {
>                     call_user_func_array($func, $argv);
>                 } catch ( \Exception $e ) {
>                     TaskManager::log($e);
>                 }
>                 exit(0);
>             }
>
>
> PDO throw an exception
>

You shouldn't have a database handle open over a fork call.  Open it after
the fork.  I have no idea how to do that, since it seems to be happening
implicitly, or at least in part of your code not shown.  You might want to
ask in a forum specific to php PDO.  Also, shouldn't you be testing $pid
against -1, not +1?

Cheers,

Jeff

^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2018-10-26 14:08 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-10-26 05:33 BUG #15459: no connection to the server PG Bug reporting form <noreply@postgresql.org>
2018-10-26 14:08 ` Jeff Janes <jeff.janes@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox