You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@geode.apache.org by "Mario Salazar de Torres (Jira)" <ji...@apache.org> on 2021/02/25 15:42:00 UTC

[jira] [Updated] (GEODE-8973) Error handling might cause calls to be duplicated

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

Mario Salazar de Torres updated GEODE-8973:
-------------------------------------------
    Description: 
**When using throwExceptionIfError macro if any of its parameter is a call
 then such call could be duplicated and in the case of the error there are cases within ThinClientPoolDM that could lead to requests duplications and inconsistencies.
----
One from *ThinClientPoolDM::AddPdxType* example is 
{code:java}
throwExceptionIfError("Operation Failed", sendSyncRequest(request, reply));{code}

Thing is that the pre-processor just replaces expressions, so if one of the macro parameters is passed a function call, this is not executed prior to evaluating the macro, leading to potential duplicities.
This is one of the reasons why using macros are dis-recommended by C++ standard comittee and they should eventually be removed.
You can find here an illustrative example, in which, assembly shows the call is duplicated: https://godbolt.org/z/oc4hG9

  was:
**When using throwExceptionIfError macro if any of its parameter is a call
 then such call could be duplicated and in the case of the error there are cases within ThinClientPoolDM that could lead to requests duplications and inconsistencies.
----
One from *ThinClientPoolDM::AddPdxType* example is 
{code:java}
throwExceptionIfError("Operation Failed", sendSyncRequest(request, reply));{code}
This is one of the reasons why using macros are dis-recommended by C++ standard comittee and they should eventually be removed.


> Error handling might cause calls to be duplicated
> -------------------------------------------------
>
>                 Key: GEODE-8973
>                 URL: https://issues.apache.org/jira/browse/GEODE-8973
>             Project: Geode
>          Issue Type: Bug
>          Components: native client
>    Affects Versions: 1.14.0
>            Reporter: Mario Salazar de Torres
>            Priority: Major
>
> **When using throwExceptionIfError macro if any of its parameter is a call
>  then such call could be duplicated and in the case of the error there are cases within ThinClientPoolDM that could lead to requests duplications and inconsistencies.
> ----
> One from *ThinClientPoolDM::AddPdxType* example is 
> {code:java}
> throwExceptionIfError("Operation Failed", sendSyncRequest(request, reply));{code}
> Thing is that the pre-processor just replaces expressions, so if one of the macro parameters is passed a function call, this is not executed prior to evaluating the macro, leading to potential duplicities.
> This is one of the reasons why using macros are dis-recommended by C++ standard comittee and they should eventually be removed.
> You can find here an illustrative example, in which, assembly shows the call is duplicated: https://godbolt.org/z/oc4hG9



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