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

2001-08-15 Thread chris markiewicz

While I can readily reproduce it on my application, I have so far been
unsuccessful at writing a test case that reproduces the problem.

Oh, I just tried the latest drivers - no luck - same problem.

Equally unfortunate is the fact that all database processing is heavily
abstracted in the application - so there is no method that grabs a
connection, performs the query, iterates through the ResultSet, and closes
the rs/stmt/conn.  I know that I am unlikely to find help unless I can
manage to reproduce the problem on an independent program, but I was hoping
that there might be some general LO or byte stream rule that I am not
following.

The area where is breaks is shown below.  The method grabs the column name
from RS metadata and calls either getObject or getBytes.  When it hangs, it
occurs on the getBytes(...) line.
Once it hangs, the system is essentially useless.  My test program will
freeze when it reaches the particular row that the application is trying to
access.  The application hangs on to the commection until I stop Tomcat.

I'll continue trying to reproduce in a separate program.

thanks
chris

if (sqlf.getGetType().equals(byte[])) {
try {
System.out.println(JDBCE.getbytes (before));
byte[] bytes = rs.getBytes(columnName);
System.out.println(JDBCE.getbytes (after));
marshaller.setObjectField(o, sqlf.getMapField(), bytes);
  } catch (Exception e) {
String exStr = e.toString();
//## create SBHException here so that it is logged
SBHException sbhex = new SBHException(e);
if (exStr.indexOf(FastPath) == -1) {
System.out.println(JDBCE.lrs NONFastPath error...+exStr);
  throw e;
} else {
  System.out.println(JDBCE.lrs FastPath error...+exStr);
  throw new FastPathException(e);
}
}
} else {
result = rs.getObject(columnName);
  marshaller.setObjectField(o, sqlf.getMapField(), result);
}



---(end of broadcast)---
TIP 6: Have you searched our list archives?

http://www.postgresql.org/search.mpl



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

2001-08-15 Thread Dave Cramer

Chris,

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

DAve

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]] On Behalf Of chris markiewicz
Sent: August 15, 2001 3:04 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
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: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of chris markiewicz
Sent: Thursday, August 02, 2001 6:04 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
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