You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Yongxing Wang (JIRA)" <ji...@apache.org> on 2009/05/27 19:01:45 UTC

[jira] Created: (DIRMINA-716) Get rid of "finalize" method in AbstractIoFilterChain.java

Get rid of "finalize" method in AbstractIoFilterChain.java
----------------------------------------------------------

                 Key: DIRMINA-716
                 URL: https://issues.apache.org/jira/browse/DIRMINA-716
             Project: MINA
          Issue Type: Bug
          Components: Core
    Affects Versions: 2.0.0-M5
            Reporter: Yongxing Wang


The finalize method in AbstractIoFilterChain.java can possibly cause OOM error when the system is under very heavy load. The negative impact of "finalize" method can be found at:

http://www.fasterj.com/articles/finalizer1.shtml


AbstractIoFilterChain holds a reference to Session object which can hold a list of unwritten data. The deterministic run of Finalizer can very well cause memory not fred up on time under heavy load. And it can certainly cause very bad memory usage pattern and contribute to the overall heavy system load.



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DIRMINA-716) Get rid of "finalize" method in AbstractIoFilterChain.java

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

Emmanuel Lecharny updated DIRMINA-716:
--------------------------------------

    Fix Version/s: 2.0.0-M7

> Get rid of "finalize" method in AbstractIoFilterChain.java
> ----------------------------------------------------------
>
>                 Key: DIRMINA-716
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-716
>             Project: MINA
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0.0-M5
>            Reporter: Yongxing Wang
>            Assignee: Emmanuel Lecharny
>             Fix For: 2.0.0-M7
>
>
> The finalize method in AbstractIoFilterChain.java can possibly cause OOM error when the system is under very heavy load. The negative impact of "finalize" method can be found at:
> http://www.fasterj.com/articles/finalizer1.shtml
> AbstractIoFilterChain holds a reference to Session object which can hold a list of unwritten data. The deterministic run of Finalizer can very well cause memory not fred up on time under heavy load. And it can certainly cause very bad memory usage pattern and contribute to the overall heavy system load.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (DIRMINA-716) Get rid of "finalize" method in AbstractIoFilterChain.java

Posted by "Edouard De Oliveira (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRMINA-716?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Edouard De Oliveira reassigned DIRMINA-716:
-------------------------------------------

    Assignee: Edouard De Oliveira  (was: Emmanuel Lecharny)

> Get rid of "finalize" method in AbstractIoFilterChain.java
> ----------------------------------------------------------
>
>                 Key: DIRMINA-716
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-716
>             Project: MINA
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0.0-M5
>            Reporter: Yongxing Wang
>            Assignee: Edouard De Oliveira
>             Fix For: 2.0.0-M7
>
>
> The finalize method in AbstractIoFilterChain.java can possibly cause OOM error when the system is under very heavy load. The negative impact of "finalize" method can be found at:
> http://www.fasterj.com/articles/finalizer1.shtml
> AbstractIoFilterChain holds a reference to Session object which can hold a list of unwritten data. The deterministic run of Finalizer can very well cause memory not fred up on time under heavy load. And it can certainly cause very bad memory usage pattern and contribute to the overall heavy system load.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DIRMINA-716) Get rid of "finalize" method in AbstractIoFilterChain.java

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-716?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12715435#action_12715435 ] 

Emmanuel Lecharny commented on DIRMINA-716:
-------------------------------------------

Edouard, have you tested the tool on MINA ?

That would be very interesting !

> Get rid of "finalize" method in AbstractIoFilterChain.java
> ----------------------------------------------------------
>
>                 Key: DIRMINA-716
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-716
>             Project: MINA
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0.0-M5
>            Reporter: Yongxing Wang
>            Assignee: Emmanuel Lecharny
>
> The finalize method in AbstractIoFilterChain.java can possibly cause OOM error when the system is under very heavy load. The negative impact of "finalize" method can be found at:
> http://www.fasterj.com/articles/finalizer1.shtml
> AbstractIoFilterChain holds a reference to Session object which can hold a list of unwritten data. The deterministic run of Finalizer can very well cause memory not fred up on time under heavy load. And it can certainly cause very bad memory usage pattern and contribute to the overall heavy system load.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (DIRMINA-716) Get rid of "finalize" method in AbstractIoFilterChain.java

Posted by "Edouard De Oliveira (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRMINA-716?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Edouard De Oliveira resolved DIRMINA-716.
-----------------------------------------

    Resolution: Fixed

> Get rid of "finalize" method in AbstractIoFilterChain.java
> ----------------------------------------------------------
>
>                 Key: DIRMINA-716
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-716
>             Project: MINA
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0.0-M5
>            Reporter: Yongxing Wang
>            Assignee: Edouard De Oliveira
>             Fix For: 2.0.0-M7
>
>
> The finalize method in AbstractIoFilterChain.java can possibly cause OOM error when the system is under very heavy load. The negative impact of "finalize" method can be found at:
> http://www.fasterj.com/articles/finalizer1.shtml
> AbstractIoFilterChain holds a reference to Session object which can hold a list of unwritten data. The deterministic run of Finalizer can very well cause memory not fred up on time under heavy load. And it can certainly cause very bad memory usage pattern and contribute to the overall heavy system load.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (DIRMINA-716) Get rid of "finalize" method in AbstractIoFilterChain.java

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

Emmanuel Lecharny reassigned DIRMINA-716:
-----------------------------------------

    Assignee: Emmanuel Lecharny

> Get rid of "finalize" method in AbstractIoFilterChain.java
> ----------------------------------------------------------
>
>                 Key: DIRMINA-716
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-716
>             Project: MINA
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0.0-M5
>            Reporter: Yongxing Wang
>            Assignee: Emmanuel Lecharny
>
> The finalize method in AbstractIoFilterChain.java can possibly cause OOM error when the system is under very heavy load. The negative impact of "finalize" method can be found at:
> http://www.fasterj.com/articles/finalizer1.shtml
> AbstractIoFilterChain holds a reference to Session object which can hold a list of unwritten data. The deterministic run of Finalizer can very well cause memory not fred up on time under heavy load. And it can certainly cause very bad memory usage pattern and contribute to the overall heavy system load.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DIRMINA-716) Get rid of "finalize" method in AbstractIoFilterChain.java

Posted by "Edouard De Oliveira (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-716?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12718669#action_12718669 ] 

Edouard De Oliveira commented on DIRMINA-716:
---------------------------------------------

Yes i tested. In our case the negative impact isn't as bad but after digging down the code i think i can conclude that the finalize method is useless as the method clear() will always be called when session is closed so i patched the file and removed it

> Get rid of "finalize" method in AbstractIoFilterChain.java
> ----------------------------------------------------------
>
>                 Key: DIRMINA-716
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-716
>             Project: MINA
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0.0-M5
>            Reporter: Yongxing Wang
>            Assignee: Edouard De Oliveira
>             Fix For: 2.0.0-M7
>
>
> The finalize method in AbstractIoFilterChain.java can possibly cause OOM error when the system is under very heavy load. The negative impact of "finalize" method can be found at:
> http://www.fasterj.com/articles/finalizer1.shtml
> AbstractIoFilterChain holds a reference to Session object which can hold a list of unwritten data. The deterministic run of Finalizer can very well cause memory not fred up on time under heavy load. And it can certainly cause very bad memory usage pattern and contribute to the overall heavy system load.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DIRMINA-716) Get rid of "finalize" method in AbstractIoFilterChain.java

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-716?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12715419#action_12715419 ] 

Emmanuel Lecharny commented on DIRMINA-716:
-------------------------------------------

The key is that this finalizer is used to remove the chain's element from the chain, when the session is closed. However, the session closure generates an event which is propagated though the chain.

We have to clear the chain when the sessionClosed event has been processed, and not in the finlize() method.

Alos this is something I question : why should we copy the chain for every new session, as if the chain could change ? I mean, if we can change the chain dynamically (which is good) for a specific session, I guess that the best would be to copy the chain when this modification occurs, not when the session is created, no ?

> Get rid of "finalize" method in AbstractIoFilterChain.java
> ----------------------------------------------------------
>
>                 Key: DIRMINA-716
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-716
>             Project: MINA
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0.0-M5
>            Reporter: Yongxing Wang
>            Assignee: Emmanuel Lecharny
>
> The finalize method in AbstractIoFilterChain.java can possibly cause OOM error when the system is under very heavy load. The negative impact of "finalize" method can be found at:
> http://www.fasterj.com/articles/finalizer1.shtml
> AbstractIoFilterChain holds a reference to Session object which can hold a list of unwritten data. The deterministic run of Finalizer can very well cause memory not fred up on time under heavy load. And it can certainly cause very bad memory usage pattern and contribute to the overall heavy system load.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DIRMINA-716) Get rid of "finalize" method in AbstractIoFilterChain.java

Posted by "Edouard De Oliveira (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-716?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12715432#action_12715432 ] 

Edouard De Oliveira commented on DIRMINA-716:
---------------------------------------------

The finalize() catch is a good one i tried to see it for myself and i confirm the poor memory management it causes (you can look at http://tedorgwp.free.fr/?p=450 which contains graphs of the generated heap load).

I do also fully agree with the copy on change method as i think it only happens in specific implementations. Other implementations will gain some additionnal free memory from this tweak.

> Get rid of "finalize" method in AbstractIoFilterChain.java
> ----------------------------------------------------------
>
>                 Key: DIRMINA-716
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-716
>             Project: MINA
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0.0-M5
>            Reporter: Yongxing Wang
>            Assignee: Emmanuel Lecharny
>
> The finalize method in AbstractIoFilterChain.java can possibly cause OOM error when the system is under very heavy load. The negative impact of "finalize" method can be found at:
> http://www.fasterj.com/articles/finalizer1.shtml
> AbstractIoFilterChain holds a reference to Session object which can hold a list of unwritten data. The deterministic run of Finalizer can very well cause memory not fred up on time under heavy load. And it can certainly cause very bad memory usage pattern and contribute to the overall heavy system load.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (DIRMINA-716) Get rid of "finalize" method in AbstractIoFilterChain.java

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

Emmanuel Lecharny closed DIRMINA-716.
-------------------------------------


> Get rid of "finalize" method in AbstractIoFilterChain.java
> ----------------------------------------------------------
>
>                 Key: DIRMINA-716
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-716
>             Project: MINA
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0.0-M5
>            Reporter: Yongxing Wang
>            Assignee: Edouard De Oliveira
>             Fix For: 2.0.0-RC1
>
>
> The finalize method in AbstractIoFilterChain.java can possibly cause OOM error when the system is under very heavy load. The negative impact of "finalize" method can be found at:
> http://www.fasterj.com/articles/finalizer1.shtml
> AbstractIoFilterChain holds a reference to Session object which can hold a list of unwritten data. The deterministic run of Finalizer can very well cause memory not fred up on time under heavy load. And it can certainly cause very bad memory usage pattern and contribute to the overall heavy system load.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.