Bug 12083

Summary: Exceptions when starting an Xindice session
Product: Xindice Reporter: sargonnath <grunt>
Component: DB EngineAssignee: Xindice Developers <xindice-dev>
Status: CLOSED FIXED    
Severity: critical    
Priority: P3    
Version: 1.0   
Target Milestone: ---   
Hardware: PC   
OS: All   

Description sargonnath 2002-08-27 14:39:31 UTC
I run Xindice under Windows 98 and use this classpath:

D:\JDK\lib\tools.jar (tried at first and last position of the classpath)
D:\XINDICE\Java\Lib\xmldb.jar
D:\XINDICE\Java\Lib\XIndice.jar
D:\XINDICE\Java\Lib\xalan-2.0.1.jar
D:\XINDICE\Java\Lib\XERCES-1.4.3.jar
D:\XINDICE\Java\Lib\openorb-1.2.0.jar
D:\XINDICE\Java\Lib\ANT-1.4.1.jar
+ JSDK 1.3.1 or JDK 1.4.01 (tried both)

when I start the server with startup.bat, my screen is filled with exceptions 
like these:

DEBUG> 
java.lang.IndexOutOfBoundsException
at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:89)
at org.apache.xindice.core.filer.Paged$Page.streamTo(Paged.java:992)
at org.apache.xindice.core.filer.Paged.readValue(Paged.java:163)
at org.apache.xindice.core.filer.BTreeFiler.readRecord(BTreeFiler.java:131)
at org.apache.xindice.core.Collection.getDocument(Collection.java:714)
at org.apache.xindice.core.Collection.putDocument(Collection.java:624)
at org.apache.xindice.core.Collection.putObject(Collection.java:795)
at org.apache.xindice.core.Collection.setObject(Collection.java:807)
at org.apache.xindice.core.SystemCollection.saveSymbols
(SystemCollection.java:202)
at org.apache.xindice.core.SystemCollection.loadSymbols
(SystemCollection.java:185)
at org.apache.xindice.core.Collection.setConfig(Collection.java:175)
at org.apache.xindice.core.CollectionManager$1.process
(CollectionManager.java:96)
at org.apache.xindice.util.Configuration.processChildren(Configuration.java:684)
at org.apache.xindice.core.CollectionManager.setConfig
(CollectionManager.java:92)
at org.apache.xindice.core.Collection.setConfig(Collection.java:216)
at org.apache.xindice.core.SystemCollection.init(SystemCollection.java:155)
at org.apache.xindice.core.Database.setConfig(Database.java:155)
at org.apache.xindice.server.services.XindiceService.initialize
(XindiceService.java:106)
at org.apache.xindice.server.standard.StdServiceManager.addService
(StdServiceManager.java:166)
at org.apache.xindice.server.standard.StdServiceManager$1.process
(StdServiceManager.java:104)
at org.apache.xindice.util.Configuration.processChildren(Configuration.java:684)
at org.apache.xindice.server.standard.StdServiceManager.setConfig
(StdServiceManager.java:90)
at org.apache.xindice.server.Kernel.loadAPI(Kernel.java:336)
at org.apache.xindice.server.Kernel.<init>(Kernel.java:150)
at org.apache.xindice.server.Kernel.<init>(Kernel.java:117)
at org.apache.xindice.server.Xindice.main(Xindice.java:96)
DEBUG> 
java.io.IOException: Negative seek offset
at java.io.RandomAccessFile.seek(Native Method)
at org.apache.xindice.core.filer.Paged$Page.read(Paged.java:921)
at org.apache.xindice.core.filer.Paged.getPage(Paged.java:130)
at org.apache.xindice.core.filer.Paged.getPage(Paged.java:144)
at org.apache.xindice.core.filer.Paged.writeValue(Paged.java:207)
at org.apache.xindice.core.filer.BTreeFiler.writeRecord(BTreeFiler.java:173)
at org.apache.xindice.core.Collection.putDocument(Collection.java:629)
at org.apache.xindice.core.Collection.putObject(Collection.java:795)
at org.apache.xindice.core.Collection.setObject(Collection.java:807)
at org.apache.xindice.core.SystemCollection.saveSymbols
(SystemCollection.java:202)
at org.apache.xindice.core.SystemCollection.loadSymbols
(SystemCollection.java:185)
at org.apache.xindice.core.Collection.setConfig(Collection.java:175)
at org.apache.xindice.core.CollectionManager$1.process
(CollectionManager.java:96)
at org.apache.xindice.util.Configuration.processChildren(Configuration.java:684)
at org.apache.xindice.core.CollectionManager.setConfig
(CollectionManager.java:92)
at org.apache.xindice.core.Collection.setConfig(Collection.java:216)
at org.apache.xindice.core.SystemCollection.init(SystemCollection.java:155)
at org.apache.xindice.core.Database.setConfig(Database.java:155)
at org.apache.xindice.server.services.XindiceService.initialize
(XindiceService.java:106)
at org.apache.xindice.server.standard.StdServiceManager.addService
(StdServiceManager.java:166)
at org.apache.xindice.server.standard.StdServiceManager$1.process
(StdServiceManager.java:104)
at org.apache.xindice.util.Configuration.processChildren(Configuration.java:684)
at org.apache.xindice.server.standard.StdServiceManager.setConfig
(StdServiceManager.java:90)
at org.apache.xindice.server.Kernel.loadAPI(Kernel.java:336)
at org.apache.xindice.server.Kernel.<init>(Kernel.java:150)
at org.apache.xindice.server.Kernel.<init>(Kernel.java:117)
at org.apache.xindice.server.Xindice.main(Xindice.java:96)


By editing the Xindice sources I added some messages to track a bit more my 
trouble and discovered that the readValue function in BTreeFiler::readRecord is 
the one who failed.

public synchronized Record readRecord(Key key) throws DBException {
checkOpened();
try {
long pos = findValue(key);
Page startPage = getPage(pos);
Value v = readValue(startPage);
BTreeFilerPageHeader sph = (BTreeFilerPageHeader)startPage.getPageHeader();

HashMap meta = new HashMap(2);
meta.put(Record.CREATED, new Long(sph.getCreated()));
meta.put(Record.MODIFIED, new Long(sph.getModified()));

return new Record(key, v, meta);
}
catch ( BTreeNotFoundException b ) {
}
catch ( BTreeException b ) {
throw b;
}
catch ( Exception e ) {
org.apache.xindice.Debug.printStackTrace(e);
}
return null;
}


Here the steps:
1) the system ask for the pos of the key 'database.xml' and got the result 1.

2) then it asks for the startpage at this position: the page header he receive 
is '(pageNum: 1, keyPos: 64, dataPos: -262, offset: 8 192)'
It's a sample, but these numbers are most of the time negative and appears to 
have no sense.

3) it calls the readValue function who fail, acting on a negative number this 
function should not use.


However, even with theses troubles, the server is launched and creating a 
collection then adding a document is possible. Even queries seems then to work.

but I have to say that when I stop the server with a:
xindiceadmin shutdown -c /db

I receive the following dump:

org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 208 completed: Maybe
at com.sun.corba.se.internal.iiop.IIOPConnection.purge_calls(IIOPConnect
ion.java:438)
at com.sun.corba.se.internal.iiop.ReaderThread.run(ReaderThread.java:70)

ERROR : org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No
Verify the Xindice server is running
org.omg.CORBA.COMM_FAILURE: ERROR : org.omg.CORBA.COMM_FAILURE: vmcid: SUN mi
nor code: 201 completed: No Verify the Xindice server is running vmcid: 0x0 m
inor code: 0 completed: No
at org.apache.xindice.tools.XMLTools.process(XMLTools.java:267)
at org.apache.xindice.tools.XMLAdminTools.main(XMLAdminTools.java:89)


and all data I may have stored during this session are lost. At the next 
restart of Xindice I will only find the collection system available.

Marc.
Comment 1 Kevin Ross 2003-05-30 23:31:29 UTC
Please try out 1.1 or the cvs head and reopen the bug if you have issues with 
that version.

You have done significant work on this, and I would be interested to know if 
this issue exists in 1.1 core.  If you do find it, please submit the patch in 
diff -u format (I use eclipse, it's really easy) and I will expedite the 
commit.

If you were to be able to create a junit first, that would be great.