You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@turbine.apache.org by "Georg Kallidis (Jira)" <ji...@apache.org> on 2021/05/05 15:02:00 UTC

[jira] [Commented] (TRB-101) Object leak in IntakeTool

    [ https://issues.apache.org/jira/browse/TRB-101?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17339700#comment-17339700 ] 

Georg Kallidis commented on TRB-101:
------------------------------------

Usage of commons-pool2 is integrated in fulcrum-parser v2.0.1, which is used in fulcrum-intake v2.0.0 or newer.

Unfortunately this requires at least Servlet-3, which is only used in Turbine v5.

As an example, you might then be able to configure the parser with an element *pool2 *in the parser Element in componentConfig.xml.

You might check further changes in fulcrum-intake [here|http://svn.apache.org/viewvc/turbine/fulcrum/tags/fulcrum-intake-2.0.0/src/changes/changes.xml?view=markup].
{code:java}
<parser>
         <parameterEncoding>utf-8</parameterEncoding>
         <automaticUpload>true</automaticUpload>
        <pool2>
                <!--  cft. defaults in org.apache.commons.pool2.impl.BaseObjectPoolConfig and GenericKeyedObjectPoolConfig -->
		<maxTotal>2048</maxTotal>
		<blockWhenExhausted>false</blockWhenExhausted>
		<maxWaitMillis>100</maxWaitMillis>
	</pool2>
</parser>
{code}
 
 Are you able to control the commons-pool2 configuration parameters? Might be that you could set commons-pool2 parameters in your workaround? See for example in the new version of [DefaultParserService|http://svn.apache.org/viewvc/turbine/fulcrum/tags/fulcrum-parser-2.0.1/src/java/org/apache/fulcrum/parser/DefaultParserService.java?view=markup#l462].

> Object leak in IntakeTool
> -------------------------
>
>                 Key: TRB-101
>                 URL: https://issues.apache.org/jira/browse/TRB-101
>             Project: Turbine
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: Core 4.0 Final, Core 5.0
>         Environment: Linux
>            Reporter: Susi Berrington
>            Priority: Major
>
> We're trying to upgrade to Turbine4.0 and are finding that everything works fine for a while but then seizes up (blocks).
> Turns out that there's an object leak in the init() method in IntakeTool.
> [http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/services/intake/IntakeTool.java?revision=1886259&view=markup#l134]
> {code:java}
> List<Group> foundGroups = intakeService.getGroup(groupNames[i])
>                     .getObjects(pp);{code}
> getGroup() is doing borrowObject() on a commons-pool2 pool but when we do getObjects() our reference to the object borrowed by getGroup() is lost, we can never release the borrowed object.
> I couldn't believe that this was new to 4.0 so I reverted to 2.3.3.  This code is the same but the object pool is 1.5.6 and the limit is not enforced so we get away with the number of objects just going up and up.
> A fix could be:
> {code:java}
> for (int i = groupNames.length - 1; i >= 0; i--)
> {
>     Group foundGroup = null;
>     try
>     {
>         foundGroup = intakeService.getGroup(groupNames[i]);
>         List<Group> foundGroups = foundGroup.getObjects(pp);
>         if (foundGroups != null)
>         {
>             for (Group group : foundGroups)
>             {
>                 groups.put(group.getObjectKey(), group);
>             }
>         }
>     }
>     catch (IntakeException e)
>     {
>         log.error(e);
>     } finally {
>         if (foundGroup != null)
>         {
>             try
>             {
>                 intakeService.releaseGroup(foundGroup);
>             } catch (IntakeException intakeException) {
>                 log.error(intakeException, intakeException);
>             }
>         }   
>     }
>  }
> {code}
>  
> I'm trying to find a way to hack round this. I've created a class which extends IntakeTool and just implements the init() method but I can't initialise pullMap so whenever we tried to actually use Intake we get a NullPointerException as pullMap is still null but is assumed to be initialised, which is fair enough! Can think of a better work around?



--
This message was sent by Atlassian Jira
(v8.3.4#803005)