Bug 1020257 - Exception when deserializing/decoding string data from a BSON file
Exception when deserializing/decoding string data from a BSON file
Status: CLOSED CURRENTRELEASE
Product: JBoss Data Virtualization 6
Classification: JBoss
Component: ModeShape (Show other bugs)
6.0.0
Unspecified Unspecified
unspecified Severity high
: ER3
: ---
Assigned To: Horia Chiorean
: QA-Closed
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-10-17 07:03 EDT by Horia Chiorean
Modified: 2016-02-10 03:58 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-02-10 03:58:32 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker 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 07:46:24 EST

  None (edit)
Description Horia Chiorean 2013-10-17 07:03:28 EDT
See linked issue for more details.
Comment 1 JBoss JIRA Server 2013-10-17 07:06:43 EDT
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 09:03:41 EDT
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 09:33:10 EDT
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 11:42:10 EDT
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 05:23:27 EDT
Randall Hauch <rhauch@jboss.org> updated the status of jira MODE-2074 to Closed
Comment 8 belong 2013-11-17 22:06:28 EST
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.