[ https://issues.apache.org/jira/browse/HIVE-21752?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16843112#comment-16843112 ]
Hive QA commented on HIVE-21752: -------------------------------- | (x) *{color:red}-1 overall{color}* | \\ \\ || Vote || Subsystem || Runtime || Comment || || || || || {color:brown} Prechecks {color} || | {color:green}+1{color} | {color:green} @author {color} | {color:green} 0m 0s{color} | {color:green} The patch does not contain any @author tags. {color} | || || || || {color:brown} master Compile Tests {color} || | {color:green}+1{color} | {color:green} mvninstall {color} | {color:green} 8m 35s{color} | {color:green} master passed {color} | | {color:green}+1{color} | {color:green} compile {color} | {color:green} 0m 24s{color} | {color:green} master passed {color} | | {color:green}+1{color} | {color:green} checkstyle {color} | {color:green} 0m 12s{color} | {color:green} master passed {color} | | {color:blue}0{color} | {color:blue} findbugs {color} | {color:blue} 0m 38s{color} | {color:blue} hcatalog/core in master has 28 extant Findbugs warnings. {color} | | {color:green}+1{color} | {color:green} javadoc {color} | {color:green} 0m 14s{color} | {color:green} master passed {color} | || || || || {color:brown} Patch Compile Tests {color} || | {color:green}+1{color} | {color:green} mvninstall {color} | {color:green} 0m 23s{color} | {color:green} the patch passed {color} | | {color:green}+1{color} | {color:green} compile {color} | {color:green} 0m 22s{color} | {color:green} the patch passed {color} | | {color:green}+1{color} | {color:green} javac {color} | {color:green} 0m 22s{color} | {color:green} the patch passed {color} | | {color:red}-1{color} | {color:red} checkstyle {color} | {color:red} 0m 12s{color} | {color:red} hcatalog/core: The patch generated 3 new + 10 unchanged - 4 fixed = 13 total (was 14) {color} | | {color:green}+1{color} | {color:green} whitespace {color} | {color:green} 0m 0s{color} | {color:green} The patch has no whitespace issues. {color} | | {color:red}-1{color} | {color:red} findbugs {color} | {color:red} 0m 47s{color} | {color:red} hcatalog/core generated 1 new + 28 unchanged - 0 fixed = 29 total (was 28) {color} | | {color:green}+1{color} | {color:green} javadoc {color} | {color:green} 0m 14s{color} | {color:green} the patch passed {color} | || || || || {color:brown} Other Tests {color} || | {color:green}+1{color} | {color:green} asflicense {color} | {color:green} 0m 14s{color} | {color:green} The patch does not generate ASF License warnings. {color} | | {color:black}{color} | {color:black} {color} | {color:black} 12m 40s{color} | {color:black} {color} | \\ \\ || Reason || Tests || | FindBugs | module:hcatalog/core | | | Null passed for non-null parameter of java.util.concurrent.ConcurrentMap.put(Object, Object) in org.apache.hive.hcatalog.data.HCatRecordObjectInspectorFactory.getStandardObjectInspectorFromTypeInfo(TypeInfo) Method invoked at HCatRecordObjectInspectorFactory.java:of java.util.concurrent.ConcurrentMap.put(Object, Object) in org.apache.hive.hcatalog.data.HCatRecordObjectInspectorFactory.getStandardObjectInspectorFromTypeInfo(TypeInfo) Method invoked at HCatRecordObjectInspectorFactory.java:[line 137] | \\ \\ || Subsystem || Report/Notes || | Optional Tests | asflicense javac javadoc findbugs checkstyle compile | | uname | Linux hiveptest-server-upstream 3.16.0-4-amd64 #1 SMP Debian 3.16.43-2+deb8u5 (2017-09-19) x86_64 GNU/Linux | | Build tool | maven | | Personality | /data/hiveptest/working/yetus_PreCommit-HIVE-Build-17247/dev-support/hive-personality.sh | | git revision | master / 9a10bc2 | | Default Java | 1.8.0_111 | | findbugs | v3.0.0 | | checkstyle | http://104.198.109.242/logs//PreCommit-HIVE-Build-17247/yetus/diff-checkstyle-hcatalog_core.txt | | findbugs | http://104.198.109.242/logs//PreCommit-HIVE-Build-17247/yetus/new-findbugs-hcatalog_core.html | | modules | C: hcatalog/core U: hcatalog/core | | Console output | http://104.198.109.242/logs//PreCommit-HIVE-Build-17247/yetus.txt | | Powered by | Apache Yetus http://yetus.apache.org | This message was automatically generated. > Thread Safety and Memory Leaks in HCatRecordObjectInspectorFactory > ------------------------------------------------------------------ > > Key: HIVE-21752 > URL: https://issues.apache.org/jira/browse/HIVE-21752 > Project: Hive > Issue Type: Bug > Components: HCatalog > Reporter: Jalpan Randeri > Assignee: Jalpan Randeri > Priority: Minor > Labels: newbie, patch > Attachments: HIVE-21752.patch, HIVE-21752.patch > > Original Estimate: 24h > Remaining Estimate: 24h > > h3. Summary > There are a couple of issues in HCatRecordObjectInspectorFactory[1] because > it uses a static Java HashMap to cache objects: > # Java HashMap is not thread safe. This can lead to data corruptions and > race conditions in multithreaded servers when two threads update the > ObjectInspector. > # There is no eviction policy and as a result, this can result in memory > leaks. If user reads a lot of different schemas, Hive server will start > seeing memory pressure, once it start going to have a lot of cached record > and object inspectors. > This patch propose to replace the cache using a Guava cache which enables > cache evictions and thread safety. Guava cache is already used in Hive > ObjectInspectorFactory [2], so this change is consistent with the rest of > Hive. > Attached is a patch that fixes this issue. > h3. References: > # > [https://github.com/apache/hive/blob/b58d50cb73a1f79a5d079e0a2c5ac33d2efc33a0/hcatalog/core/src/main/java/org/apache/hive/hcatalog/data/HCatRecordObjectInspectorFactory.java#L44-L47] > # > [https://github.com/apache/hive/blob/b58d50cb73a1f79a5d079e0a2c5ac33d2efc33a0/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ObjectInspectorFactory.java#L68-L87] > > h4. Review Board Link: > * [https://reviews.apache.org/r/70674/] -- This message was sent by Atlassian JIRA (v7.6.3#76005)