You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Erik-Berndt Scheper (JIRA)" <ji...@apache.org> on 2008/12/03 11:39:44 UTC

[jira] Created: (AXIS2-4163) ServiceClient - finalize() method calls super.finalize() too early

ServiceClient - finalize() method calls super.finalize() too early
------------------------------------------------------------------

                 Key: AXIS2-4163
                 URL: https://issues.apache.org/jira/browse/AXIS2-4163
             Project: Axis 2.0 (Axis2)
          Issue Type: Bug
          Components: client-api
    Affects Versions: 1.4.1
            Reporter: Erik-Berndt Scheper
         Attachments: stacktrace.txt

The finalize() method in ServiceClient.java incorrectly calls super.finalize() before cleaning up:

    protected void finalize() throws Throwable {
        super.finalize();
        cleanup();
    }

This leads to EJBClassLoader errors in GlassFish when the garbage collector runs. To fix this, it should be changed to:

// Manual finalizer chaining
@Override protected void finalize() throws Throwable {
    try {
        // Finalize subclass state
        cleanup();
    } finally {
        super.finalize();
    }
}

See attached stack trace for details.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Commented: (AXIS2-4163) ServiceClient - finalize() method calls super.finalize() too early

Posted by "Erik-Berndt Scheper (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-4163?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12652750#action_12652750 ] 

Erik-Berndt Scheper commented on AXIS2-4163:
--------------------------------------------

The same bug plagues

* org.apache.axis2.client.tub.java
* org.apache.axis2.context.SessionContext.java
* org.apache.axis2.saaj.util.SAAJDataSource.java


> ServiceClient - finalize() method calls super.finalize() too early
> ------------------------------------------------------------------
>
>                 Key: AXIS2-4163
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4163
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: client-api
>    Affects Versions: 1.4.1
>            Reporter: Erik-Berndt Scheper
>         Attachments: stacktrace.txt
>
>
> The finalize() method in ServiceClient.java incorrectly calls super.finalize() before cleaning up:
>     protected void finalize() throws Throwable {
>         super.finalize();
>         cleanup();
>     }
> This leads to EJBClassLoader errors in GlassFish when the garbage collector runs. To fix this, it should be changed to:
> // Manual finalizer chaining
> @Override protected void finalize() throws Throwable {
>     try {
>         // Finalize subclass state
>         cleanup();
>     } finally {
>         super.finalize();
>     }
> }
> See attached stack trace for details.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Resolved: (AXIS2-4163) ServiceClient - finalize() method calls super.finalize() too early

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

Glen Daniels resolved AXIS2-4163.
---------------------------------

       Resolution: Fixed
    Fix Version/s: 1.5.1
                   1.6

Fixed on 1.5 branch and trunk.

> ServiceClient - finalize() method calls super.finalize() too early
> ------------------------------------------------------------------
>
>                 Key: AXIS2-4163
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4163
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: client-api
>    Affects Versions: 1.4.1
>            Reporter: Erik-Berndt Scheper
>             Fix For: 1.6, 1.5.1
>
>         Attachments: stacktrace.txt
>
>
> The finalize() method in ServiceClient.java incorrectly calls super.finalize() before cleaning up:
>     protected void finalize() throws Throwable {
>         super.finalize();
>         cleanup();
>     }
> This leads to EJBClassLoader errors in GlassFish when the garbage collector runs. To fix this, it should be changed to:
> // Manual finalizer chaining
> @Override protected void finalize() throws Throwable {
>     try {
>         // Finalize subclass state
>         cleanup();
>     } finally {
>         super.finalize();
>     }
> }
> See attached stack trace for details.

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


[jira] Commented: (AXIS2-4163) ServiceClient - finalize() method calls super.finalize() too early

Posted by "Deepal Jayasinghe (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-4163?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12660097#action_12660097 ] 

Deepal Jayasinghe commented on AXIS2-4163:
------------------------------------------

it would be great if you can send us a patch, just make the changes and attach a patch :)

Deepal

> ServiceClient - finalize() method calls super.finalize() too early
> ------------------------------------------------------------------
>
>                 Key: AXIS2-4163
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4163
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: client-api
>    Affects Versions: 1.4.1
>            Reporter: Erik-Berndt Scheper
>         Attachments: stacktrace.txt
>
>
> The finalize() method in ServiceClient.java incorrectly calls super.finalize() before cleaning up:
>     protected void finalize() throws Throwable {
>         super.finalize();
>         cleanup();
>     }
> This leads to EJBClassLoader errors in GlassFish when the garbage collector runs. To fix this, it should be changed to:
> // Manual finalizer chaining
> @Override protected void finalize() throws Throwable {
>     try {
>         // Finalize subclass state
>         cleanup();
>     } finally {
>         super.finalize();
>     }
> }
> See attached stack trace for details.

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


[jira] Issue Comment Edited: (AXIS2-4163) ServiceClient - finalize() method calls super.finalize() too early

Posted by "Erik-Berndt Scheper (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-4163?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12652735#action_12652735 ] 

fbascheper edited comment on AXIS2-4163 at 12/3/08 3:42 AM:
---------------------------------------------------------------------

cleanup() is called too late in the finalizer chain.

See also: https://www.securecoding.cert.org/confluence/display/java/OBJ02-J.+Avoid+using+finalizers

      was (Author: fbascheper):
    cleanup() is called too late in the finalizer chain
  
> ServiceClient - finalize() method calls super.finalize() too early
> ------------------------------------------------------------------
>
>                 Key: AXIS2-4163
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4163
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: client-api
>    Affects Versions: 1.4.1
>            Reporter: Erik-Berndt Scheper
>         Attachments: stacktrace.txt
>
>
> The finalize() method in ServiceClient.java incorrectly calls super.finalize() before cleaning up:
>     protected void finalize() throws Throwable {
>         super.finalize();
>         cleanup();
>     }
> This leads to EJBClassLoader errors in GlassFish when the garbage collector runs. To fix this, it should be changed to:
> // Manual finalizer chaining
> @Override protected void finalize() throws Throwable {
>     try {
>         // Finalize subclass state
>         cleanup();
>     } finally {
>         super.finalize();
>     }
> }
> See attached stack trace for details.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Updated: (AXIS2-4163) ServiceClient - finalize() method calls super.finalize() too early

Posted by "Erik-Berndt Scheper (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-4163?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Erik-Berndt Scheper updated AXIS2-4163:
---------------------------------------

    Attachment: stacktrace.txt

> ServiceClient - finalize() method calls super.finalize() too early
> ------------------------------------------------------------------
>
>                 Key: AXIS2-4163
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4163
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: client-api
>    Affects Versions: 1.4.1
>            Reporter: Erik-Berndt Scheper
>         Attachments: stacktrace.txt
>
>
> The finalize() method in ServiceClient.java incorrectly calls super.finalize() before cleaning up:
>     protected void finalize() throws Throwable {
>         super.finalize();
>         cleanup();
>     }
> This leads to EJBClassLoader errors in GlassFish when the garbage collector runs. To fix this, it should be changed to:
> // Manual finalizer chaining
> @Override protected void finalize() throws Throwable {
>     try {
>         // Finalize subclass state
>         cleanup();
>     } finally {
>         super.finalize();
>     }
> }
> See attached stack trace for details.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Issue Comment Edited: (AXIS2-4163) ServiceClient - finalize() method calls super.finalize() too early

Posted by "Erik-Berndt Scheper (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-4163?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12652750#action_12652750 ] 

fbascheper edited comment on AXIS2-4163 at 12/3/08 3:42 AM:
---------------------------------------------------------------------

The same bug plagues

* org.apache.axis2.client.Stub.java
* org.apache.axis2.context.SessionContext.java
* org.apache.axis2.saaj.util.SAAJDataSource.java


      was (Author: fbascheper):
    The same bug plagues

* org.apache.axis2.client.tub.java
* org.apache.axis2.context.SessionContext.java
* org.apache.axis2.saaj.util.SAAJDataSource.java

  
> ServiceClient - finalize() method calls super.finalize() too early
> ------------------------------------------------------------------
>
>                 Key: AXIS2-4163
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4163
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: client-api
>    Affects Versions: 1.4.1
>            Reporter: Erik-Berndt Scheper
>         Attachments: stacktrace.txt
>
>
> The finalize() method in ServiceClient.java incorrectly calls super.finalize() before cleaning up:
>     protected void finalize() throws Throwable {
>         super.finalize();
>         cleanup();
>     }
> This leads to EJBClassLoader errors in GlassFish when the garbage collector runs. To fix this, it should be changed to:
> // Manual finalizer chaining
> @Override protected void finalize() throws Throwable {
>     try {
>         // Finalize subclass state
>         cleanup();
>     } finally {
>         super.finalize();
>     }
> }
> See attached stack trace for details.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Commented: (AXIS2-4163) ServiceClient - finalize() method calls super.finalize() too early

Posted by "Torben Riis (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-4163?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12751896#action_12751896 ] 

Torben Riis commented on AXIS2-4163:
------------------------------------

Hi,

I think even this version of finalize is still not good enough. 
If you have a setup with a client invoking an asynchronous service, which starts a local server for "replyTo" calls, the call to cleanup in finalize triggers the local server to shutdown on GC.

In my case I had a ThreadPoolExecutor 200 ServiceClient requests, and of cause, before all jobs had been executed gc starts invoking finalize on finished jobs, which triggers the local replyTo server to shutdown...

My circumvention was to override finalize, but I still believe that it would be better if the default implementation was removed..

Regards
Torben Riis
Multi-Support A/S R&D

> ServiceClient - finalize() method calls super.finalize() too early
> ------------------------------------------------------------------
>
>                 Key: AXIS2-4163
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4163
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: client-api
>    Affects Versions: 1.4.1
>            Reporter: Erik-Berndt Scheper
>         Attachments: stacktrace.txt
>
>
> The finalize() method in ServiceClient.java incorrectly calls super.finalize() before cleaning up:
>     protected void finalize() throws Throwable {
>         super.finalize();
>         cleanup();
>     }
> This leads to EJBClassLoader errors in GlassFish when the garbage collector runs. To fix this, it should be changed to:
> // Manual finalizer chaining
> @Override protected void finalize() throws Throwable {
>     try {
>         // Finalize subclass state
>         cleanup();
>     } finally {
>         super.finalize();
>     }
> }
> See attached stack trace for details.

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