You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
During the investigation of what was initially suspected to be a non-termination bug in the url90b6689baa_adsonrocha_PD321_tgz-pJ8-MyFuzzyLiteClassJ8 project from the NJR dataset, it was discovered that the issue may actually be exponential growth in complexity rather than non-termination. This behavior occurs due to an unchecked accumulation of obligations to track across multiple control-flow paths when the bailout check MustCallConsistencyAnalyzer::shouldTrackInvocationResult is absent.
Execute the reproducing unit test tests/ainfer-resourceleak/non-annotated/FuzzyEngine.java within the ainfer-resourceleak test suite, noting the out-of-memory error that occurs without the proposed modifications, highlighting the unchecked growth in resource consumption.
Fix
The MustCallConsistencyAnalyzer has a bail-out check before tracking obligations using the shouldTrackInvocationResult method. The original method was designed primarily for MustCall consistency checks and did not accommodate the unique requirements of resource leak inference.
The original method does not track the invocation result in these cases:
Constructor Calls: Skips tracking for this() or super() constructor calls.
MustCallAlias Annotations: Omits tracking when the method’s return type is MustCallAlias and corresponds to an owning field.
Non-owning Return Types: Avoids tracking for methods annotated with NotOwning or methods that have no return type.
In this scenario, if obligations for the super(foo) call are not tracked, then the must-call inference cannot infer that the parameter Foo foo and the constructor are resource aliases. This failure results in the inability to infer the @MustCallAlias annotation correctly for the MCASuperCall, leading to potential resource management issues.
To rectify this, a new parameter isMustCallInference was added to the shouldTrackInvocationResult method. This parameter allows the method to adapt its behavior based on the context—skipping tracking where safe in general cases but enforcing it in resource leak scenarios to ensure accurate management of obligations.
Description
During the investigation of what was initially suspected to be a non-termination bug in the
url90b6689baa_adsonrocha_PD321_tgz-pJ8-MyFuzzyLiteClassJ8
project from the NJR dataset, it was discovered that the issue may actually be exponential growth in complexity rather than non-termination. This behavior occurs due to an unchecked accumulation of obligations to track across multiple control-flow paths when the bailout checkMustCallConsistencyAnalyzer::shouldTrackInvocationResult
is absent.Steps to Reproduce
url90b6689baa_adsonrocha_PD321_tgz-pJ8-MyFuzzyLiteClassJ8
project from the NJR dataset, wit h resourceleak inference enabled.Source: url90b6689baa_adsonrocha_PD321_tgz-pJ8-MyFuzzyLiteClassJ8.zip
tests/ainfer-resourceleak/non-annotated/FuzzyEngine.java
within theainfer-resourceleak
test suite, noting the out-of-memory error that occurs without the proposed modifications, highlighting the unchecked growth in resource consumption.Fix
The
MustCallConsistencyAnalyzer
has a bail-out check before tracking obligations using theshouldTrackInvocationResult
method. The original method was designed primarily for MustCall consistency checks and did not accommodate the unique requirements of resource leak inference.The original method does not track the invocation result in these cases:
this()
orsuper()
constructor calls.MustCallAlias
and corresponds to an owning field.NotOwning
or methods that have no return type.For example, consider the following code snippet:
In this scenario, if obligations for the
super(foo)
call are not tracked, then the must-call inference cannot infer that the parameterFoo foo
and the constructor are resource aliases. This failure results in the inability to infer the@MustCallAlias
annotation correctly for theMCASuperCall
, leading to potential resource management issues.To rectify this, a new parameter
isMustCallInference
was added to theshouldTrackInvocationResult
method. This parameter allows the method to adapt its behavior based on the context—skipping tracking where safe in general cases but enforcing it in resource leak scenarios to ensure accurate management of obligations.CF Invocation Environment
-processor org.checkerframework.checker.resourceleak.ResourceLeakChecker \ -Adetailedmsgtext \ -Aajava=$PROJECT_PATH/wpi-out \ -Ainfer=ajava \ -Awarns \ -AshowPrefixInWarningMessages \ -AdisableReturnsReceiver \
The text was updated successfully, but these errors were encountered: