Re: [HACKERS] Re: SIGBUS in AllocSetAlloc & jdbc - Mailing list pgsql-hackers

From Tatsuo Ishii
Subject Re: [HACKERS] Re: SIGBUS in AllocSetAlloc & jdbc
Date
Msg-id 199905021452.XAA00509@ext16.sra.co.jp
Whole thread Raw
In response to Re: [HACKERS] Re: SIGBUS in AllocSetAlloc & jdbc  (Tatsuo Ishii <t-ishii@sra.co.jp>)
Responses Re: [HACKERS] Re: SIGBUS in AllocSetAlloc & jdbc  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: [HACKERS] Re: SIGBUS in AllocSetAlloc & jdbc  (Peter T Mount <peter@retep.org.uk>)
List pgsql-hackers
> This morning I started to look into this. First, JDBC driver coming
> with 6.5b did not compile. The reason was my JDK (JDK 1.1.7 v1 on
> LinuxPPC) returns version string as "root:10/14/98-13:50" and
> makeVersion expected it started with "1.1". This was easy to fix. So I
> went on and tried the ImageViewer sample. It gave me SQL an exception:
> 
> java example.ImageViewer jdbc:postgresql:test t-ishii ""
> Connecting to Database URL = jdbc:postgresql:test
> Exception caught.
> java.sql.SQLException: The postgresql.jar file does not contain the correct JDBC classes for this JVM. Try
rebuilding.
> Exception thrown was java.lang.ClassNotFoundException: postgresql.jdbc2.Connection
> java.sql.SQLException: The postgresql.jar file does not contain the correct JDBC classes for this JVM. Try
rebuilding.
> Exception thrown was java.lang.ClassNotFoundException: postgresql.jdbc2.Connection
>     at postgresql.Driver.connect(Compiled Code)
>     at java.sql.DriverManager.getConnection(Compiled Code)
>     at java.sql.DriverManager.getConnection(Compiled Code)
>     at example.ImageViewer.<init>(Compiled Code)
>     at example.ImageViewer.main(Compiled Code)
> 
> I had no idea how to fix this. I gave up to use the 6.5 JDBC driver. I
> had to get back to the 6.4 JDBC driver.  This time ImageViewer seemed
> to work. I imported 3 images. Worked fine. Then I tried to take a
> glance at the first image. I got SIGSEGV on the backend! It happened in
> AllocSetAlloc () and seems in the same place as Brian P Millett
> mentioned. Next I switched the backend to 6.4.2(+ large object fixes
> basically same as 6.5). Worked great!
> 
> In summary:
> 
> (1) 6.5 ImageViewer + 6.4.2 JDBC driver + 6.5 backend failed
> (2) 6.5 ImageViewer + 6.4.2 JDBC driver + 6.4.2 backend worked
> 
> So I suspect there is something wrong with the 6.5 backend. I'll look
> into this more.
> 
> P.S.  Peter, do you have any suggestion to make JDBC driver under JDK
> 1.1.7?

So far I couldn't find nothing special with the backend by now. Going
back to the ImageViewer, I think I found possible problem with it. In
my understanding, every lo call should be in single transaction block. 
But ImageViwer seems does not give any "begin" or "end" SQL commands.
I made a small modifications(see below patches) to the ImageViewer and
now it starts to work again with 6.5 backend! I suspect that
difference of palloc() code between 6.4.2 and 6.5 made the problem
opened up.
---
Tatsuo Ishii

*** ImageViewer.java~    Mon Oct 12 11:45:45 1998
--- ImageViewer.java    Sun May  2 23:16:27 1999
***************
*** 390,395 ****
--- 390,396 ----   {     try {       System.out.println("Selecting oid for "+name);
+       stat.executeUpdate("begin");       ResultSet rs = stat.executeQuery("select imgoid from images where
imgname='"+name+"'");      if(rs!=null) {     // Even though there should only be one image, we still have to
 
***************
*** 402,407 ****
--- 403,409 ----     }       }       rs.close();
+       stat.executeUpdate("end");     } catch(SQLException ex) {       label.setText(ex.toString());     }


pgsql-hackers by date:

Previous
From: Chris Bitmead
Date:
Subject: Re: [HACKERS] It would be nice if this could be fixed...
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] Re: SIGBUS in AllocSetAlloc & jdbc