Thread: hangs while getting large objects...

hangs while getting large objects...

From
"chris markiewicz"
Date:
hello.  i occasionally have problems getting large objects from postgres.  i
am confident that this problem is a problem with my code and not postgres
because i cannot find similar complaints and no one responded to my question
from earlier this month (appears later in this email).

I have a screen that loads several LOs (small images, mostly).  Occasionally
the process hangs on the rs.getBytes() line.  Does anyone know what could be
causing this?

Separately, I have written a simple program that queries the table with the
LOs.  No problems - unless I run it while my application is hanging (then
the simple program hangs indefinitely as well).  I am able to run queries
from the command line while this is going on, so it seems like the byte
stream is plugging things up, but everything else is fine.

Does anyone have any ideas what the problem could be?  Everything works
perfectly 90% of the time, but 90% isn't that good.  At this point, I'm not
even sure what to try.  Are there any Postgres configuration changes I could
make?  Would Postgres logging tell me anything.

I greatly appreciate your help.  note - i'm running 7.0.3 on
linux...connecting through jdbc.

chris



-----Original Message-----
From: pgsql-jdbc-owner@postgresql.org
[mailto:pgsql-jdbc-owner@postgresql.org]On Behalf Of chris markiewicz
Sent: Thursday, August 02, 2001 6:04 PM
To: cmarkiew@commnav.com; pgsql-jdbc@postgresql.org
Subject: [JDBC] errors while getting large objects...


hello.

my application uses large objects frequently...to render the main page, it
might load anywhere from zero to 10 large objects - mostly images or
documents.  recently i started stress testing this page (making it always
load many LOs) and i frequently encounter two different problems.

1. fastpath - autocommit is always false...i've verified this several times.
my current workaround is to catch the fastpath error and resubmit the
query...usually works on the second pass and rarely makes it to 4 passes
(the current limit i have set).  i have included a stack trace at the bottom
of this message.  does anyone have any ideas on this?  i'm using 7.0.2 with
the 7.0-1.2 jdbc driver.  the occurences seem totally random...sometimes a
page loads perfectly, sometimes i get three fastpath errors...sometimes the
first load gets FP erros, sometimes the fifth page does.

2. hanging - i recently noticed that the processing sometimes (pretty
frequently) hangs on the line of code that grabs the LO from the db...i've
tried both:

byte[] bytes = rs.getBytes(columnName);
 and
InputStream is = rs.getBinaryStream(columnName);

Same result for both.  It hangs indefinitely.  Similar to the fastpath -
sometimes it happens, sometimes it doesn't...but it always happens within 5
screen loads of my stress test page.

does anyone know if these problems were fixed in recent versions of
postgresql?  is anyone having similar problems?  i greatly appreciate any
help!

thanks
chris






FastPath call returned ERROR:  lo_tell: invalid large object descriptor (0)

    at org.postgresql.fastpath.Fastpath.fastpath(Fastpath.java:141)
    at org.postgresql.fastpath.Fastpath.fastpath(Fastpath.java:191)
    at org.postgresql.fastpath.Fastpath.getInteger(Fastpath.java:203)
    at org.postgresql.largeobject.LargeObject.tell(LargeObject.java:232)
    at org.postgresql.largeobject.LargeObject.size(LargeObject.java:247)
    at org.postgresql.jdbc2.ResultSet.getBytes(ResultSet.java:370)
    at org.postgresql.jdbc2.ResultSet.getBinaryStream(ResultSet.java:514)
    at org.postgresql.jdbc2.ResultSet.getBinaryStream(ResultSet.java:616)
    at
com.commnav.sbh.framework.persist.JDBCEngine.loadResultSet(JDBCEngine.java:4
40)
    at com.commnav.sbh.framework.persist.JDBCEngine.load(JDBCEngine.java:284)
    at
com.commnav.sbh.framework.persist.PersistenceObject.load(PersistenceObject.j
ava:169)
    at
com.commnav.sbh.framework.documentmanager.SBHDocument.loadComplex(SBHDocumen
t.java:586)
    at
com.commnav.sbh.framework.persist.PersistenceObject.load(PersistenceObject.j
ava:208)
    at
com.commnav.sbh.applications.documentmanager.FavoriteDocumentIteratorTag.doS
tartTag(FavoriteDocumentIteratorTag.java:56)
    at
apps.favorited_00025cuments._0002fapps_0002ffavoritedocuments_0002ffavorited
ocumentspidget_0002ejspfavoritedocumentspidget_jsp_24._jspService(_0002fapps
_0002ffavoritedocuments_0002ffavoritedocumentspidget_0002ejspfavoritedocumen
tspidget_jsp_24.java:392)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:177)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
    at org.apache.tomcat.core.Handler.service(Handler.java:286)
    at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
    at
org.apache.tomcat.facade.RequestDispatcherImpl.include(RequestDispatcherImpl
.java:345)
    at
org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:414)
    at
_0002fdesktop_0002ejspdesktop_jsp_130._jspService(_0002fdesktop_0002ejspdesk
top_jsp_130.java:601)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:177)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
    at org.apache.tomcat.core.Handler.service(Handler.java:286)
    at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
    at
org.apache.tomcat.facade.RequestDispatcherImpl.forward(RequestDispatcherImpl
.java:194)
    at
com.commnav.sbh.framework.navigation.handlers.NavigationHandlerImpl.execute(
NavigationHandlerImpl.java:39)
    at
com.commnav.sbh.framework.navigation.Navigator.navigate(Navigator.java:80)
    at com.commnav.sbh.servlets.ControlServlet.doPost(ControlServlet.java:132)
    at com.commnav.sbh.servlets.ControlServlet.doGet(ControlServlet.java:63)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
    at org.apache.tomcat.core.Handler.service(Handler.java:286)
    at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
    at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79
7)
    at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
    at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:210)
    at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
    at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
    at java.lang.Thread.run(Thread.java:484)


---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org


RE: [JDBC] hangs while getting large objects...

From
"Dave Cramer"
Date:
Chris,

Try using the latest jar files from http://jdbc.fastcrypt.com

DAve

-----Original Message-----
From: pgsql-jdbc-owner@postgresql.org
[mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of chris markiewicz
Sent: August 15, 2001 3:04 PM
To: pgsql-jdbc@postgresql.org; pgsql-general@postgresql.org
Cc: chris.markiewicz@commnav.com
Subject: [JDBC] hangs while getting large objects...


hello.  i occasionally have problems getting large objects from
postgres.  i am confident that this problem is a problem with my code
and not postgres because i cannot find similar complaints and no one
responded to my question from earlier this month (appears later in this
email).

I have a screen that loads several LOs (small images, mostly).
Occasionally the process hangs on the rs.getBytes() line.  Does anyone
know what could be causing this?

Separately, I have written a simple program that queries the table with
the LOs.  No problems - unless I run it while my application is hanging
(then the simple program hangs indefinitely as well).  I am able to run
queries from the command line while this is going on, so it seems like
the byte stream is plugging things up, but everything else is fine.

Does anyone have any ideas what the problem could be?  Everything works
perfectly 90% of the time, but 90% isn't that good.  At this point, I'm
not even sure what to try.  Are there any Postgres configuration changes
I could make?  Would Postgres logging tell me anything.

I greatly appreciate your help.  note - i'm running 7.0.3 on
linux...connecting through jdbc.

chris



-----Original Message-----
From: pgsql-jdbc-owner@postgresql.org
[mailto:pgsql-jdbc-owner@postgresql.org]On Behalf Of chris markiewicz
Sent: Thursday, August 02, 2001 6:04 PM
To: cmarkiew@commnav.com; pgsql-jdbc@postgresql.org
Subject: [JDBC] errors while getting large objects...


hello.

my application uses large objects frequently...to render the main page,
it might load anywhere from zero to 10 large objects - mostly images or
documents.  recently i started stress testing this page (making it
always load many LOs) and i frequently encounter two different problems.

1. fastpath - autocommit is always false...i've verified this several
times. my current workaround is to catch the fastpath error and resubmit
the query...usually works on the second pass and rarely makes it to 4
passes (the current limit i have set).  i have included a stack trace at
the bottom of this message.  does anyone have any ideas on this?  i'm
using 7.0.2 with the 7.0-1.2 jdbc driver.  the occurences seem totally
random...sometimes a page loads perfectly, sometimes i get three
fastpath errors...sometimes the first load gets FP erros, sometimes the
fifth page does.

2. hanging - i recently noticed that the processing sometimes (pretty
frequently) hangs on the line of code that grabs the LO from the
db...i've tried both:

byte[] bytes = rs.getBytes(columnName);
 and
InputStream is = rs.getBinaryStream(columnName);

Same result for both.  It hangs indefinitely.  Similar to the fastpath -
sometimes it happens, sometimes it doesn't...but it always happens
within 5 screen loads of my stress test page.

does anyone know if these problems were fixed in recent versions of
postgresql?  is anyone having similar problems?  i greatly appreciate
any help!

thanks
chris






FastPath call returned ERROR:  lo_tell: invalid large object descriptor
(0)

    at org.postgresql.fastpath.Fastpath.fastpath(Fastpath.java:141)
    at org.postgresql.fastpath.Fastpath.fastpath(Fastpath.java:191)
    at
org.postgresql.fastpath.Fastpath.getInteger(Fastpath.java:203)
    at
org.postgresql.largeobject.LargeObject.tell(LargeObject.java:232)
    at
org.postgresql.largeobject.LargeObject.size(LargeObject.java:247)
    at org.postgresql.jdbc2.ResultSet.getBytes(ResultSet.java:370)
    at
org.postgresql.jdbc2.ResultSet.getBinaryStream(ResultSet.java:514)
    at
org.postgresql.jdbc2.ResultSet.getBinaryStream(ResultSet.java:616)
    at
com.commnav.sbh.framework.persist.JDBCEngine.loadResultSet(JDBCEngine.ja
va:4
40)
    at
com.commnav.sbh.framework.persist.JDBCEngine.load(JDBCEngine.java:284)
    at
com.commnav.sbh.framework.persist.PersistenceObject.load(PersistenceObje
ct.j
ava:169)
    at
com.commnav.sbh.framework.documentmanager.SBHDocument.loadComplex(SBHDoc
umen
t.java:586)
    at
com.commnav.sbh.framework.persist.PersistenceObject.load(PersistenceObje
ct.j
ava:208)
    at
com.commnav.sbh.applications.documentmanager.FavoriteDocumentIteratorTag
.doS
tartTag(FavoriteDocumentIteratorTag.java:56)
    at
apps.favorited_00025cuments._0002fapps_0002ffavoritedocuments_0002ffavor
ited
ocumentspidget_0002ejspfavoritedocumentspidget_jsp_24._jspService(_0002f
apps
_0002ffavoritedocuments_0002ffavoritedocumentspidget_0002ejspfavoritedoc
umen
tspidget_jsp_24.java:392)
    at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServle
t.ja
va:177)
    at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
    at
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
    at org.apache.tomcat.core.Handler.service(Handler.java:286)
    at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
    at
org.apache.tomcat.facade.RequestDispatcherImpl.include(RequestDispatcher
Impl
.java:345)
    at
org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:4
14)
    at
_0002fdesktop_0002ejspdesktop_jsp_130._jspService(_0002fdesktop_0002ejsp
desk
top_jsp_130.java:601)
    at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServle
t.ja
va:177)
    at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
    at
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
    at org.apache.tomcat.core.Handler.service(Handler.java:286)
    at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
    at
org.apache.tomcat.facade.RequestDispatcherImpl.forward(RequestDispatcher
Impl
.java:194)
    at
com.commnav.sbh.framework.navigation.handlers.NavigationHandlerImpl.exec
ute(
NavigationHandlerImpl.java:39)
    at
com.commnav.sbh.framework.navigation.Navigator.navigate(Navigator.java:8
0)
    at
com.commnav.sbh.servlets.ControlServlet.doPost(ControlServlet.java:132)
    at
com.commnav.sbh.servlets.ControlServlet.doGet(ControlServlet.java:63)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
    at org.apache.tomcat.core.Handler.service(Handler.java:286)
    at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
    at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.jav
a:79
7)
    at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
    at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(H
ttpC
onnectionHandler.java:210)
    at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416
)
    at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:49
8)
    at java.lang.Thread.run(Thread.java:484)


---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster