Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1a9whf-00025T-KZ for pgsql-bugs@arkaria.postgresql.org; Fri, 18 Dec 2015 15:12:19 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1a9whf-00043v-6r for pgsql-bugs@arkaria.postgresql.org; Fri, 18 Dec 2015 15:12:19 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1a9uue-0002Gd-Cj for pgsql-bugs@postgresql.org; Fri, 18 Dec 2015 13:17:36 +0000 Received: from mail-wm0-x233.google.com ([2a00:1450:400c:c09::233]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1a9uub-00049c-Hm for pgsql-bugs@postgresql.org; Fri, 18 Dec 2015 13:17:35 +0000 Received: by mail-wm0-x233.google.com with SMTP id l126so63866505wml.0 for ; Fri, 18 Dec 2015 05:17:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-type:content-transfer-encoding; bh=4miCQfEvnFyAbNTX23ASL5+GW0A6gqNdhp5kIjzuBlM=; b=rf4wl4YJJnYvLMPEAxU1FAfpila6OuYaV3Lr3ipewii+aJmjQw0EZkQzI1KCDo4dUz uVY4yBEqD7ckSYGXZV+0HhU/hUY03dcrkPvFLV3Lj2PQFQlFDG/DIe5n91+3ZoYcy2CM xf9YJHR44TwgCY17WjFxAlCq3J+fxMMSy0nFEBQP/jAB5g8SONOBvWjt93LJX3ULxlfu 3gAs6xGAGENftNnVDBWsbnA3bIGsAJPQDxU2xsH56lggINm7cDCaJrZz73GKIOLkz8k0 3Dxzd1oNJ3GKcC10W00gSEwSNPtTfRS4jNOpcMn1cmLB99l1d9SobGVI+OYaISPElzm1 L6Ug== X-Received: by 10.28.48.194 with SMTP id w185mr3250091wmw.73.1450444652426; Fri, 18 Dec 2015 05:17:32 -0800 (PST) Received: from [192.168.66.155] ([188.64.73.162]) by smtp.gmail.com with ESMTPSA id z3sm3716701wjx.38.2015.12.18.05.17.31 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 18 Dec 2015 05:17:31 -0800 (PST) Subject: Re: BUG #13823: Database crash - import requests in plpython3u To: Terje Elde References: <20151217133409.3886.97313@wrigleys.postgresql.org> <01D7F600-660B-44AE-86CC-F56BD563DD2F@elde.net> Cc: pgsql-bugs@postgresql.org From: George Wesington Message-ID: <56740764.3050904@gmail.com> Date: Fri, 18 Dec 2015 14:17:24 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <01D7F600-660B-44AE-86CC-F56BD563DD2F@elde.net> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Hi Terje, Thank you for your reply! The information i submitted was while running the function as postgres user (database owner). I can run simple python scripts and I can also import some other modules without crashing (logging, sys, string, subprocess...) Python was installed from the executable installer downloaded from the official pages, same goes for postgres (from edb). Requests were acquired with pip ( 'pip install requests'). The requests module does not even have to be used in the code, as soon as the "import requests" statement is written in any script, the database crashes. Python 2 is not connected to postgres as I was actually not able to do it. I noticed that in distribution I downloaded there is no plpython2 dll to connect postgres with it? Is there another way to do it? Best, George On 18/12/2015 06:59, Terje Elde wrote: > >> On 17 Dec 2015, at 14:34, george.wesington@gmail.com wrote: >> >> After the crash the database needs to be restarted because it cannot be >> accessed anymore. The same script runs perfectly when run directly from >> python. >> >> Let me know if you need any more information. > Could you try to run it as the PostgreSQL user, but outside PostgreSQL? > > Also, please double check that it's run as Python 3 when testing that. The code looks fairly compatible between 2.7 and 3.x, and my best initial guess would be that Python crashes on a missing or faulty import. > > Can you successfully run a simpler Python function from PostgreSQL? (One that doesn't import anything). Easy way to narrow down if it's likely the requests-module in Python, or if it's related to plpython. > > Oh, and how did you install Python, PostgreSQL, plpython and the requests module? > > Terje > -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs