Bug 1020257 - Exception when deserializing/decoding string data from a BSON file
Summary: Exception when deserializing/decoding string data from a BSON file
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Data Virtualization 6
Classification: JBoss
Component: ModeShape
Version: 6.0.0
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ER3
: ---
Assignee: Horia Chiorean
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-10-17 11:03 UTC by Horia Chiorean
Modified: 2016-02-10 08:58 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-02-10 08:58:32 UTC
Type: Bug


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
JBoss Issue Tracker MODE-2074 Blocker Closed Startup Modeshape got exception: java.lang.IllegalStateException: Current state = CODING_END, new state = CODING 2014-02-18 12:46:24 UTC

Description Horia Chiorean 2013-10-17 11:03:28 UTC
See linked issue for more details.

Comment 1 JBoss JIRA Server 2013-10-17 11:06:43 UTC
Horia Chiorean <hchiorea@redhat.com> made a comment on jira MODE-2074

There are at least 2 bugs here:

1) the fact that the {{CharSet}} encoder and decoder are *not used* in a thread-safe manner 
2) the fact that they aren't {{reset}} after their use. According to the Javadoc, each encoder/decoder should at least be {{reset}} (if not also flushed) after the encoding/decoding operation finishes.

Comment 2 JBoss JIRA Server 2013-10-17 13:03:41 UTC
Randall Hauch <rhauch@jboss.org> made a comment on jira MODE-2074

Have no idea whether a thread issue or didn't do reset issue. Full stacktrace paste:
{code}
15:41:11,783 ERROR InvocationContextInterceptor:148 - ISPN000136: Execution error
java.lang.IllegalStateException: Current state = CODING_END, new state = CODING
	at java.nio.charset.CharsetDecoder.throwIllegalStateException(CharsetDecoder.java:968)
	at java.nio.charset.CharsetDecoder.decode(CharsetDecoder.java:554)
	at org.infinispan.schematic.internal.io.BsonDataInput.readUTF(BsonDataInput.java:277)
	at org.infinispan.schematic.internal.io.BsonDataInput.readUTF(BsonDataInput.java:223)
	at org.infinispan.schematic.internal.document.BsonReader$Reader.readString(BsonReader.java:236)
	at org.infinispan.schematic.internal.document.BsonReader$Reader.readElement(BsonReader.java:213)
	at org.infinispan.schematic.internal.document.BsonReader$Reader.readDocument(BsonReader.java:139)
	at org.infinispan.schematic.internal.document.BsonReader$Reader.readElement(BsonReader.java:175)
	at org.infinispan.schematic.internal.document.BsonReader$Reader.readDocument(BsonReader.java:139)
	at org.infinispan.schematic.internal.document.BsonReader$Reader.readElement(BsonReader.java:175)
	at org.infinispan.schematic.internal.document.BsonReader$Reader.readDocument(BsonReader.java:139)
	at org.infinispan.schematic.internal.document.BsonReader$Reader.readElement(BsonReader.java:175)
	at org.infinispan.schematic.internal.document.BsonReader$Reader.readDocument(BsonReader.java:139)
	at org.infinispan.schematic.internal.document.BsonReader$Reader.startDocument(BsonReader.java:122)
	at org.infinispan.schematic.internal.document.BsonReader.read(BsonReader.java:74)
	at org.infinispan.schematic.document.Bson.read(Bson.java:208)
	at org.infinispan.schematic.internal.document.DocumentExternalizer.readObject(DocumentExternalizer.java:55)
	at org.infinispan.schematic.internal.document.DocumentExternalizer.readObject(DocumentExternalizer.java:34)
	at org.infinispan.marshall.jboss.JBossExternalizerAdapter.createExternal(JBossExternalizerAdapter.java:48)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1278)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:272)
	at org.jboss.marshalling.river.BlockUnmarshaller.readObject(BlockUnmarshaller.java:153)
	at org.jboss.marshalling.river.BlockUnmarshaller.readObject(BlockUnmarshaller.java:139)
	at org.infinispan.schematic.internal.SchematicEntryLiteral$Externalizer.readObject(SchematicEntryLiteral.java:362)
	at org.infinispan.schematic.internal.SchematicEntryLiteral$Externalizer.readObject(SchematicEntryLiteral.java:351)
	at org.infinispan.marshall.jboss.JBossExternalizerAdapter.createExternal(JBossExternalizerAdapter.java:48)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1278)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:272)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:209)
	at org.jboss.marshalling.AbstractObjectInput.readObject(AbstractObjectInput.java:37)
	at org.infinispan.container.entries.ImmortalCacheValue$Externalizer.readObject(ImmortalCacheValue.java:140)
	at org.infinispan.container.entries.ImmortalCacheValue$Externalizer.readObject(ImmortalCacheValue.java:132)
	at org.infinispan.marshall.jboss.ExternalizerTable$ExternalizerAdapter.readObject(ExternalizerTable.java:412)
	at org.infinispan.marshall.jboss.ExternalizerTable.readObject(ExternalizerTable.java:228)
	at org.infinispan.marshall.jboss.JBossMarshaller$ExternalizerTableProxy.readObject(JBossMarshaller.java:164)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:351)
	at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:209)
	at org.jboss.marshalling.AbstractObjectInput.readObject(AbstractObjectInput.java:37)
	at org.infinispan.marshall.jboss.AbstractJBossMarshaller.objectFromObjectStream(AbstractJBossMarshaller.java:163)
	at org.infinispan.marshall.VersionAwareMarshaller.objectFromByteBuffer(VersionAwareMarshaller.java:116)
	at org.infinispan.marshall.AbstractMarshaller.objectFromInputStream(AbstractMarshaller.java:128)
	at org.infinispan.marshall.AbstractDelegatingMarshaller.objectFromInputStream(AbstractDelegatingMarshaller.java:84)
	at org.infinispan.loaders.jdbc.JdbcUtil.unmarshall(JdbcUtil.java:88)
	at org.infinispan.loaders.jdbc.stringbased.JdbcStringBasedCacheStore.readStoredEntry(JdbcStringBasedCacheStore.java:412)
	at org.infinispan.loaders.jdbc.stringbased.JdbcStringBasedCacheStore.loadLockSafe(JdbcStringBasedCacheStore.java:343)
	at org.infinispan.loaders.jdbc.stringbased.JdbcStringBasedCacheStore.loadLockSafe(JdbcStringBasedCacheStore.java:87)
	at org.infinispan.loaders.LockSupportCacheStore.load(LockSupportCacheStore.java:142)
	at org.infinispan.interceptors.CacheLoaderInterceptor.loadIfNeeded(CacheLoaderInterceptor.java:189)
	at org.infinispan.interceptors.CacheLoaderInterceptor.loadIfNeededAndUpdateStats(CacheLoaderInterceptor.java:263)
	at org.infinispan.interceptors.CacheLoaderInterceptor.visitGetKeyValueCommand(CacheLoaderInterceptor.java:122)
	at org.infinispan.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:62)
	at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:120)
	at org.infinispan.interceptors.EntryWrappingInterceptor.visitGetKeyValueCommand(EntryWrappingInterceptor.java:119)
	at org.infinispan.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:62)
	at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:120)
	at org.infinispan.interceptors.base.CommandInterceptor.handleDefault(CommandInterceptor.java:134)
	at org.infinispan.commands.AbstractVisitor.visitGetKeyValueCommand(AbstractVisitor.java:96)
	at org.infinispan.interceptors.locking.AbstractTxLockingInterceptor.visitGetKeyValueCommand(AbstractTxLockingInterceptor.java:98)
	at org.infinispan.interceptors.locking.OptimisticLockingInterceptor.visitGetKeyValueCommand(OptimisticLockingInterceptor.java:130)
	at org.infinispan.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:62)
	at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:120)
	at org.infinispan.interceptors.base.CommandInterceptor.handleDefault(CommandInterceptor.java:134)
	at org.infinispan.commands.AbstractVisitor.visitGetKeyValueCommand(AbstractVisitor.java:96)
	at org.infinispan.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:62)
	at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:120)
	at org.infinispan.interceptors.TxInterceptor.enlistReadAndInvokeNext(TxInterceptor.java:234)
	at org.infinispan.interceptors.TxInterceptor.visitGetKeyValueCommand(TxInterceptor.java:229)
	at org.infinispan.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:62)
	at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:120)
	at org.infinispan.interceptors.CacheMgmtInterceptor.visitGetKeyValueCommand(CacheMgmtInterceptor.java:113)
	at org.infinispan.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:62)
	at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:120)
	at org.infinispan.interceptors.InvocationContextInterceptor.handleAll(InvocationContextInterceptor.java:128)
	at org.infinispan.interceptors.InvocationContextInterceptor.handleDefault(InvocationContextInterceptor.java:92)
	at org.infinispan.commands.AbstractVisitor.visitGetKeyValueCommand(AbstractVisitor.java:96)
	at org.infinispan.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:62)
	at org.infinispan.interceptors.InterceptorChain.invoke(InterceptorChain.java:343)
	at org.infinispan.CacheImpl.get(CacheImpl.java:391)
	at org.infinispan.CacheImpl.get(CacheImpl.java:383)
	at org.infinispan.schematic.internal.CacheSchematicDb.get(CacheSchematicDb.java:235)
	at org.modeshape.jcr.cache.document.LocalDocumentStore.get(LocalDocumentStore.java:64)
	at org.modeshape.jcr.cache.document.WorkspaceCache.documentFor(WorkspaceCache.java:163)
	at org.modeshape.jcr.cache.document.WorkspaceCache.documentFor(WorkspaceCache.java:182)
	at org.modeshape.jcr.cache.document.WorkspaceCache.getNode(WorkspaceCache.java:214)
	at org.modeshape.jcr.RepositoryQueryManager.reindexContent(RepositoryQueryManager.java:378)
	at org.modeshape.jcr.RepositoryQueryManager.reindexContent(RepositoryQueryManager.java:262)
	at org.modeshape.jcr.RepositoryQueryManager.access$000(RepositoryQueryManager.java:71)
	at org.modeshape.jcr.RepositoryQueryManager$1.call(RepositoryQueryManager.java:223)
	at org.modeshape.jcr.RepositoryQueryManager$1.call(RepositoryQueryManager.java:219)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
	at java.util.concurrent.FutureTask.run(FutureTask.java:166)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:722)
Caused by: an exception which occurred:
	in object of type org.infinispan.schematic.internal.document.BasicDocument
	in object of type org.infinispan.schematic.internal.SchematicEntryLiteral
{code}

Comment 3 JBoss JIRA Server 2013-10-17 13:33:10 UTC
Horia Chiorean <hchiorea@redhat.com> made a comment on jira MODE-2074

Fixed the usage of CharSet decoders/encoders by the BsonDataInput/Output classes. 

Since CharSet encoders/decoders a) hold state and b) are not thread safe, there are no reasons IMO to try and make them "global".

Fixing the above exposed another bug inside BsonDataInput around reading strings when the string size is larger than the default buffer. This PR attempts to fix that as well.

Comment 4 JBoss JIRA Server 2013-10-17 15:42:10 UTC
Randall Hauch <rhauch@jboss.org> made a comment on jira MODE-2074

Merged into the 'master' branch. Leaving open until it can be cherry-picked into the '3.3.x-prod-ip6.0' branch.

Comment 7 JBoss JIRA Server 2013-10-24 09:23:27 UTC
Randall Hauch <rhauch@jboss.org> updated the status of jira MODE-2074 to Closed

Comment 8 belong 2013-11-18 03:06:28 UTC
Fixed before GA of major release - setting to requires_doc_text- accordingly


Note You need to log in before you can comment on or make changes to this bug.