You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "Steve Loughran (JIRA)" <ji...@apache.org> on 2017/09/08 17:31:01 UTC

[jira] [Updated] (HADOOP-14851) LambdaTestUtils.eventually() doesn't spin on Assertion failures

     [ https://issues.apache.org/jira/browse/HADOOP-14851?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Steve Loughran updated HADOOP-14851:
------------------------------------
    Attachment: HADOOP-14851-001.patch

Patch 001

# Errors are caught alongside Exception
# Except for VM errors: stack overflow, out of memory, etc: the things you can't recover from.
# On timeout of eventually/await the caught exception/error is rethrown
# to avoid changing the signature of await and eventually (needed to keep them invocable in a Callable<> clause), the Throwable is cast up to Exception/Error before raise
# And {{TimeoutHandler}} has had its args/return value widened to Throwable. That would be incompatible, but its not in use anywhere in the code.

Tests: lots

> LambdaTestUtils.eventually() doesn't spin on Assertion failures
> ---------------------------------------------------------------
>
>                 Key: HADOOP-14851
>                 URL: https://issues.apache.org/jira/browse/HADOOP-14851
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: test
>    Affects Versions: 2.8.1
>            Reporter: Steve Loughran
>            Assignee: Steve Loughran
>         Attachments: HADOOP-14851-001.patch
>
>
> This is funny. The {{LsmbdaTestUtils.eventually()}} method, meant to spin until a closure stops raising exceptions, doesn't catch {{Error}} and subclasses, so doesn't fail on an {{Assert.assert()}} failure, which raises an {{AssertionError}}. My bad :)
> Example:
> {code}
>     eventually(TIMEOUT,
>         () -> {
>           while (counter.incrementAndGet()  < 5) {
>             assert false : "oops";
>           }
>         },
>         retryLogic);
> {code}
> Fix: catch Throwable, rethrow. Needs to add VirtualMachineError & subclasses to the set of errors not to spin on (OOM, stack overflow, ...)



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org