From: Pavan Kumar <pavan@netcore.co.in>
To: Dave Cramer <pg@fastcrypt.com>
Cc: Oliver Jowett <oliver@opencloud.com>
Cc: João Paulo Ribeiro <jp@mobicomp.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: thread hang on execute call
Date: Fri, 07 Apr 2006 10:37:18 +0530
Message-ID: <1144386438.17761.30.camel@pavan.psmw> (raw)
In-Reply-To: <8E73BF65-87AA-4DCA-8FF2-1170101928DE@fastcrypt.com>
References: <1144141469.16392.18.camel@pavan.psmw>
<13631ECC-A37D-4A7E-A730-6CE9670724A4@fastcrypt.com>
<18448.1144158004@sss.pgh.pa.us>
<1144323083.26830.53.camel@pavan.psmw>
<44350696.6030506@mobicomp.com>
<44353BD2.7060108@opencloud.com>
<2E5000CC-3E4B-4EC5-B26C-2A6CB989971E@fastcrypt.com>
<4435842C.3000909@opencloud.com>
<8E73BF65-87AA-4DCA-8FF2-1170101928DE@fastcrypt.com>
hi
i sending procedure as attachments that is called by java program.
please get it from attachments.
i creates 15 worker threads and there is queue for job.
worker threads get job from queue if it there and do some db operation.
and wait if there is no job in queue. there is another thread that push
job in queue.
since whole processing takes time.....so worker threads always find job
in queue.
so they run nonstop and make db call to this procedure.
after around 2 days all threads get stuck one bye one.
then there is no response from either side.
worker thread also do some memory intensive operation at their side.
it could be that threads are running low on memory so then might not be
able to respond postgres process. but jvm doesn't show out of memory.
and both end are waiting on recv call.
please tell me if you need more info or the way i should try to help you
people to diagnose problem.
Following two line or from logs
LOG: unexpected EOF on client connection
LOG: could not receive data from client: Connection reset by peer
well i am not sure when this loggin happened. either after when i killed
java process or before it.
thanks a lot for your nice help.
On Thu, 2006-04-06 at 18:35 -0400, Dave Cramer wrote:
> You're correct it's a guess at this point predicated on the
> assumption that it works for many others without this flaw.
> On 6-Apr-06, at 5:12 PM, Oliver Jowett wrote:
>
> > Dave Cramer wrote:
> >> This is most certainly a threading issue. The question is now
> >> whether it is in the driver or outside the driver.
> >
> > Huh? What made you conclude it was definitely a threading issue?
> >
> > -O
> >
> > ---------------------------(end of
> > broadcast)---------------------------
> > TIP 5: don't forget to increase your free space map settings
> >
>
------------------------------------------------------------------------
Netcore Solutions Pvt. Ltd.
Website: http://www.netcore.co.in
Spamtraps: http://cleanmail.netcore.co.in/directory.html
Support FAQ : http://support.netcore.co.in/
This e-mail contains confidential and/or privileged information. If
you are not the intended recipient (or have received this e-mail in
error) please notify the sender immediately and delete this e-mail. Any
unauthorized copying, disclosure, use or distribution of the material in
this e-mail is strictly forbidden.
------------------------------------------------------------------------
Attachments:sp_addupdateitem.sql (text/x-sql, 4.0K) download
CREATE OR REPLACE FUNCTION addupdateitems(items varchar[][],
feed_resource_id integer,
feed1_title varchar,
feed1_url varchar,
feed_description varchar,
feed_published_date timestamp,
feed_encoding varchar,
feed_version varchar) RETURNS INTEGER[] AS $$
declare
i integer=1;
-- CAUTION: itemid might overflow (after an insane amount of time.. )
action integer[];
resid integer;
itemid integer;
--action integer;
--hash_code integer;
--new_hash_code integer;
publishdate timestamp;
lastupdatedate timestamp;
lastupdated timestamp;
new_title varchar;
new_description varchar;
feedurl varchar;
feedtitle varchar;
feeddescription varchar;
new_author varchar;
result varchar[];
begin
--feedurl = decode(items[i][8],'base64');
feedurl = replace(feed1_url,'"','"');
--feedtitle = decode(items[i][9],'base64');
feedtitle = replace(feed1_title,'"','"');
feeddescription = replace(feed_description,'"','"');
IF NOT isUrlExist(feedurl) THEN
BEGIN
--raise notice '%',feed_resource_id;
insert into feed (resource_id,title,url,description,publish_date,encoding,rss_version)
values (feed_resource_id,feedtitle,feedurl,feed_description,feed_published_date,feed_encoding,feed_version);
--addfeed(resource_id,feed_title,feed_url,feed_description,feed_publish_date,feed_last_update_date);
EXCEPTION
WHEN unique_violation THEN
RAISE EXCEPTION 'Unique key violation for resid % and url %' , feed_resource_id, feedurl;
--result[i] = 'unique_violation';
WHEN not_null_violation THEN
--result[i] = 'not_null_violation';
WHEN restrict_violation THEN
--result[i] = 'restrict_violation';
WHEN check_violation THEN
--result[i] = 'check_violation';
END;
END IF;
--raise notice '%',items[i][1];
WHILE NOT items[i][1] IS NULL LOOP
BEGIN
resid = feed_resource_id;--items[i][1];
--new_hash_code = items[i][10];
publishdate = items[i][4];
lastupdatedate = items[i][6];
--new_title = decode(items[i][2],'base64');
new_title = replace(items[i][1],'"','"');
--new_description = decode(items[i][4],'base64');
new_description = replace(items[i][3],'"','"');
new_author = replace(items[i][5],'"','"');
EXCEPTION
WHEN syntax_error THEN
result[i] = 'Error In data Assignment';
END;
BEGIN
SELECT INTO itemid,lastupdated
item_id,last_update_date
FROM feeditem
WHERE url = items[i][2] AND title = new_title;
IF NOT FOUND THEN
action[i] := -1;
raise notice 'inserting item for url %',items[i][2];
insert into feeditem values (nextval('feeditem_item_id_seq'),
resid,
new_title,
items[i][2],
new_description,
publishdate,
new_author,
lastupdatedate);
--feedurl,
--feedtitle);
i=i+1;
CONTINUE;
END IF;
IF NOT lastupdatedate IS NULL AND lastupdatedate > lastupdated THEN
raise notice 'updating item for item id %',itemid;
action[i] := itemid;
update feeditem set resource_id = resid ,
title = new_title ,
url = items[i][2] ,
description = new_description ,
publish_date = publishdate ,
author = new_author,
last_update_date = lastupdatedate
--feed_url = feedurl ,
--feed_title = feedtitle
where item_id = itemid ;
i=i+1;
CONTINUE;
END IF;
action[i] := 0;
i=i+1;
raise notice 'nothing';
EXCEPTION
WHEN unique_violation THEN
result[i] = 'unique_violation';
WHEN not_null_violation THEN
result[i] = 'not_null_violation';
WHEN restrict_violation THEN
result[i] = 'restrict_violation';
WHEN check_violation THEN
result[i] = 'check_violation';
END;
END LOOP;
return action;
END;
$$
LANGUAGE 'plpgsql' VOLATILE;
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: pavan@netcore.co.in, pg@fastcrypt.com, oliver@opencloud.com, jp@mobicomp.com
Subject: Re: thread hang on execute call
In-Reply-To: <1144386438.17761.30.camel@pavan.psmw>
References: <1144141469.16392.18.camel@pavan.psmw> <13631ECC-A37D-4A7E-A730-6CE9670724A4@fastcrypt.com> <18448.1144158004@sss.pgh.pa.us> <1144323083.26830.53.camel@pavan.psmw> <44350696.6030506@mobicomp.com> <44353BD2.7060108@opencloud.com> <2E5000CC-3E4B-4EC5-B26C-2A6CB989971E@fastcrypt.com> <4435842C.3000909@opencloud.com> <8E73BF65-87AA-4DCA-8FF2-1170101928DE@fastcrypt.com> <1144386438.17761.30.camel@pavan.psmw>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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