You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-user@axis.apache.org by Alex Mantaut <al...@intraway.com> on 2012/10/19 17:51:18 UTC

Segfault in sample ntlm_post on RC7

Hi,
    I'm starting to test ntlm functionality in RC7 and I've found some
bugs...
    I'm trying to execute the ntlm_post sample to test ntlm functionality
and it seg faults...
  This is the output

debug] phase.c(121) axis2_handler_t *request_uri_based_dispatcher added to
the index 0 of the phase Transport
[debug] phase.c(121) axis2_handler_t *addressing_based_dispatcher added to
the index 1 of the phase Transport
[debug] phase.c(121) axis2_handler_t *rest_dispatcher added to the index 0
of the phase Dispatch
[debug] phase.c(121) axis2_handler_t *soap_message_body_based_dispatcher
added to the index 1 of the phase Dispatch
[debug] phase.c(121) axis2_handler_t *soap_action_based_dispatcher added to
the index 2 of the phase Dispatch
[debug] phase.c(121) axis2_handler_t *dispatch_post_conditions_evaluator
added to the index 0 of the phase PostDispatch
[debug] phase.c(121) axis2_handler_t *context_handler added to the index 1
of the phase PostDispatch
[debug] conf_builder.c(227) No custom dispatching order found. Continue
with the default dispatching order
[debug] conf_builder.c(351) Module addressing found in axis2.xml
[error] class_loader.c(152) Loading shared library
/usr/local/axis2c/lib/libaxis2_http_sender.so  Failed. DLERROR IS
libaxis2_ntlm.so.0: cannot open shared object file: No such file or
directory
[error] conf_builder.c(848) Transport sender is NULL for transport http,
unable to continue
[error] conf_builder.c(250) Processing transport senders failed, unable to
continue
[error] dep_engine.c(929) Populating Axis2 Configuration failed
[error] conf_init.c(225) Loading deployment engine failed for client
repository /usr/local/axis2c
Segmentation fault

Upon closer examination there seem to be 2 errors. Somehow it doesn't find
the libntlm module, and while freeing the resources it segfaults...

I'm still working on the first one. But I think I've found a solution for
the second...

It seems the the conf_free method has a reference to dep_engine, and
dep_engine has a reference to conf... When someone releases conf in case of
error it frees the dep_engine,
but the dep_engine is also freed elswere causing segfault...
I think that dep_engine should be in charge of releasing conf, and not the
other way around... Can someone please confirm this? In that case the patch
would be very simple: just delete conf.c fom line 352 to line 355... I've
tried it and it stops the segfault and in all the samples it doesn't
increase the memory leak...

Thanks

-- 
-- 
Mantaut Alex
Intraway Corp.

+54 (11) 6040-4000
MSN: alex.mantaut@intraway.com

Visit our website at http://www.intraway.com
Proud to be an ISO 9001:2008 certified company

Re: Segfault in sample ntlm_post on RC7

Posted by Alex Mantaut <al...@intraway.com>.
There, I've created an issue for the segfault... I've attached a patch to
it also... I realized that the solution I proposed earlier caused some
memory leaks, so I changed the way to solve it... It doesn't seem to leak
memory anymore..

The issue is:

https://issues.apache.org/jira/browse/AXIS2C-1611

Also I've noticed an error on building the tests for the project, I've
created another issue (with a patch) for it.

https://issues.apache.org/jira/browse/AXIS2C-1610

Please let me know if the proposed patches are ok, or if something needs to
be modified in them...

Thanks
Alex


On Thu, Nov 8, 2012 at 11:31 PM, Dinesh Weerapurage <xy...@gmail.com>wrote:

> Yes, Please. I can review and apply the patch.
>
> thanks,
> Dinesh.
>
>
>
>> Shall I create an issue and attach a patch for this?
>>
>>
>>


-- 
-- 
Mantaut Alex
Intraway Corp.

+54 (11) 6040-4000
MSN: alex.mantaut@intraway.com

Visit our website at http://www.intraway.com
Proud to be an ISO 9001:2008 certified company

Re: Segfault in sample ntlm_post on RC7

Posted by Dinesh Weerapurage <xy...@gmail.com>.
Yes, Please. I can review and apply the patch.

thanks,
Dinesh.



> Shall I create an issue and attach a patch for this?
>
>
>

Re: Segfault in sample ntlm_post on RC7

Posted by Alex Mantaut <al...@intraway.com>.
Hi Dinesh,

- Regarding NTLM server, I've been using a Windows Server here at work, I
couldn't find a public test server yet... Does someone know any public ntlm
webservers? Damitha?

- Regarding the segfault it is not somethig specific to ntlm... Actually
I've found the bug by mistake, because I forgot to execute an ldconfig
command after compiling libntlm and Axis couldn't find the library on
runtime, which caused it to segfault...

The bug seems to be that, under certain error conditions axis tries to
release dep_engine twice... As I explained earlier, conf has a reference to
dep_engine and vice versa, and dep engine tries to be released twice...

To reproduce the segfault

- Build the samples.
- go to $AXIS2C_HOME/lib and move/delete one of the libraries (i.e.
libaxis2_http_sender.so.0.7.0)
- Run the sample (i.e. echo) It will segfault.

This segfault could be avoided easily just by commenting conf.c lines 352
to line 355... In that case rebuild axis, remove the library again, and the
server will show an error message (which it is expected because there is a
library missing) but it won't segfault.

This segfault concerns me a bit because it can emerge on other error
conditions...

Shall I create an issue and attach a patch for this?


Thanks

On Thu, Nov 8, 2012 at 12:36 AM, Dinesh Weerapurage <xy...@gmail.com>wrote:

> Hi Alex,
>
>    First I don't have any experience with NTLM. I followed
> Damitha's instructions from his email, Readme and blog.
>
> Compiled svn head with --enable-libntlm and then replaced /trunk/src/core/transport/http/sender/ntlm/libntlm/libntlm_wrapper.c
> with
> http://damithakumarage.files.wordpress.com/2011/06/libntlm_wrapper-c.docand compiled again and installed.
>
> Then from samples/client/ntlm directory, ntlm-post didn't crash for me but
> it failed. Looks like endpoint is not active anymore.
>
> $./ntlm_post
> Using endpoint : http://172.16.176.132:80/myservice/Service1.asmx
>
> Sending OM : <ns1:HelloWorld xmlns:ns1="http://tempuri.org">Hello
> World!</ns1:HelloWorld>
> ntlm client invoke FAILED!
>
> If you know any active endpoints I could try them.
>
> thanks,
> Dinesh.
>
>
>
> On Tue, Oct 23, 2012 at 11:56 PM, Dinesh Weerapurage <xy...@gmail.com>wrote:
>
>> Alex,
>>
>>    Based on Damitha's email [1], libntlm_wrapper is not in Axis2/C source
>> tree (because of licensing issue). However this post [2] provides a
>> download link for libntlm_wrapper. Please let us know how it goes.
>>
>> thanks,
>> Dinesh.
>>
>> 1.
>> http://mail-archives.apache.org/mod_mbox/axis-c-user/201106.mbox/%3C4DF19D4A.5060003@wso2.com%3E
>> 2.
>> http://damithakumarage.wordpress.com/2011/06/02/ntlm-auth-support-for-axis2c/
>>
>>
>> On Tue, Oct 23, 2012 at 12:02 PM, Alex Mantaut <alex.mantaut@intraway.com
>> > wrote:
>>
>>> Hi,
>>>     I'm starting to test ntlm functionality in RC7 and I've found some
>>> bugs...
>>>     I'm trying to execute the ntlm_post sample to test ntlm
>>> functionality and it seg faults...
>>>   This is the output
>>>
>>> debug] phase.c(121) axis2_handler_t *request_uri_based_dispatcher added
>>> to the index 0 of the phase Transport
>>> [debug] phase.c(121) axis2_handler_t *addressing_based_dispatcher added
>>> to the index 1 of the phase Transport
>>> [debug] phase.c(121) axis2_handler_t *rest_dispatcher added to the index
>>> 0 of the phase Dispatch
>>> [debug] phase.c(121) axis2_handler_t *soap_message_body_based_dispatcher
>>> added to the index 1 of the phase Dispatch
>>> [debug] phase.c(121) axis2_handler_t *soap_action_based_dispatcher added
>>> to the index 2 of the phase Dispatch
>>> [debug] phase.c(121) axis2_handler_t *dispatch_post_conditions_evaluator
>>> added to the index 0 of the phase PostDispatch
>>> [debug] phase.c(121) axis2_handler_t *context_handler added to the index
>>> 1 of the phase PostDispatch
>>> [debug] conf_builder.c(227) No custom dispatching order found. Continue
>>> with the default dispatching order
>>> [debug] conf_builder.c(351) Module addressing found in axis2.xml
>>> [error] class_loader.c(152) Loading shared library
>>> /usr/local/axis2c/lib/libaxis2_http_sender.so  Failed. DLERROR IS
>>> libaxis2_ntlm.so.0: cannot open shared object file: No such file or
>>> directory
>>> [error] conf_builder.c(848) Transport sender is NULL for transport http,
>>> unable to continue
>>> [error] conf_builder.c(250) Processing transport senders failed, unable
>>> to continue
>>> [error] dep_engine.c(929) Populating Axis2 Configuration failed
>>> [error] conf_init.c(225) Loading deployment engine failed for client
>>> repository /usr/local/axis2c
>>> Segmentation fault
>>>
>>> Upon closer examination there seem to be 2 errors. Somehow it doesn't
>>> find the libntlm module, and while freeing the resources it segfaults...
>>>
>>> I'm still working on the first one. But I think I've found a solution
>>> for the second...
>>>
>>> It seems the the conf_free method has a reference to dep_engine, and
>>> dep_engine has a reference to conf... When someone releases conf in case of
>>> error it frees the dep_engine,
>>> but the dep_engine is also freed elswere causing segfault...
>>> I think that dep_engine should be in charge of releasing conf, and not
>>> the other way around... Can someone please confirm this? In that case the
>>> patch would be very simple: just delete conf.c fom line 352 to line 355...
>>> I've tried it and it stops the segfault and in all the samples it doesn't
>>> increase the memory leak...
>>>
>>> Thanks
>>>
>>> --
>>> --
>>> Mantaut Alex
>>> Intraway Corp.
>>>
>>> +54 (11) 6040-4000 begin_of_the_skype_highlighting FREE +54 (11)
>>> 6040-4000end_of_the_skype_highlighting <%2B54%20%2811%29%206040-4000>
>>> MSN: alex.mantaut@intraway.com
>>>
>>>
>>> Visit our website at http://www.intraway.com
>>> Proud to be an ISO 9001:2008 certified compan
>>>
>>>
>>
>


-- 
-- 
Mantaut Alex
Intraway Corp.

+54 (11) 6040-4000
MSN: alex.mantaut@intraway.com

Visit our website at http://www.intraway.com
Proud to be an ISO 9001:2008 certified company

Re: Segfault in sample ntlm_post on RC7

Posted by Dinesh Weerapurage <xy...@gmail.com>.
Hi Alex,

   First I don't have any experience with NTLM. I followed
Damitha's instructions from his email, Readme and blog.

Compiled svn head with --enable-libntlm and then replaced
/trunk/src/core/transport/http/sender/ntlm/libntlm/libntlm_wrapper.c
with
http://damithakumarage.files.wordpress.com/2011/06/libntlm_wrapper-c.docand
compiled again and installed.

Then from samples/client/ntlm directory, ntlm-post didn't crash for me but
it failed. Looks like endpoint is not active anymore.

$./ntlm_post
Using endpoint : http://172.16.176.132:80/myservice/Service1.asmx

Sending OM : <ns1:HelloWorld xmlns:ns1="http://tempuri.org">Hello
World!</ns1:HelloWorld>
ntlm client invoke FAILED!

If you know any active endpoints I could try them.

thanks,
Dinesh.



On Tue, Oct 23, 2012 at 11:56 PM, Dinesh Weerapurage <xy...@gmail.com>wrote:

> Alex,
>
>    Based on Damitha's email [1], libntlm_wrapper is not in Axis2/C source
> tree (because of licensing issue). However this post [2] provides a
> download link for libntlm_wrapper. Please let us know how it goes.
>
> thanks,
> Dinesh.
>
> 1.
> http://mail-archives.apache.org/mod_mbox/axis-c-user/201106.mbox/%3C4DF19D4A.5060003@wso2.com%3E
> 2.
> http://damithakumarage.wordpress.com/2011/06/02/ntlm-auth-support-for-axis2c/
>
>
> On Tue, Oct 23, 2012 at 12:02 PM, Alex Mantaut <al...@intraway.com>wrote:
>
>> Hi,
>>     I'm starting to test ntlm functionality in RC7 and I've found some
>> bugs...
>>     I'm trying to execute the ntlm_post sample to test ntlm functionality
>> and it seg faults...
>>   This is the output
>>
>> debug] phase.c(121) axis2_handler_t *request_uri_based_dispatcher added
>> to the index 0 of the phase Transport
>> [debug] phase.c(121) axis2_handler_t *addressing_based_dispatcher added
>> to the index 1 of the phase Transport
>> [debug] phase.c(121) axis2_handler_t *rest_dispatcher added to the index
>> 0 of the phase Dispatch
>> [debug] phase.c(121) axis2_handler_t *soap_message_body_based_dispatcher
>> added to the index 1 of the phase Dispatch
>> [debug] phase.c(121) axis2_handler_t *soap_action_based_dispatcher added
>> to the index 2 of the phase Dispatch
>> [debug] phase.c(121) axis2_handler_t *dispatch_post_conditions_evaluator
>> added to the index 0 of the phase PostDispatch
>> [debug] phase.c(121) axis2_handler_t *context_handler added to the index
>> 1 of the phase PostDispatch
>> [debug] conf_builder.c(227) No custom dispatching order found. Continue
>> with the default dispatching order
>> [debug] conf_builder.c(351) Module addressing found in axis2.xml
>> [error] class_loader.c(152) Loading shared library
>> /usr/local/axis2c/lib/libaxis2_http_sender.so  Failed. DLERROR IS
>> libaxis2_ntlm.so.0: cannot open shared object file: No such file or
>> directory
>> [error] conf_builder.c(848) Transport sender is NULL for transport http,
>> unable to continue
>> [error] conf_builder.c(250) Processing transport senders failed, unable
>> to continue
>> [error] dep_engine.c(929) Populating Axis2 Configuration failed
>> [error] conf_init.c(225) Loading deployment engine failed for client
>> repository /usr/local/axis2c
>> Segmentation fault
>>
>> Upon closer examination there seem to be 2 errors. Somehow it doesn't
>> find the libntlm module, and while freeing the resources it segfaults...
>>
>> I'm still working on the first one. But I think I've found a solution for
>> the second...
>>
>> It seems the the conf_free method has a reference to dep_engine, and
>> dep_engine has a reference to conf... When someone releases conf in case of
>> error it frees the dep_engine,
>> but the dep_engine is also freed elswere causing segfault...
>> I think that dep_engine should be in charge of releasing conf, and not
>> the other way around... Can someone please confirm this? In that case the
>> patch would be very simple: just delete conf.c fom line 352 to line 355...
>> I've tried it and it stops the segfault and in all the samples it doesn't
>> increase the memory leak...
>>
>> Thanks
>>
>> --
>> --
>> Mantaut Alex
>> Intraway Corp.
>>
>> +54 (11) 6040-4000 begin_of_the_skype_highlighting FREE +54 (11)
>> 6040-4000end_of_the_skype_highlighting <%2B54%20%2811%29%206040-4000>
>> MSN: alex.mantaut@intraway.com
>>
>> Visit our website at http://www.intraway.com
>> Proud to be an ISO 9001:2008 certified compan
>>
>>
>

Re: Segfault in sample ntlm_post on RC7

Posted by Dinesh Weerapurage <xy...@gmail.com>.
Alex,

   Based on Damitha's email [1], libntlm_wrapper is not in Axis2/C source
tree (because of licensing issue). However this post [2] provides a
download link for libntlm_wrapper. Please let us know how it goes.

thanks,
Dinesh.

1.
http://mail-archives.apache.org/mod_mbox/axis-c-user/201106.mbox/%3C4DF19D4A.5060003@wso2.com%3E
2.
http://damithakumarage.wordpress.com/2011/06/02/ntlm-auth-support-for-axis2c/

On Tue, Oct 23, 2012 at 12:02 PM, Alex Mantaut <al...@intraway.com>wrote:

> Hi,
>     I'm starting to test ntlm functionality in RC7 and I've found some
> bugs...
>     I'm trying to execute the ntlm_post sample to test ntlm functionality
> and it seg faults...
>   This is the output
>
> debug] phase.c(121) axis2_handler_t *request_uri_based_dispatcher added to
> the index 0 of the phase Transport
> [debug] phase.c(121) axis2_handler_t *addressing_based_dispatcher added to
> the index 1 of the phase Transport
> [debug] phase.c(121) axis2_handler_t *rest_dispatcher added to the index 0
> of the phase Dispatch
> [debug] phase.c(121) axis2_handler_t *soap_message_body_based_dispatcher
> added to the index 1 of the phase Dispatch
> [debug] phase.c(121) axis2_handler_t *soap_action_based_dispatcher added
> to the index 2 of the phase Dispatch
> [debug] phase.c(121) axis2_handler_t *dispatch_post_conditions_evaluator
> added to the index 0 of the phase PostDispatch
> [debug] phase.c(121) axis2_handler_t *context_handler added to the index 1
> of the phase PostDispatch
> [debug] conf_builder.c(227) No custom dispatching order found. Continue
> with the default dispatching order
> [debug] conf_builder.c(351) Module addressing found in axis2.xml
> [error] class_loader.c(152) Loading shared library
> /usr/local/axis2c/lib/libaxis2_http_sender.so  Failed. DLERROR IS
> libaxis2_ntlm.so.0: cannot open shared object file: No such file or
> directory
> [error] conf_builder.c(848) Transport sender is NULL for transport http,
> unable to continue
> [error] conf_builder.c(250) Processing transport senders failed, unable to
> continue
> [error] dep_engine.c(929) Populating Axis2 Configuration failed
> [error] conf_init.c(225) Loading deployment engine failed for client
> repository /usr/local/axis2c
> Segmentation fault
>
> Upon closer examination there seem to be 2 errors. Somehow it doesn't find
> the libntlm module, and while freeing the resources it segfaults...
>
> I'm still working on the first one. But I think I've found a solution for
> the second...
>
> It seems the the conf_free method has a reference to dep_engine, and
> dep_engine has a reference to conf... When someone releases conf in case of
> error it frees the dep_engine,
> but the dep_engine is also freed elswere causing segfault...
> I think that dep_engine should be in charge of releasing conf, and not the
> other way around... Can someone please confirm this? In that case the patch
> would be very simple: just delete conf.c fom line 352 to line 355... I've
> tried it and it stops the segfault and in all the samples it doesn't
> increase the memory leak...
>
> Thanks
>
> --
> --
> Mantaut Alex
> Intraway Corp.
>
> +54 (11) 6040-4000
> MSN: alex.mantaut@intraway.com
>
> Visit our website at http://www.intraway.com
> Proud to be an ISO 9001:2008 certified compan
>
>

Segfault in sample ntlm_post on RC7

Posted by Alex Mantaut <al...@intraway.com>.
Hi,
    I'm starting to test ntlm functionality in RC7 and I've found some
bugs...
    I'm trying to execute the ntlm_post sample to test ntlm functionality
and it seg faults...
  This is the output

debug] phase.c(121) axis2_handler_t *request_uri_based_dispatcher added to
the index 0 of the phase Transport
[debug] phase.c(121) axis2_handler_t *addressing_based_dispatcher added to
the index 1 of the phase Transport
[debug] phase.c(121) axis2_handler_t *rest_dispatcher added to the index 0
of the phase Dispatch
[debug] phase.c(121) axis2_handler_t *soap_message_body_based_dispatcher
added to the index 1 of the phase Dispatch
[debug] phase.c(121) axis2_handler_t *soap_action_based_dispatcher added to
the index 2 of the phase Dispatch
[debug] phase.c(121) axis2_handler_t *dispatch_post_conditions_evaluator
added to the index 0 of the phase PostDispatch
[debug] phase.c(121) axis2_handler_t *context_handler added to the index 1
of the phase PostDispatch
[debug] conf_builder.c(227) No custom dispatching order found. Continue
with the default dispatching order
[debug] conf_builder.c(351) Module addressing found in axis2.xml
[error] class_loader.c(152) Loading shared library
/usr/local/axis2c/lib/libaxis2_http_sender.so  Failed. DLERROR IS
libaxis2_ntlm.so.0: cannot open shared object file: No such file or
directory
[error] conf_builder.c(848) Transport sender is NULL for transport http,
unable to continue
[error] conf_builder.c(250) Processing transport senders failed, unable to
continue
[error] dep_engine.c(929) Populating Axis2 Configuration failed
[error] conf_init.c(225) Loading deployment engine failed for client
repository /usr/local/axis2c
Segmentation fault

Upon closer examination there seem to be 2 errors. Somehow it doesn't find
the libntlm module, and while freeing the resources it segfaults...

I'm still working on the first one. But I think I've found a solution for
the second...

It seems the the conf_free method has a reference to dep_engine, and
dep_engine has a reference to conf... When someone releases conf in case of
error it frees the dep_engine,
but the dep_engine is also freed elswere causing segfault...
I think that dep_engine should be in charge of releasing conf, and not the
other way around... Can someone please confirm this? In that case the patch
would be very simple: just delete conf.c fom line 352 to line 355... I've
tried it and it stops the segfault and in all the samples it doesn't
increase the memory leak...

Thanks

-- 
-- 
Mantaut Alex
Intraway Corp.

+54 (11) 6040-4000
MSN: alex.mantaut@intraway.com

Visit our website at http://www.intraway.com
Proud to be an ISO 9001:2008 certified compan