]
Tristan Tarrant updated ISPN-8691:
----------------------------------
Sprint: Sprint 9.4.0.CR1, Sprint 9.4.0.Final (was: Sprint 9.4.0.CR1)
Infinispan rejects to read cache file bigger than 2147483647
(Integer.MAX_VALUE)
--------------------------------------------------------------------------------
Key: ISPN-8691
URL:
https://issues.jboss.org/browse/ISPN-8691
Project: Infinispan
Issue Type: Bug
Components: Loaders and Stores
Affects Versions: 9.1.1.Final
Reporter: Dmitry Katsubo
Assignee: Ryan Emerson
Priority: Minor
Fix For: 9.4.0.Final
In my scenario the cache file size created by {{SingleFileStore}} is 3.054.196.342 bytes.
When this file is tried to be loaded, it fails with the following exception:
{code}
Caused by: org.infinispan.persistence.spi.PersistenceException: ISPN000279: Failed to
read stored entries from file. Error in file
/work/search-service-layer_data/infinispan/cache_test_dk83146/markupCache.dat at offset 4
at
org.infinispan.persistence.file.SingleFileStore.rebuildIndex(SingleFileStore.java:182)
at
org.infinispan.persistence.file.SingleFileStore.start(SingleFileStore.java:127)
... 155 more
{code}
Cache file content:
{code}
0000000000: 46 43 53 31 80 B1 89 47 │ 00 00 00 00 00 00 00 00 FCS1?+%G
0000000010: 00 00 00 00 FF FF FF FF │ FF FF FF FF 02 15 4E 06 yyyyyyyy☻§N♠
0000000020: 05 03 04 09 00 00 00 2F │ 6F 72 67 2E 73 70 72 69 ♣♥♦○ /org.spri
0000000030: 6E 67 66 72 61 6D 65 77 │ 6F 72 6B 2E 63 61 63 68 ngframework.cach
0000000040: 65 2E 69 6E 74 65 72 63 │ 65 70 74 6F 72 2E 53 69 e.interceptor.Si
0000000050: 6D 70 6C 65 4B 65 79 4C │ 0A 57 03 6B 6D 93 D8 00 mpleKeyL◙W♥km"O
0000000060: 00 00 02 00 00 00 08 68 │ 61 73 68 43 6F 64 65 23 ☻ ◘hashCode#
0000000070: 00 00 00 00 06 70 61 72 │ 61 6D 73 16 00 16 15 E6 ♠params▬ ▬§?
{code}
The problem is that integer value 0x80B18947 is treated as signed integer in line
{{SingleFileStore:181}}, hence in expression
{code}
if (fe.size < KEY_POS + fe.keyLen + fe.dataLen + fe.metadataLen) {
throw log.errorReadingFileStore(file.getPath(), filePos);
}
{code}
{{fe.size}} is negative and equal to -2135848633.
I have tried to configure the persistence storage so that it gets purged on start:
{code}
<persistence passivation="true">
<file-store path="/var/cache/infinispan" purge="true">
<write-behind thread-pool-size="5" />
</file-store>
</persistence>
{code}
however this does not help as storage is first read and then purged (see also
ISPN-7186).
It is expected that {{SingleFileStore}} either does not allow to write such big entries
to the cache, or handles them correctly.