You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by "Chinna Rao Lalam (JIRA)" <ji...@apache.org> on 2011/02/04 14:58:29 UTC

[jira] Created: (HIVE-1959) Potential memory leak when same connection used for long time. TaskInfo and QueryInfo objects are getting accumulated on executing more queries on the same connection.

Potential memory leak when same connection used for long time. TaskInfo and QueryInfo objects are getting accumulated on executing more queries on the same connection.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------

                 Key: HIVE-1959
                 URL: https://issues.apache.org/jira/browse/HIVE-1959
             Project: Hive
          Issue Type: Bug
          Components: Server Infrastructure
    Affects Versions: 0.5.0
         Environment: Hadoop 0.20.1, Hive0.5.0 and SUSE Linux Enterprise Server 10 SP2 (i586) - Kernel 2.6.16.60-0.21-smp (5).
            Reporter: Chinna Rao Lalam
            Assignee: Chinna Rao Lalam


*org.apache.hadoop.hive.ql.history.HiveHistory$TaskInfo* and *org.apache.hadoop.hive.ql.history.HiveHistory$QueryInfo* these two objects are getting accumulated on executing more number of queries on the same connection. These objects are getting released only when the connection is closed.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (HIVE-1959) Potential memory leak when same connection used for long time. TaskInfo and QueryInfo objects are getting accumulated on executing more queries on the same connection.

Posted by "Ning Zhang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HIVE-1959?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13001085#comment-13001085 ] 

Ning Zhang commented on HIVE-1959:
----------------------------------

+1 on WeakHashMap. HiveHistory.endQuery() is called at the finally clause of Driver.execute(). There are some early exits (should be changed in my opinion. I will file another JIRA to fix this) in the loop of execute() which will bypass the finally clause. Using WeakHashMap can prevent leaks in this case.  

> Potential memory leak when same connection used for long time. TaskInfo and QueryInfo objects are getting accumulated on executing more queries on the same connection.
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HIVE-1959
>                 URL: https://issues.apache.org/jira/browse/HIVE-1959
>             Project: Hive
>          Issue Type: Bug
>          Components: Server Infrastructure
>    Affects Versions: 0.8.0
>         Environment: Hadoop 0.20.1, Hive0.5.0 and SUSE Linux Enterprise Server 10 SP2 (i586) - Kernel 2.6.16.60-0.21-smp (5).
>            Reporter: Chinna Rao Lalam
>            Assignee: Chinna Rao Lalam
>         Attachments: HIVE-1959.patch
>
>
> *org.apache.hadoop.hive.ql.history.HiveHistory$TaskInfo* and *org.apache.hadoop.hive.ql.history.HiveHistory$QueryInfo* these two objects are getting accumulated on executing more number of queries on the same connection. These objects are getting released only when the connection is closed.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (HIVE-1959) Potential memory leak when same connection used for long time. TaskInfo and QueryInfo objects are getting accumulated on executing more queries on the same connection.

Posted by "Chinna Rao Lalam (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HIVE-1959?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13002542#comment-13002542 ] 

Chinna Rao Lalam commented on HIVE-1959:
----------------------------------------

Thanks Ning Zhang & ಕರಿಯ  for the comments. 

If we use WeakHashMap when no one have the reference for the QueryInfo or TaskInfo objects other than weakhashmap if GC happens these objects will be garbage collected.

But in our case the QueryInfo or TaskInfo objects will be accessed in different stages like StartQuery ,setQueryProperty and  EndQuery etc.

For Ex some queries will execute more time (May be some hours), At the time of start query it will put the data in to weakhashmap after long time endQuery() is executed in between some times it will accesses the weakhashmap from the methods like 
setQueryProperty().

But by that time if GC triggered there is a chance to garbage collect these objects(QueryInfo & TaskInfo). This case we will lose the information of QueryInfo & TaskInfo objects. Here we don't have control, GC will have the control to remove the objects.

Using HashMap and removing objects from the map through code, this case we will have control.

@Ning Zhang : There are some early exits (should be changed in my opinion. I will file another JIRA to fix this) in the loop of execute() which will bypass the finally clause.
This case we have to change the implementation, present implementation is calling System.exit(9) it will exit from JVM. I will provide a patch for this issue.

> Potential memory leak when same connection used for long time. TaskInfo and QueryInfo objects are getting accumulated on executing more queries on the same connection.
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HIVE-1959
>                 URL: https://issues.apache.org/jira/browse/HIVE-1959
>             Project: Hive
>          Issue Type: Bug
>          Components: Server Infrastructure
>    Affects Versions: 0.8.0
>         Environment: Hadoop 0.20.1, Hive0.5.0 and SUSE Linux Enterprise Server 10 SP2 (i586) - Kernel 2.6.16.60-0.21-smp (5).
>            Reporter: Chinna Rao Lalam
>            Assignee: Chinna Rao Lalam
>         Attachments: HIVE-1959.patch
>
>
> *org.apache.hadoop.hive.ql.history.HiveHistory$TaskInfo* and *org.apache.hadoop.hive.ql.history.HiveHistory$QueryInfo* these two objects are getting accumulated on executing more number of queries on the same connection. These objects are getting released only when the connection is closed.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] Updated: (HIVE-1959) Potential memory leak when same connection used for long time. TaskInfo and QueryInfo objects are getting accumulated on executing more queries on the same connection.

Posted by "Chinna Rao Lalam (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HIVE-1959?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Chinna Rao Lalam updated HIVE-1959:
-----------------------------------

    Affects Version/s:     (was: 0.5.0)
                       0.8.0
               Status: Patch Available  (was: Open)

> Potential memory leak when same connection used for long time. TaskInfo and QueryInfo objects are getting accumulated on executing more queries on the same connection.
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HIVE-1959
>                 URL: https://issues.apache.org/jira/browse/HIVE-1959
>             Project: Hive
>          Issue Type: Bug
>          Components: Server Infrastructure
>    Affects Versions: 0.8.0
>         Environment: Hadoop 0.20.1, Hive0.5.0 and SUSE Linux Enterprise Server 10 SP2 (i586) - Kernel 2.6.16.60-0.21-smp (5).
>            Reporter: Chinna Rao Lalam
>            Assignee: Chinna Rao Lalam
>         Attachments: HIVE-1959.patch
>
>
> *org.apache.hadoop.hive.ql.history.HiveHistory$TaskInfo* and *org.apache.hadoop.hive.ql.history.HiveHistory$QueryInfo* these two objects are getting accumulated on executing more number of queries on the same connection. These objects are getting released only when the connection is closed.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (HIVE-1959) Potential memory leak when same connection used for long time. TaskInfo and QueryInfo objects are getting accumulated on executing more queries on the same connection.

Posted by "Edward Capriolo (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HIVE-1959?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13007928#comment-13007928 ] 

Edward Capriolo commented on HIVE-1959:
---------------------------------------

While WeakHashMap may work logically it may not be our best option. If we only find one instance of a class in the entire code base I generally believe that is breaking some un-established internal coding standards and introducing a behaviour that is not in line with the rest of the systems. (A two mile view)

> Potential memory leak when same connection used for long time. TaskInfo and QueryInfo objects are getting accumulated on executing more queries on the same connection.
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HIVE-1959
>                 URL: https://issues.apache.org/jira/browse/HIVE-1959
>             Project: Hive
>          Issue Type: Bug
>          Components: Server Infrastructure
>    Affects Versions: 0.8.0
>         Environment: Hadoop 0.20.1, Hive0.5.0 and SUSE Linux Enterprise Server 10 SP2 (i586) - Kernel 2.6.16.60-0.21-smp (5).
>            Reporter: Chinna Rao Lalam
>            Assignee: Chinna Rao Lalam
>         Attachments: HIVE-1959.patch
>
>
> *org.apache.hadoop.hive.ql.history.HiveHistory$TaskInfo* and *org.apache.hadoop.hive.ql.history.HiveHistory$QueryInfo* these two objects are getting accumulated on executing more number of queries on the same connection. These objects are getting released only when the connection is closed.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Commented: (HIVE-1959) Potential memory leak when same connection used for long time. TaskInfo and QueryInfo objects are getting accumulated on executing more queries on the same connection.

Posted by "Chinna Rao Lalam (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HIVE-1959?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13000896#comment-13000896 ] 

Chinna Rao Lalam commented on HIVE-1959:
----------------------------------------

In startQuery() of HiveHistory.java  QueryInfo object  put in to  queryInfoMap and while executing the query QueryInfo object is used after getting from the queryInfoMap But this object is not removed from the map so these objects are keep on increasing in the map and resulted the memory leak. This object can be removed from the map in endQuery() of HiveHistory.java

Same thing is happening for TaskInfo objects also.
The TaskInfo objects can be removed from the map in endTask() of HiveHistory.java

> Potential memory leak when same connection used for long time. TaskInfo and QueryInfo objects are getting accumulated on executing more queries on the same connection.
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HIVE-1959
>                 URL: https://issues.apache.org/jira/browse/HIVE-1959
>             Project: Hive
>          Issue Type: Bug
>          Components: Server Infrastructure
>    Affects Versions: 0.5.0
>         Environment: Hadoop 0.20.1, Hive0.5.0 and SUSE Linux Enterprise Server 10 SP2 (i586) - Kernel 2.6.16.60-0.21-smp (5).
>            Reporter: Chinna Rao Lalam
>            Assignee: Chinna Rao Lalam
>         Attachments: HIVE-1959.patch
>
>
> *org.apache.hadoop.hive.ql.history.HiveHistory$TaskInfo* and *org.apache.hadoop.hive.ql.history.HiveHistory$QueryInfo* these two objects are getting accumulated on executing more number of queries on the same connection. These objects are getting released only when the connection is closed.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (HIVE-1959) Potential memory leak when same connection used for long time. TaskInfo and QueryInfo objects are getting accumulated on executing more queries on the same connection.

Posted by "Ning Zhang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HIVE-1959?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ning Zhang updated HIVE-1959:
-----------------------------

       Resolution: Fixed
    Fix Version/s: 0.8.0
     Hadoop Flags: [Reviewed]
           Status: Resolved  (was: Patch Available)

Comitted. Thanks Chinna!

> Potential memory leak when same connection used for long time. TaskInfo and QueryInfo objects are getting accumulated on executing more queries on the same connection.
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HIVE-1959
>                 URL: https://issues.apache.org/jira/browse/HIVE-1959
>             Project: Hive
>          Issue Type: Bug
>          Components: Server Infrastructure
>    Affects Versions: 0.8.0
>         Environment: Hadoop 0.20.1, Hive0.5.0 and SUSE Linux Enterprise Server 10 SP2 (i586) - Kernel 2.6.16.60-0.21-smp (5).
>            Reporter: Chinna Rao Lalam
>            Assignee: Chinna Rao Lalam
>             Fix For: 0.8.0
>
>         Attachments: HIVE-1959.patch
>
>
> *org.apache.hadoop.hive.ql.history.HiveHistory$TaskInfo* and *org.apache.hadoop.hive.ql.history.HiveHistory$QueryInfo* these two objects are getting accumulated on executing more number of queries on the same connection. These objects are getting released only when the connection is closed.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Commented: (HIVE-1959) Potential memory leak when same connection used for long time. TaskInfo and QueryInfo objects are getting accumulated on executing more queries on the same connection.

Posted by "Ning Zhang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HIVE-1959?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13007828#comment-13007828 ] 

Ning Zhang commented on HIVE-1959:
----------------------------------

Sorry Chinna, I must have missed your last comment. 

Yeah, I think it will work with the current patch. I will start testing and commit if it passes. 

> Potential memory leak when same connection used for long time. TaskInfo and QueryInfo objects are getting accumulated on executing more queries on the same connection.
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HIVE-1959
>                 URL: https://issues.apache.org/jira/browse/HIVE-1959
>             Project: Hive
>          Issue Type: Bug
>          Components: Server Infrastructure
>    Affects Versions: 0.8.0
>         Environment: Hadoop 0.20.1, Hive0.5.0 and SUSE Linux Enterprise Server 10 SP2 (i586) - Kernel 2.6.16.60-0.21-smp (5).
>            Reporter: Chinna Rao Lalam
>            Assignee: Chinna Rao Lalam
>         Attachments: HIVE-1959.patch
>
>
> *org.apache.hadoop.hive.ql.history.HiveHistory$TaskInfo* and *org.apache.hadoop.hive.ql.history.HiveHistory$QueryInfo* these two objects are getting accumulated on executing more number of queries on the same connection. These objects are getting released only when the connection is closed.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Commented: (HIVE-1959) Potential memory leak when same connection used for long time. TaskInfo and QueryInfo objects are getting accumulated on executing more queries on the same connection.

Posted by "MIS (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HIVE-1959?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13000970#comment-13000970 ] 

MIS commented on HIVE-1959:
---------------------------

How about using WeakHashMap in place of using HashMap instead of explicitly removing from the map! The WeakHashMap can be used for both the fields- queryInfoMap and taskInfoMap of HiveHistory.java class.

> Potential memory leak when same connection used for long time. TaskInfo and QueryInfo objects are getting accumulated on executing more queries on the same connection.
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HIVE-1959
>                 URL: https://issues.apache.org/jira/browse/HIVE-1959
>             Project: Hive
>          Issue Type: Bug
>          Components: Server Infrastructure
>    Affects Versions: 0.8.0
>         Environment: Hadoop 0.20.1, Hive0.5.0 and SUSE Linux Enterprise Server 10 SP2 (i586) - Kernel 2.6.16.60-0.21-smp (5).
>            Reporter: Chinna Rao Lalam
>            Assignee: Chinna Rao Lalam
>         Attachments: HIVE-1959.patch
>
>
> *org.apache.hadoop.hive.ql.history.HiveHistory$TaskInfo* and *org.apache.hadoop.hive.ql.history.HiveHistory$QueryInfo* these two objects are getting accumulated on executing more number of queries on the same connection. These objects are getting released only when the connection is closed.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (HIVE-1959) Potential memory leak when same connection used for long time. TaskInfo and QueryInfo objects are getting accumulated on executing more queries on the same connection.

Posted by "Chinna Rao Lalam (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HIVE-1959?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Chinna Rao Lalam updated HIVE-1959:
-----------------------------------

    Attachment: HIVE-1959.patch

> Potential memory leak when same connection used for long time. TaskInfo and QueryInfo objects are getting accumulated on executing more queries on the same connection.
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HIVE-1959
>                 URL: https://issues.apache.org/jira/browse/HIVE-1959
>             Project: Hive
>          Issue Type: Bug
>          Components: Server Infrastructure
>    Affects Versions: 0.5.0
>         Environment: Hadoop 0.20.1, Hive0.5.0 and SUSE Linux Enterprise Server 10 SP2 (i586) - Kernel 2.6.16.60-0.21-smp (5).
>            Reporter: Chinna Rao Lalam
>            Assignee: Chinna Rao Lalam
>         Attachments: HIVE-1959.patch
>
>
> *org.apache.hadoop.hive.ql.history.HiveHistory$TaskInfo* and *org.apache.hadoop.hive.ql.history.HiveHistory$QueryInfo* these two objects are getting accumulated on executing more number of queries on the same connection. These objects are getting released only when the connection is closed.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira