axis-c-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Supun Kamburugamuva" <supu...@gmail.com>
Subject Re: Clean-up and Freeing (and nnexpected close-tags being created)
Date Mon, 08 Sep 2008 06:25:23 GMT
Hi Andy,

Thanks for finding this important bug in the axiom code. I've found the bug
and will correct it shortly. I've gone through your code and there are two
things that I like to point out in your code.

1. You are creating an empty node and passing it to the element_create
method. This leads to a memory leak. Correct code is:

  axiom_node_t *nodeA = NULL;
  axutil_string_t* nodeAString = axutil_string_create
(env,"getParameterValues");
  axiom_element_create_str(env, NULL, nodeAString, ns, &nodeA);

2. You are creating an empty namsespace. This also causes a memory leak. You
should pass NULL instead of this empty namespace.

axiom_element_create_str(env, nodeA, nodeBString, NULL, &nodeB);

Thanks,
Supun..

On Fri, Sep 5, 2008 at 11:30 PM, Dimuthu Gamage <dimuthuc@gmail.com> wrote:

> Hi,
> Looks like the axiom node created with axutil_string is having problem, I
> too got the same problem with your code, and I tried replacing
> axiom_element_create_str with axiom_element_create and it was working
> correctly.
>
>         axiom_node_t *nodeA = axiom_node_create(env);
>         /*axutil_string_t* nodeAString = axutil_string_create
> (env,"getParameterValues");   */
>         const axis2_char_t *nodeAString = "getParametervalues";
>         axiom_element_create(env, NULL, nodeAString, ns, &nodeA);
>         .....
>
> I think axutil_string or use of axutil_string inside axiom is having a bug.
> Can you please raise an issue on this at
> https://issues.apache.org/jira/browse/AXIS2C
>
> Thanks
> Dimuthu
>
>
>
>
> On Thu, Sep 4, 2008 at 7:13 PM, Andy Karseras <akarseras@gmail.com> wrote:
>
>> The following code illustrates the problem...
>>
>>     void myClient::testMethod()
>>     {
>>         const axis2_char_t *prefix = "cwmp";
>>         const axis2_char_t *uri = "urn:dslforum-org:cwmp-1-0";
>>
>>         axiom_namespace_t *ns = axiom_namespace_create(env, uri, prefix);
>>         axiom_namespace_t *empty_ns = axiom_namespace_create(env, uri,
>> "");
>>
>>         axiom_node_t *nodeA = axiom_node_create(env);
>>         axutil_string_t* nodeAString = axutil_string_create
>> (env,"getParameterValues");
>>         axiom_element_create_str(env, NULL, nodeAString, ns, &nodeA);
>>
>>         axiom_node_t *nodeB = axiom_node_create(env);
>>         axutil_string_t* nodeBString = axutil_string_create
>> (env,"ParameterNames");
>>         axiom_element_create_str(env, nodeA, nodeBString, empty_ns,
>> &nodeB);
>>
>>         axiom_node_t *nameNode = axiom_node_create(env);
>>         axutil_string_t* nameString = axutil_string_create (env, "Name");
>>         axiom_element_create_str(env, nodeB, nameString, empty_ns,
>> &nameNode);
>>
>>         axiom_element_t *ele = (axiom_element_t
>> *)axiom_node_get_data_element( nameNode, env);
>>         axiom_element_set_text( ele, env, "blah", nameNode);
>>
>>         cout << axiom_node_to_string(nodeA,env) << endl;
>>
>>         axiom_node_free_tree(nodeA, env);
>>     }
>>
>> The method is called multiple times with a sleep interval in between and
>> creates the output below.
>> Note the ParameterNames tag for the last two iterations.
>>
>> <cwmp:getParameterValues
>> xmlns:cwmp="urn:dslforum-org:cwmp-1-0"><ParameterNames><Name>blah</Name></ParameterNames></cwmp:getParameterValues>
>> <cwmp:getParameterValues
>> xmlns:cwmp="urn:dslforum-org:cwmp-1-0"><ParameterNames><Name>blah</Name></ParameterNames></cwmp:getParameterValues>
>> <cwmp:getParameterValues
>> xmlns:cwmp="urn:dslforum-org:cwmp-1-0"><ParameterNames><Name/>blah</Name></ParameterNames></cwmp:getParameterValues>
>> <cwmp:getParameterValues xmlns:cwmp="urn:dslforum-org:cwmp-1-0">*
>> <ParameterNames/>*
>> <Name/>blah</Name></ParameterNames></cwmp:getParameterValues>
>> <cwmp:getParameterValues xmlns:cwmp="urn:dslforum-org:cwmp-1-0">*
>> <ParameterNames/>*
>> <Name/>blah</Name></ParameterNames></cwmp:getParameterValues>
>>
>> Is this expected due to my incorrect use of the APIs or is this a bug ?
>>
>> Many thanks.
>>
>>
>>
>>
>>
>> On Thu, Sep 4, 2008 at 7:52 AM, Andy Karseras <akarseras@gmail.com>wrote:
>>
>>> Thanks for your reply.
>>>
>>> It seems that the problem occurs even when I create a new service client
>>> and payload on each time I resend.  Would this be expected ?
>>>
>>>
>>>
>>>
>>> On Wed, Sep 3, 2008 at 9:05 PM, Samisa Abeysinghe <samisa@wso2.com>wrote:
>>>
>>>> I think this occurs because you are violating the ownership rules with
>>>> OM. Once the payload is passed in, the engine takes over the ownership of
>>>> the node and you are not supposed to do anything with the payload
>>>> afterwards.
>>>>
>>>> Thanks,
>>>> Samisa...
>>>>
>>>> Andy Karseras wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I raised this problem in July and thought that it had been resolved (by
>>>>> doing proper clean-up), although it is now re-occurring.
>>>>>
>>>>> I am seeing a close tag being created when there shouldn't be.
>>>>>
>>>>> The incorrect message content is as follows...
>>>>>
>>>>> <cwmp:getParameterValues xmlns:cwmp="urn:dslforum-org:cwmp-1-0">
>>>>>    <ParameterNames>
>>>>>        *<Name/>**TempAgent.</Name>
>>>>>    </ParameterNames>
>>>>> </cwmp:getParameterValues>
>>>>>
>>>>>
>>>>> I am sending the same message multiple times to the server and the
>>>>> error occurs on the third iteration (3rd time the message is sent) so
am
>>>>> assuming that I am not doing proper clean-up after each message is created
>>>>> and then sent.
>>>>>
>>>>> My questions as follows...
>>>>> a) Has anybody seen this before ?
>>>>>
>>>>> b) Will calling axiom_node_free_tree on nodeA also clean-up nodeB in
>>>>> the following example ?
>>>>>    axiom_node_t *nodeB= axiom_node_get_first_child(nodeA, env);
>>>>>
>>>>> c) Will a node created to be used in axis2_svc_client_add_header, be
>>>>> cleaned-up by axis2_svc_client_free ?
>>>>>
>>>>> d) Is there any other info I can provide to clarify or help explain the
>>>>> problem ?
>>>>>
>>>>> Many thanks.
>>>>>
>>>>>
>>>>> Andy
>>>>>
>>>>> ------------------------------------------------------------------------
>>>>>
>>>>>
>>>>> No virus found in this incoming message.
>>>>> Checked by AVG - http://www.avg.com Version: 8.0.169 / Virus Database:
>>>>> 270.6.15/1649 - Release Date: 9/3/2008 7:15 AM
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Samisa Abeysinghe Director, Engineering; WSO2 Inc.
>>>>
>>>> http://www.wso2.com/ - "The Open Source SOA Company"
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
>>>> For additional commands, e-mail: axis-c-user-help@ws.apache.org
>>>>
>>>>
>>>
>>
>
>
> --
> Thanks,
> Dimuthu Gamage
>
> http://www.dimuthu.org
> http://www.wso2.org
>



-- 
Software Engineer, WSO2 Inc

Mime
View raw message