getBytesFromStream:237, SQLServerBlob (com.microsoft.sqlserver.jdbc)
fillFromStream:220, SQLServerBlob (com.microsoft.sqlserver.jdbc)
fillLOBs:5504, SQLServerResultSet (com.microsoft.sqlserver.jdbc)
wasNull:1069, SQLServerResultSet (com.microsoft.sqlserver.jdbc)
wasNull:-1, HikariProxyResultSet (com.zaxxer.hikari.pool)
extract:49, BasicExtractor (org.hibernate.type.descriptor.sql)
nullSafeGet:261, AbstractStandardBasicType (org.hibernate.type)
nullSafeGet:257, AbstractStandardBasicType (org.hibernate.type)
nullSafeGet:247, AbstractStandardBasicType (org.hibernate.type)
hydrate:333, AbstractStandardBasicType (org.hibernate.type)
hydrate:2868, AbstractEntityPersister (org.hibernate.persister.entity)
loadFromResultSet:1747, Loader (org.hibernate.loader)
instanceNotYetLoaded:1673, Loader (org.hibernate.loader)
getRow:1562, Loader (org.hibernate.loader)
getRowFromResultSet:732, Loader (org.hibernate.loader)
processResultSet:991, Loader (org.hibernate.loader)
doQuery:949, Loader (org.hibernate.loader)
doQueryAndInitializeNonLazyCollections:341, Loader (org.hibernate.loader)
doList:2692, Loader (org.hibernate.loader)
doList:2675, Loader (org.hibernate.loader)
listIgnoreQueryCache:2507, Loader (org.hibernate.loader)
list:2502, Loader (org.hibernate.loader)
list:502, QueryLoader (org.hibernate.loader.hql)
list:392, QueryTranslatorImpl (org.hibernate.hql.internal.ast)
performList:216, HQLQueryPlan (org.hibernate.engine.query.spi)
list:1490, SessionImpl (org.hibernate.internal)
doList:1445, AbstractProducedQuery (org.hibernate.query.internal)
list:1414, AbstractProducedQuery (org.hibernate.query.internal)
getSingleResult:1463, AbstractProducedQuery (org.hibernate.query.internal)
doExecute:214, JpaQueryExecution$SingleEntityExecution (org.springframework.data.jpa.repository.query)
execute:91, JpaQueryExecution (org.springframework.data.jpa.repository.query)
doExecute:136, AbstractJpaQuery (org.springframework.data.jpa.repository.query)
execute:125, AbstractJpaQuery (org.springframework.data.jpa.repository.query)
doInvoke:602, RepositoryFactorySupport$QueryExecutorMethodInterceptor (org.springframework.data.repository.core.support)
invoke:590, RepositoryFactorySupport$QueryExecutorMethodInterceptor (org.springframework.data.repository.core.support)
proceed:185, ReflectiveMethodInvocation (org.springframework.aop.framework)
invoke:59, DefaultMethodInvokingMethodInterceptor (org.springframework.data.projection)
proceed:185, ReflectiveMethodInvocation (org.springframework.aop.framework)
proceedWithInvocation:-1, 287362511 (org.springframework.transaction.interceptor.TransactionInterceptor$$Lambda$656)
invokeWithinTransaction:294, TransactionAspectSupport (org.springframework.transaction.interceptor)
invoke:98, TransactionInterceptor (org.springframework.transaction.interceptor)
proceed:185, ReflectiveMethodInvocation (org.springframework.aop.framework)
invoke:139, PersistenceExceptionTranslationInterceptor (org.springframework.dao.support)
proceed:185, ReflectiveMethodInvocation (org.springframework.aop.framework)
invoke:135, CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor (org.springframework.data.jpa.repository.support)
proceed:185, ReflectiveMethodInvocation (org.springframework.aop.framework)
invoke:92, ExposeInvocationInterceptor (org.springframework.aop.interceptor)
proceed:185, ReflectiveMethodInvocation (org.springframework.aop.framework)
invoke:61, SurroundingTransactionDetectorMethodInterceptor (org.springframework.data.repository.core.support)
proceed:185, ReflectiveMethodInvocation (org.springframework.aop.framework)
invoke:212, JdkDynamicAopProxy (org.springframework.aop.framework)
findByOriginatorRidAndGeneralIdAndVersion:-1, $Proxy106 (com.sun.proxy)
getData:50, DocumentStoreService (net.bolero.store.services)
invoke:-1, DocumentStoreService$$FastClassBySpringCGLIB$$d6bfba78 (net.bolero.store.services)
invoke:204, MethodProxy (org.springframework.cglib.proxy)
invokeJoinpoint:746, CglibAopProxy$CglibMethodInvocation (org.springframework.aop.framework)
proceed:163, ReflectiveMethodInvocation (org.springframework.aop.framework)
proceedWithInvocation:-1, 287362511 (org.springframework.transaction.interceptor.TransactionInterceptor$$Lambda$656)
invokeWithinTransaction:294, TransactionAspectSupport (org.springframework.transaction.interceptor)
invoke:98, TransactionInterceptor (org.springframework.transaction.interceptor)
proceed:185, ReflectiveMethodInvocation (org.springframework.aop.framework)
intercept:688, CglibAopProxy$DynamicAdvisedInterceptor (org.springframework.aop.framework)
getData:-1, DocumentStoreService$$EnhancerBySpringCGLIB$$123872d5 (net.bolero.store.services)
getDocumentBlob:49, DocumentStoreController (net.bolero.store.controllers)
Driver version
7.0.0.jre8
SQL Server version
Microsoft SQL Server 2012 (SP4-GDR) (KB4057116) - 11.0.7462.6 (X64)
Jan 5 2018 22:11:56
Copyright (c) Microsoft Corporation
Express Edition (64-bit) on Windows NT 6.3 (Build 14393: ) (Hypervisor)
Client Operating System
Fedora release 28 (Twenty Eight)
JAVA/JVM version
openjdk version "1.8.0_181"
OpenJDK Runtime Environment (build 1.8.0_181-b15)
OpenJDK 64-Bit Server VM (build 25.181-b15, mixed mode)
Problem description
Commit 48b9b85 introduced fillBlobs method call in wasNull method, which is broadly used in many places, specifically in BasicExtractor from Hibernate 5.2.17. This loads the blob into memory, which makes usage of it useless in case of large payloads.
Blob should not be loaded into memory during normal usage of blob.