Re: Problem with pl/python procedure connecting to the internet

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Igor Sosa Mayor <joseleopoldo1792(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Problem with pl/python procedure connecting to the internet
Date: 2015-08-25 13:01:16
Message-ID: 55DC671C.9090908@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 08/25/2015 01:30 AM, Igor Sosa Mayor wrote:
> Igor Sosa Mayor <joseleopoldo1792(at)gmail(dot)com> writes:
>
>> Igor Sosa Mayor <joseleopoldo1792(at)gmail(dot)com> writes:
>>
>>> My question is therefore:
>>> 1. is there a way to permit the pl/python to connect to the internet all
>>> the time and with a better configuration?
>>> 2. or should I forget the procedure and write a python script outside
>>> the database?
>
> I'm again with the last update. The problem seems to be that for some
> reason PG does not realize that there is a network connection.
>
> More precisely:
> 1. I start the computer
> 2. PG starts and I can use it normally, EXCEPT from the plpython
> procedure which does not connect

At this point can you connect to the Postgres server on your laptop from
another machine?

> 3. then I restart PG (with systemd) and it works. PG seems to "see" that
> there is a connection.

Best guess, since this is a laptop, the network is not connected until
NetworkManager(or something similar) is active. On my laptop that
happens late in the startup sequence, after Postgres starts. This is
especially true if you are connecting to a wireless AP.

>
> Maybe it has something to do with systemd? I'm trying to get all debug
> information, but I can't see anything strange in the log. In order not
> to full the list with an attachment, I post the log here:
> http://pastie.org/10373991

FYI, include the time in your log prefix, it gives some idea of how far
apart the events are happening. Also logging NOTICE and above is a good
place to start. DEBUG buries you in mass of detail which may or may not
be relevant.

>
> Any ideas?
>
> Thanks in advance!
>
>
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Neil Tiffin 2015-08-25 13:19:30 Re: PostgreSQL Developer Best Practices
Previous Message Gavin Flower 2015-08-25 10:09:44 Re: PostgreSQL Developer Best Practices