Re: BUG #5269: postgres backend terminates with SIGSEGV
От | Justin Pitts |
---|---|
Тема | Re: BUG #5269: postgres backend terminates with SIGSEGV |
Дата | |
Msg-id | C1CAC7F4-7E90-4778-BB7B-D08ACD541EB3@bplglobal.net обсуждение исходный текст |
Ответ на | Re: BUG #5269: postgres backend terminates with SIGSEGV (Justin Pitts <justinpitts@gmail.com>) |
Список | pgsql-bugs |
Apologies for over-quoting on the previous message. My approach to a regression test was this single-threaded test ( actual cod= e at bottom )=20 Connection 1 - implicitly autocommiting every statement create a test table and populate it with a single row.=20 CREATE TABLE FOO ( a int not null ); INSERT INTO FOO VALUES (1); set the connection autocommit to false ( implied transaction begin on nex= t statement ) read=20 SELECT * FROM FOO; modify UPDATE FOO SET a=3Da+1; ( transaction is still open ) Connection 2 set the connection autocommit to false read SELECT * FROM FOO; Connection 1 commit; Connection 2 modify UPDATE FOO SET a=3Da+1 throws concurrent serialization error Connection 3 do a bunch of catalog updates for f in 1..??? ( i tried 1, 10, 100, and 4096 ) CREATE TEMP TABLE BAR$f (a int not null ); Connection 2 rollback <- I am expecting a server crash here. It does not crash. My guess is that I am not provoking a 'SI queue overrun'=20 ( I am assuming this is a reference to the queue implemented in sinvaladt.c= . My C skills are rusty at best. ) Am I completely off base about how this should be reproducing? Bug5269Test.java import java.sql.Connection; import java.sql.Driver; import java.sql.SQLException; import java.sql.Statement; import java.util.Properties; /* Regression test for PostgreSQL Bug # 5269=20 * http://archives.postgresql.org/pgsql-bugs/2010-01/msg00080.php=20 * */ public class Bug5269Test { private Connection newConnection(Driver driver) { Properties info =3D new Properties(); info.put("user", "postgres"); try { return driver.connect("jdbc:postgresql://localhost:5433", info); } catch (SQLException e) { e.printStackTrace(); } return null; } public void test() throws SQLException, InterruptedException { Driver driver =3D new org.postgresql.Driver(); Connection a =3D newConnection(driver); setupTable(a); Connection b =3D newConnection(driver); a.setAutoCommit(false); a.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE); b.setAutoCommit(false); b.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE); String select =3D "select * from foo"; String update =3D "update foo set a =3D a + 1"; a.prepareStatement(select).execute(); System.out.println("select a"); a.prepareStatement(update).execute(); System.out.println("update a"); b.prepareStatement(select).execute(); System.out.println("select b"); a.commit(); System.out.println("commit a"); try { b.prepareStatement(update).execute(); b.commit(); throw new RuntimeException("Expected a serialization failure."); } catch (SQLException sqle) { System.out.println(sqle.getMessage()); flogCatalogs(driver); System.out.println("flog catalogs"); // The hope is that an unpatched system would crash here. b.rollback(); System.out.println("rollback."); } a.close(); b.close(); } private void setupTable(Connection a) throws SQLException { try { a.prepareStatement("drop table foo").execute(); } catch (Exception e) { e.printStackTrace(); } a.prepareStatement("create table foo(a int not null)").executeUpdate(); a.prepareStatement("insert into foo values (1);").executeUpdate(); } private void flogCatalogs(final Driver driver) throws SQLException { final Connection conn =3D newConnection(driver); try { conn.setAutoCommit(false); Statement ps =3D conn.createStatement(); String a =3D "create temp table bar"; String b =3D " (a int not null); "; for (int f =3D 0; f < 128; f++) { StringBuilder sb =3D new StringBuilder(); sb.append(a).append(f).append(b); ps.execute(sb.toString()); } conn.commit(); } catch (SQLException e) { e.printStackTrace(); } finally { try { conn.close(); } catch (SQLException e) { e.printStackTrace(); } } } public static void main(String... args) throws SQLException, InterruptedException { Bug5269Test test =3D new Bug5269Test(); test.test(); } } On Jan 13, 2010, at 10:22 PM, Justin Pitts wrote: > Sorry for the delay. >=20 > I am attempting to construct a JDBC test case that reproduces the problem= .=20 >=20 > I have installed the patch and have not seen the crash since. >=20 > On Jan 13, 2010, at 11:58 AM, Tom Lane wrote: >=20
В списке pgsql-bugs по дате отправления: