Details

    • Type: Bug
    • Status: Patch Available
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: c client
    • Labels:
      None

      Description

      when default branch is executed in switch(op->type) , alloced memory for oa variable will leak, so, close_buffer_oarchive(&oa, 1); should be called before returning in default branch.

        Activity

        Hide
        guoxiang guoxiang niu added a comment -

        int zoo_amulti(zhandle_t *zh, int count, const zoo_op_t *ops,
        zoo_op_result_t *results, void_completion_t completion, const void *data)
        ......
        default:
        close_buffer_oarchive(&oa, 1);
        LOG_ERROR(("Unimplemented sub-op type=%d in multi-op", op->type));
        return ZUNIMPLEMENTED;
        ......

        Show
        guoxiang guoxiang niu added a comment - int zoo_amulti(zhandle_t *zh, int count, const zoo_op_t *ops, zoo_op_result_t *results, void_completion_t completion, const void *data) ...... default: close_buffer_oarchive(&oa, 1); LOG_ERROR(("Unimplemented sub-op type=%d in multi-op", op->type)); return ZUNIMPLEMENTED; ......
        Hide
        hanm Michael Han added a comment -

        guoxiang niu Please follow the steps on the How to Contribute page to create a pull request for your patch. Similar for ZOOKEEPER-2883.

        Show
        hanm Michael Han added a comment - guoxiang niu Please follow the steps on the How to Contribute page to create a pull request for your patch. Similar for ZOOKEEPER-2883 .
        Hide
        guoxiang guoxiang niu added a comment - - edited

        i just added close_buffer_oarchive(&oa, 1); statement after default: statement in zoo_amulti(), when i executed ant test on windows 10 OS, it showed following failed message:

        BUILD FAILED
        \zookeeper\zookeeper\build.xml:1339: The following error occurred while executing this line:
        \zookeeper\zookeeper\build.xml:1220: The following error occurred while executing this line:
        \zookeeper\zookeeper\build.xml:1224: Tests failed!

        Total time: 551 minutes 16 seconds

        how to solve it?

        Show
        guoxiang guoxiang niu added a comment - - edited i just added close_buffer_oarchive(&oa, 1); statement after default: statement in zoo_amulti(), when i executed ant test on windows 10 OS, it showed following failed message: BUILD FAILED \zookeeper\zookeeper\build.xml:1339: The following error occurred while executing this line: \zookeeper\zookeeper\build.xml:1220: The following error occurred while executing this line: \zookeeper\zookeeper\build.xml:1224: Tests failed! Total time: 551 minutes 16 seconds how to solve it?
        Hide
        hanm Michael Han added a comment -

        Total time: 551 minutes 16 seconds

        It's the first time I've ever seen unit tests took this long

        The error message here indicates that some, if not all of the tests were failing. That is not cool, but usually OK as we have some flaky tests. Were you able to identify which tests were failing?

        Another suggestion is - since you are making change to C client, you can just run C tests and skip java tests. Something like:
        ant test-core-cppunit

        Show
        hanm Michael Han added a comment - Total time: 551 minutes 16 seconds It's the first time I've ever seen unit tests took this long The error message here indicates that some, if not all of the tests were failing. That is not cool, but usually OK as we have some flaky tests. Were you able to identify which tests were failing? Another suggestion is - since you are making change to C client, you can just run C tests and skip java tests. Something like: ant test-core-cppunit
        Hide
        guoxiang guoxiang niu added a comment -

        when i executed ant test-core-cppunit command, it showed me following error message:

        BUILD FAILED
        d:\niugx\work\zookeeper\zookeeper\build.xml:1298: The following error occurred while executing this line:
        d:\niugx\work\zookeeper\zookeeper\build.xml:1285: The following error occurred while executing this line:
        d:\niugx\work\zookeeper\zookeeper\build.xml:1277: Execute failed: java.io.IOException: Cannot run program "autoreconf" (in directory "d:\niugx\work\zookeeper\zookeeper\src\c"): CreateProcess error=2, 系统找不到指定的文件。
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
        at java.lang.Runtime.exec(Runtime.java:620)
        at org.apache.tools.ant.taskdefs.launcher.Java13CommandLauncher.exec(Java13CommandLauncher.java:58)
        at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:426)

        so, whether i need to do something (e.g. initialize or configure ) before executing ant test-core-cppunit?

        Show
        guoxiang guoxiang niu added a comment - when i executed ant test-core-cppunit command, it showed me following error message: BUILD FAILED d:\niugx\work\zookeeper\zookeeper\build.xml:1298: The following error occurred while executing this line: d:\niugx\work\zookeeper\zookeeper\build.xml:1285: The following error occurred while executing this line: d:\niugx\work\zookeeper\zookeeper\build.xml:1277: Execute failed: java.io.IOException: Cannot run program "autoreconf" (in directory "d:\niugx\work\zookeeper\zookeeper\src\c"): CreateProcess error=2, 系统找不到指定的文件。 at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048) at java.lang.Runtime.exec(Runtime.java:620) at org.apache.tools.ant.taskdefs.launcher.Java13CommandLauncher.exec(Java13CommandLauncher.java:58) at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:426) so, whether i need to do something (e.g. initialize or configure ) before executing ant test-core-cppunit?
        Hide
        guoxiang guoxiang niu added a comment - - edited

        when i executed ant test-core-cppunit command, it showed me following error message:

        BUILD FAILED
        \zookeeper\build.xml:1298: The following error occurred while executing this line:
        \zookeeper\build.xml:1285: The following error occurred while executing this line:
        \zookeeper\build.xml:1277: Execute failed: java.io.IOException: Cannot run program "autoreconf" (in directory "\zookeeper\src\c"): CreateProcess error=2, 系统找不到指定的文件。
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
        at java.lang.Runtime.exec(Runtime.java:620)
        at org.apache.tools.ant.taskdefs.launcher.Java13CommandLauncher.exec(Java13CommandLauncher.java:58)
        at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:426)

        so, whether i need to do something (e.g. initialize or configure ) before executing ant test-core-cppunit?

        Show
        guoxiang guoxiang niu added a comment - - edited when i executed ant test-core-cppunit command, it showed me following error message: BUILD FAILED \zookeeper\build.xml:1298: The following error occurred while executing this line: \zookeeper\build.xml:1285: The following error occurred while executing this line: \zookeeper\build.xml:1277: Execute failed: java.io.IOException: Cannot run program "autoreconf" (in directory "\zookeeper\src\c"): CreateProcess error=2, 系统找不到指定的文件。 at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048) at java.lang.Runtime.exec(Runtime.java:620) at org.apache.tools.ant.taskdefs.launcher.Java13CommandLauncher.exec(Java13CommandLauncher.java:58) at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:426) so, whether i need to do something (e.g. initialize or configure ) before executing ant test-core-cppunit?
        Hide
        hanm Michael Han added a comment -

        Looks like you did not have autoconf installed, which is required to run C client / unit tests. We don't have terribly good document on c client regarding set up dev env, but this link was what I followed and found useful: http://wiki.wsmoak.net/cgi-bin/wiki.pl?action=browse&diff=1&id=ZooKeeperBuild. If you are on other systems the steps should be similar....

        Show
        hanm Michael Han added a comment - Looks like you did not have autoconf installed, which is required to run C client / unit tests. We don't have terribly good document on c client regarding set up dev env, but this link was what I followed and found useful: http://wiki.wsmoak.net/cgi-bin/wiki.pl?action=browse&diff=1&id=ZooKeeperBuild . If you are on other systems the steps should be similar....

          People

          • Assignee:
            guoxiang guoxiang niu
            Reporter:
            guoxiang guoxiang niu
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:

              Development