Re: [GENERAL] Perl script is killed by SIGPIPE

Поиск
Список
Период
Сортировка
От
Тема Re: [GENERAL] Perl script is killed by SIGPIPE
Дата
Msg-id 20170912114036.342E2B80@m0117567.ppops.net
обсуждение исходный текст
Ответ на [GENERAL] Perl script is killed by SIGPIPE  (Yogesh Sharma <yogeshraj95@gmail.com>)
Список pgsql-general
> Daniel Verite wrote:
> > Yogesh Sharma wrote:
> 
> > We have found child script is killed by signal 13 SIGPIPE. When 
> > duplicate key violates error occured, script is killed but not all time.
> 
> "child script" and this kind of error suggests that a forked process inherits a database connection opened by a
parentprocess.
 
> 
> When the database handle goes out of scope, it might close the connection to the database, affecting the parent
processtoo, since it's the same connection.
 
> 
> If you're using DBI, it has a setting to avoid that issue:
> https://metacpan.org/pod/DBI#InactiveDestroy
> 
> Aside from that, inherited connections can't be used simultaneously by parent and child process.
> In general, a child process should open and close its own connection.

In addition to Daniel's advice, be sure you have a try/catch around your DB work. If you've never used
something like that, check out Try::Tiny. Then in the catch, you can print $dbh->errstr() to see what's
really going on.

I think Daniel has it correct though that you may not have a valid $dbh, so this is an app error.

HTH,
Kevin


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

В списке pgsql-general по дате отправления:

Предыдущее
От: Francisco Olarte
Дата:
Сообщение: Re: [GENERAL] PostgreSQL COPY Statement Error On Linux
Следующее
От: Eric Hanson
Дата:
Сообщение: Re: [GENERAL] Aquameta 0.1 - Request for reviews, contributors