This looks like you have either not got AutoCommit set to false, or are
calling commit() between calls. As of 6.5.x LargeObjects need to be
wrapped within a transaction, but if I'm right, all open LO's are closed
on commit().

Peter

-- 
Peter Mount
Enterprise Support
Maidstone Borough Council
Any views stated are my own, and not those of Maidstone Borough Council.



-----Original Message-----
From: Jason Venner [mailto:jason@idiom.com]
Sent: 13 September 1999 05:31
To: pgsql-hackers@hub.org
Subject: [HACKERS] jdbc1 large objects and 651 -- does it work for
anyone




Calling setBytes or any attempt to do LargeObject.write(byte[])
returns

[on the java side]
Oid gotten from lom.create() is 641377
FastPath call returned ERROR:  lo_write: invalid large obj descriptor
(0)

        at postgresql.fastpath.Fastpath.fastpath(Fastpath.java:141)
        at postgresql.fastpath.Fastpath.fastpath(Fastpath.java:188)
        at
postgresql.largeobject.LargeObject.write(LargeObject.java:173)
        at RestoreBlobs.main(RestoreBlobs.java:298)


The -d3 log of the postmaster has

nitPostgres
StartTransactionCommand
query: set datestyle to 'ISO'
ProcessUtility: set datestyle to 'ISO'
CommitTransactionCommand
StartTransactionCommand
query: select proname, oid from pg_proc where proname = 'lo_open' or
proname = 'lo_close' or proname = 'lo_creat' or proname = 'lo_unl\
ink' or proname = 'lo_lseek' or proname = 'lo_tell' or proname =
'loread' or proname = 'lowrite'
ProcessQuery
CommitTransactionCommand
StartTransactionCommand
CommitTransactionCommand
StartTransactionCommand
CommitTransactionCommand
StartTransactionCommand
ERROR:  lo_write: invalid large obj descriptor (0)
AbortCurrentTransaction
pq_recvbuf: unexpected EOF on client connection
proc_exit(0) [#0]
shmem_exit(0) [#0]
exit(0)
pq_recvbuf: unexpected EOF on client connection
proc_exit(0) [#0]
shmem_exit(0) [#0]
exit(0)
pq_recvbuf: unexpected EOF on client connection
proc_exit(0) [#0]
shmem_exit(0) [#0]
exit(0)

************

Mon, 13 Sep 1999 07:39:01 +0100
Peter Mount <petermount@it.maidstone.gov.uk>
RE: [HACKERS] jdbc1 large objects and 651 -- does it work for any one

Okay, I turned autocommit off (used to have to be autocommit on in
6.3.2) Note: I am running --enable-cassert At the current time there
are 2 open connections to the database, one essentially idle, the
other doing the image work.

I store about 3200 LO's, and on commit get the following

from the java

about to update on 650697 backup/19990911-175649/6654 4
about to update on 650698 backup/19990911-175649/6655 3
The backend has broken the connection. Possibly the action you have attempted has caused it to close.

        at postgresql.PG_Stream.ReceiveChar(PG_Stream.java:173)[1]    Done                   bin/postmaster -N 128 -d 3 -i >& /tmp/pgl\
og

        at postgresql.Connection.ExecSQL(Connection.java:309)
        at postgresql.jdbc1.Connection.commit(Connection.java:173)
        at RestoreBlobs.restoreWithLocks(RestoreBlobs.java:72)
        at RestoreBlobs.main(RestoreBlobs.java:301)
./db_restore_script: unable to restore all of the images, failed on 1


[note the postmaster bailed]

StartTransactionCommand
query: update invoice set invoice = 712005 where seq = 98
ProcessQuery
CommitTransactionCommand
StartTransactionCommand
CommitTransactionCommand
StartTransactionCommand
CommitTransactionCommand
StartTransactionCommand
CommitTransactionCommand
StartTransactionCommand
CommitTransactionCommand
StartTransactionCommand
query: update invoice set invoice = 712020 where seq = 99
ProcessQuery
CommitTransactionCommand
StartTransactionCommand
CommitTransactionCommand
StartTransactionCommand
CommitTransactionCommand
StartTransactionCommand
CommitTransactionCommand
StartTransactionCommand
CommitTransactionCommand
StartTransactionCommand
query: update invoice set invoice = 712035 where seq = 103
ProcessQuery
CommitTransactionCommand
StartTransactionCommand
query: commit
ProcessUtility: commit
CommitTransactionCommand
NOTICE:  LockReleaseAll: xid loop detected, giving up
StartTransactionCommand
query: begin
ProcessUtility: begin
CommitTransactionCommand
StartTransactionCommand
query: commit
ProcessUtility: commit
NOTICE:  SIReadEntryData: cache state reset
TRAP: Failed Assertion("!(RelationNameCache->hctl->nkeys == 10):", File: "relcache.c", Line: 1458)

!(RelationNameCache->hctl->nkeys == 10) (0) [No such file or directory]
bin/postmaster: reaping dead processes...
bin/postmaster: CleanupProc: pid 9768 exited with status 134
bin/postmaster: CleanupProc: sending SIGUSR1 to process 9759
NOTICE:  Message from PostgreSQL backend:
        The Postmaster has informed me that some other backend died abnormally and possibly corrupted shared memory.
        I have rolled back the current transaction and am going to terminate your database system connection and exit.
        Please reconnect to the database system and repeat your query.
bin/postmaster: CleanupProc: sending SIGUSR1 to process 9756
NOTICE:  Message from PostgreSQL backend:
        The Postmaster has informed me that some other backend died abnormally and possibly corrupted shared memory.
        I have rolled back the current transaction and am going to terminate your database system connection and exit.
        Please reconnect to the database system and repeat your query.
bin/postmaster: CleanupProc: reinitializing shared memory and semaphores
shmem_exit(0) [#0]
binding ShmemCreate(key=52df3d, size=10292224)
IpcMemoryCreate: shmget failed (Cannot allocate memory) key=5431101, size=10292224, permission=600
FATAL 1:  ShmemCreate: cannot create region
proc_exit(0) [#0]
shmem_exit(0) [#0]
exit(0)


Mon, 13 Sep 1999 13:03:05 -0700
Jason Venner <jason@idiom.com>
Re: [HACKERS] jdbc1 large objects and 651 -- does it work for any one