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 Marin Bek <ma...@gmail.com> on 2010/12/10 16:27:05 UTC

Axis2 - multiple calls memory violation

Hello,

our app uses axis2 to communicate with our java service via SOAP. Everything
works, but there are issues when a new call is made.

Way it works:
1. app signs in to server using https, env is opened with
axutil_env_create_all and stub with axis2_stub_create_MyApp
Return data is successfully received and signout is conducted. stub and env
are freed with axis2_stub_free and axutil_env_free. Pointers are not reset
to 0, so I don't know if this actually works?

2. The same functions are called with the same data (sign in), env and stub
are created once more, and sign is being conducted, but I get a "memory
access violation" on :
            ret_node =  axis2_svc_client_send_receive_with_op_qname(
svc_client, env, op_qname, payload);


Methods are auto-generated, so I guess they should be ok.

Any ideas why this should happen? We don't have env and stub open all the
time because it may be that there is no activity for several hours.

Thank you...

Re: Axis2 - multiple calls memory violation

Posted by Now Pains Now Gains <no...@gmail.com>.
Thank you so much. That's really great! Have a great day.

Zhang

On Sat, Dec 11, 2010 at 10:14 PM, Marcus Dushshantha Chandradasa <
dushshantha.chandaradasa@gmail.com> wrote:

> You can use TCPmon to see the SOAP message. No need to mess around with log
> files.
>
> http://ws.apache.org/commons/tcpmon/download.cgi
>
> Thanks
> Dushshantha
>
>
> On Sat, Dec 11, 2010 at 9:29 PM, Now Pains Now Gains <
> nowgains.nowpains@gmail.com> wrote:
>
>> Dear all,
>>
>> I'm newbie of AXIS/C. After a few days of learning. I really like it.
>> Thanks a lot for the developers! I have a very basic question, I googled
>> again and again, but with no lucky. I hope somebody can answer me here.
>>
>> I used gSoap before. It has a good feature that it allows your to write
>> the SOAP message your sent and received in log files when you debug your
>> code. For example, your request sent for a reqest:
>>
>>   String[] getEmployeeDetails ( int employeeNumber );
>> would look similar to this in the log file:
>>
>>   <?xml version="1.0" encoding="UTF-8" standalone="no" ?>
>>
>>
>>
>>   <SOAP-ENV:Envelope
>>    SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
>>    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
>>
>>
>>
>>    xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
>>    xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
>>
>>
>>
>>    xmlns:xsd="http://www.w3.org/1999/XMLSchema">
>> 	<SOAP-ENV:Body>
>> 		<ns1:getEmployeeDetails
>> 		 xmlns:ns1="urn:MySoapServices">
>>
>>
>>
>> 			<param1 xsi:type="xsd:int">1016577</param1>
>> 		</ns1:getEmployeeDetails>
>> 	</SOAP-ENV:Body>
>>   </SOAP-ENV:Envelope>
>>
>> And your response would be something like this in the receiving log:
>>
>>   <?xml version="1.0" encoding="UTF-8" ?>
>>   <SOAP-ENV:Envelope
>>    xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
>>
>>
>>
>>    xmlns:xsd="http://www.w3.org/1999/XMLSchema"
>>    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
>>
>>
>>
>> 	<SOAP-ENV:Body>
>> 		<ns1:getEmployeeDetailsResponse
>> 		xmlns:ns1="urn:MySoapServices"
>> 		SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
>>
>>
>>
>> 			<return
>> 			xmlns:ns2="http://schemas.xmlsoap.org/soap/encoding/"
>> 			xsi:type="ns2:Array"
>> 			ns2:arrayType="xsd:string[2]">
>>
>>
>>
>> 				<item xsi:type="xsd:string">Bill Posters</item>
>> 				<item xsi:type="xsd:string">+1-212-7370194</item>
>> 			</return>
>> 		</ns1:getEmployeeDetailsResponse>
>>
>>
>>
>> 	</SOAP-ENV:Body>
>>   </SOAP-ENV:Envelope>
>>
>> Does AXIS/C support such kind of logging? If it does support it, how? If
>> it does not support this, how can I get this information?
>>
>> Thanks a lot!
>>
>> Zhang
>>
>
>

Re: Axis2 - multiple calls memory violation

Posted by Marcus Dushshantha Chandradasa <du...@gmail.com>.
You can use TCPmon to see the SOAP message. No need to mess around with log
files.

http://ws.apache.org/commons/tcpmon/download.cgi

Thanks
Dushshantha

On Sat, Dec 11, 2010 at 9:29 PM, Now Pains Now Gains <
nowgains.nowpains@gmail.com> wrote:

> Dear all,
>
> I'm newbie of AXIS/C. After a few days of learning. I really like it.
> Thanks a lot for the developers! I have a very basic question, I googled
> again and again, but with no lucky. I hope somebody can answer me here.
>
> I used gSoap before. It has a good feature that it allows your to write the
> SOAP message your sent and received in log files when you debug your code.
> For example, your request sent for a reqest:
>
>
>   String[] getEmployeeDetails ( int employeeNumber );
> would look similar to this in the log file:
>
>   <?xml version="1.0" encoding="UTF-8" standalone="no" ?>
>
>
>   <SOAP-ENV:Envelope
>    SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
>    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
>
>
>    xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
>    xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
>
>
>    xmlns:xsd="http://www.w3.org/1999/XMLSchema">
> 	<SOAP-ENV:Body>
> 		<ns1:getEmployeeDetails
> 		 xmlns:ns1="urn:MySoapServices">
>
>
> 			<param1 xsi:type="xsd:int">1016577</param1>
> 		</ns1:getEmployeeDetails>
> 	</SOAP-ENV:Body>
>   </SOAP-ENV:Envelope>
>
> And your response would be something like this in the receiving log:
>
>   <?xml version="1.0" encoding="UTF-8" ?>
>   <SOAP-ENV:Envelope
>    xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
>
>
>    xmlns:xsd="http://www.w3.org/1999/XMLSchema"
>    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
>
>
> 	<SOAP-ENV:Body>
> 		<ns1:getEmployeeDetailsResponse
> 		xmlns:ns1="urn:MySoapServices"
> 		SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
>
>
> 			<return
> 			xmlns:ns2="http://schemas.xmlsoap.org/soap/encoding/"
> 			xsi:type="ns2:Array"
> 			ns2:arrayType="xsd:string[2]">
>
>
> 				<item xsi:type="xsd:string">Bill Posters</item>
> 				<item xsi:type="xsd:string">+1-212-7370194</item>
> 			</return>
> 		</ns1:getEmployeeDetailsResponse>
>
>
> 	</SOAP-ENV:Body>
>   </SOAP-ENV:Envelope>
>
> Does AXIS/C support such kind of logging? If it does support it, how? If it
> does not support this, how can I get this information?
>
> Thanks a lot!
>
> Zhang
>

Re: Axis2 - multiple calls memory violation

Posted by Now Pains Now Gains <no...@gmail.com>.
Dear all,

I'm newbie of AXIS/C. After a few days of learning. I really like it. Thanks
a lot for the developers! I have a very basic question, I googled again and
again, but with no lucky. I hope somebody can answer me here.

I used gSoap before. It has a good feature that it allows your to write the
SOAP message your sent and received in log files when you debug your code.
For example, your request sent for a reqest:

  String[] getEmployeeDetails ( int employeeNumber );
would look similar to this in the log file:

  <?xml version="1.0" encoding="UTF-8" standalone="no" ?>
  <SOAP-ENV:Envelope
   SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
   xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
   xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
   xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
   xmlns:xsd="http://www.w3.org/1999/XMLSchema">
	<SOAP-ENV:Body>
		<ns1:getEmployeeDetails
		 xmlns:ns1="urn:MySoapServices">
			<param1 xsi:type="xsd:int">1016577</param1>
		</ns1:getEmployeeDetails>
	</SOAP-ENV:Body>
  </SOAP-ENV:Envelope>

And your response would be something like this in the receiving log:

  <?xml version="1.0" encoding="UTF-8" ?>
  <SOAP-ENV:Envelope
   xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
   xmlns:xsd="http://www.w3.org/1999/XMLSchema"
   xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
	<SOAP-ENV:Body>
		<ns1:getEmployeeDetailsResponse
		xmlns:ns1="urn:MySoapServices"
		SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
			<return
			xmlns:ns2="http://schemas.xmlsoap.org/soap/encoding/"
			xsi:type="ns2:Array"
			ns2:arrayType="xsd:string[2]">
				<item xsi:type="xsd:string">Bill Posters</item>
				<item xsi:type="xsd:string">+1-212-7370194</item>
			</return>
		</ns1:getEmployeeDetailsResponse>
	</SOAP-ENV:Body>
  </SOAP-ENV:Envelope>

Does AXIS/C support such kind of logging? If it does support it, how? If it
does not support this, how can I get this information?

Thanks a lot!

Zhang

Re: Axis2 - multiple calls memory violation

Posted by Marin Bek <ma...@gmail.com>.
Hi,

thanks, I'll try valgrind. Must be some error in memory handling as you
say...

Marin

On Tue, Dec 14, 2010 at 11:00 AM, Rico M <ri...@gmail.com> wrote:

> Hi,
>
> I was not aware SSL with multi threading could lead to such issues.
>
> My understanding is heap would be allocated for your webserver and not per
> lib loaded.
>
> I would strongly advice running your code under a valgrind (or equivalent).
> The heap could be corrupted by a something like a double free in your custom
> code.
>
> Cheers!
>
>
>
> On Mon, Dec 13, 2010 at 2:25 PM, Marin Bek <ma...@gmail.com> wrote:
>
>> Hello,
>>
>> yes, it seems heap gets corrupted when SSL is used. The situation is: My
>> application uses axis2, which uses SSL. I built them all using /MD now,
>> since I found in openSSL documentation that heap corruption could occur if
>> SSL used in multiple threads, and the error doesn't occur when pure HTTP is
>> used. Suggested method is to use \MD threading. It is now more stable, and
>> it seems it is now my application failing due to heap corruption. But if I
>> understand correctly, that shouldn't be an issue since it is also
>> dynamically linked.
>>
>> I built openssl using instructions included in source and nasm.
>> Axis2 is version 1.6 and built using options:
>> ENABLE_SSL = 1
>> ENABLE_LIBCURL = 0
>> ENABLE_LIBXML2=0
>> WITH_TCP = 0
>> WITH_ARCHIVE = 0
>> OPENSSL_BIN_DIR = H:\openssl\dir
>> CRUNTIME = /MD
>> EMBED_MANIFEST = 1
>> DEBUG = 1
>>
>> Application is built using \MD as I already said.
>>
>> Am I supposed to do anything else to prevent heap corruption when
>> multithreading?
>>
>> Thank you
>>
>>
>> On Mon, Dec 13, 2010 at 1:05 PM, Rico M <ri...@gmail.com> wrote:
>>
>>> Getting back to the topic....
>>>
>>> If i understand correctly, you are creating the environemnt with every
>>> call and the failure seems to happen on the second call...?
>>>
>>> I am doing something similar as above and it does not fail. It may be a
>>> case of heap corruption some where after the first call is processed.
>>>
>>> Cheers!
>>>
>>>
>>>
>>> On Fri, Dec 10, 2010 at 3:27 PM, Marin Bek <ma...@gmail.com> wrote:
>>>
>>>> Hello,
>>>>
>>>> our app uses axis2 to communicate with our java service via SOAP.
>>>> Everything works, but there are issues when a new call is made.
>>>>
>>>> Way it works:
>>>> 1. app signs in to server using https, env is opened with
>>>> axutil_env_create_all and stub with axis2_stub_create_MyApp
>>>> Return data is successfully received and signout is conducted. stub and
>>>> env are freed with axis2_stub_free and axutil_env_free. Pointers are not
>>>> reset to 0, so I don't know if this actually works?
>>>>
>>>> 2. The same functions are called with the same data (sign in), env and
>>>> stub are created once more, and sign is being conducted, but I get a "memory
>>>> access violation" on :
>>>>             ret_node =  axis2_svc_client_send_receive_with_op_qname(
>>>> svc_client, env, op_qname, payload);
>>>>
>>>>
>>>> Methods are auto-generated, so I guess they should be ok.
>>>>
>>>> Any ideas why this should happen? We don't have env and stub open all
>>>> the time because it may be that there is no activity for several hours.
>>>>
>>>> Thank you...
>>>>
>>>
>>>
>>
>

Re: Axis2 - multiple calls memory violation

Posted by Rico M <ri...@gmail.com>.
Hi,

I was not aware SSL with multi threading could lead to such issues.

My understanding is heap would be allocated for your webserver and not per
lib loaded.

I would strongly advice running your code under a valgrind (or equivalent).
The heap could be corrupted by a something like a double free in your custom
code.

Cheers!


On Mon, Dec 13, 2010 at 2:25 PM, Marin Bek <ma...@gmail.com> wrote:

> Hello,
>
> yes, it seems heap gets corrupted when SSL is used. The situation is: My
> application uses axis2, which uses SSL. I built them all using /MD now,
> since I found in openSSL documentation that heap corruption could occur if
> SSL used in multiple threads, and the error doesn't occur when pure HTTP is
> used. Suggested method is to use \MD threading. It is now more stable, and
> it seems it is now my application failing due to heap corruption. But if I
> understand correctly, that shouldn't be an issue since it is also
> dynamically linked.
>
> I built openssl using instructions included in source and nasm.
> Axis2 is version 1.6 and built using options:
> ENABLE_SSL = 1
> ENABLE_LIBCURL = 0
> ENABLE_LIBXML2=0
> WITH_TCP = 0
> WITH_ARCHIVE = 0
> OPENSSL_BIN_DIR = H:\openssl\dir
> CRUNTIME = /MD
> EMBED_MANIFEST = 1
> DEBUG = 1
>
> Application is built using \MD as I already said.
>
> Am I supposed to do anything else to prevent heap corruption when
> multithreading?
>
> Thank you
>
>
> On Mon, Dec 13, 2010 at 1:05 PM, Rico M <ri...@gmail.com> wrote:
>
>> Getting back to the topic....
>>
>> If i understand correctly, you are creating the environemnt with every
>> call and the failure seems to happen on the second call...?
>>
>> I am doing something similar as above and it does not fail. It may be a
>> case of heap corruption some where after the first call is processed.
>>
>> Cheers!
>>
>>
>>
>> On Fri, Dec 10, 2010 at 3:27 PM, Marin Bek <ma...@gmail.com> wrote:
>>
>>> Hello,
>>>
>>> our app uses axis2 to communicate with our java service via SOAP.
>>> Everything works, but there are issues when a new call is made.
>>>
>>> Way it works:
>>> 1. app signs in to server using https, env is opened with
>>> axutil_env_create_all and stub with axis2_stub_create_MyApp
>>> Return data is successfully received and signout is conducted. stub and
>>> env are freed with axis2_stub_free and axutil_env_free. Pointers are not
>>> reset to 0, so I don't know if this actually works?
>>>
>>> 2. The same functions are called with the same data (sign in), env and
>>> stub are created once more, and sign is being conducted, but I get a "memory
>>> access violation" on :
>>>             ret_node =  axis2_svc_client_send_receive_with_op_qname(
>>> svc_client, env, op_qname, payload);
>>>
>>>
>>> Methods are auto-generated, so I guess they should be ok.
>>>
>>> Any ideas why this should happen? We don't have env and stub open all the
>>> time because it may be that there is no activity for several hours.
>>>
>>> Thank you...
>>>
>>
>>
>

Re: Axis2 - multiple calls memory violation

Posted by Marin Bek <ma...@gmail.com>.
Hello,

yes, it seems heap gets corrupted when SSL is used. The situation is: My
application uses axis2, which uses SSL. I built them all using /MD now,
since I found in openSSL documentation that heap corruption could occur if
SSL used in multiple threads, and the error doesn't occur when pure HTTP is
used. Suggested method is to use \MD threading. It is now more stable, and
it seems it is now my application failing due to heap corruption. But if I
understand correctly, that shouldn't be an issue since it is also
dynamically linked.

I built openssl using instructions included in source and nasm.
Axis2 is version 1.6 and built using options:
ENABLE_SSL = 1
ENABLE_LIBCURL = 0
ENABLE_LIBXML2=0
WITH_TCP = 0
WITH_ARCHIVE = 0
OPENSSL_BIN_DIR = H:\openssl\dir
CRUNTIME = /MD
EMBED_MANIFEST = 1
DEBUG = 1

Application is built using \MD as I already said.

Am I supposed to do anything else to prevent heap corruption when
multithreading?

Thank you


On Mon, Dec 13, 2010 at 1:05 PM, Rico M <ri...@gmail.com> wrote:

> Getting back to the topic....
>
> If i understand correctly, you are creating the environemnt with every call
> and the failure seems to happen on the second call...?
>
> I am doing something similar as above and it does not fail. It may be a
> case of heap corruption some where after the first call is processed.
>
> Cheers!
>
>
>
> On Fri, Dec 10, 2010 at 3:27 PM, Marin Bek <ma...@gmail.com> wrote:
>
>> Hello,
>>
>> our app uses axis2 to communicate with our java service via SOAP.
>> Everything works, but there are issues when a new call is made.
>>
>> Way it works:
>> 1. app signs in to server using https, env is opened with
>> axutil_env_create_all and stub with axis2_stub_create_MyApp
>> Return data is successfully received and signout is conducted. stub and
>> env are freed with axis2_stub_free and axutil_env_free. Pointers are not
>> reset to 0, so I don't know if this actually works?
>>
>> 2. The same functions are called with the same data (sign in), env and
>> stub are created once more, and sign is being conducted, but I get a "memory
>> access violation" on :
>>             ret_node =  axis2_svc_client_send_receive_with_op_qname(
>> svc_client, env, op_qname, payload);
>>
>>
>> Methods are auto-generated, so I guess they should be ok.
>>
>> Any ideas why this should happen? We don't have env and stub open all the
>> time because it may be that there is no activity for several hours.
>>
>> Thank you...
>>
>
>

Re: Axis2 - multiple calls memory violation

Posted by Rico M <ri...@gmail.com>.
Getting back to the topic....

If i understand correctly, you are creating the environemnt with every call
and the failure seems to happen on the second call...?

I am doing something similar as above and it does not fail. It may be a case
of heap corruption some where after the first call is processed.

Cheers!


On Fri, Dec 10, 2010 at 3:27 PM, Marin Bek <ma...@gmail.com> wrote:

> Hello,
>
> our app uses axis2 to communicate with our java service via SOAP.
> Everything works, but there are issues when a new call is made.
>
> Way it works:
> 1. app signs in to server using https, env is opened with
> axutil_env_create_all and stub with axis2_stub_create_MyApp
> Return data is successfully received and signout is conducted. stub and env
> are freed with axis2_stub_free and axutil_env_free. Pointers are not reset
> to 0, so I don't know if this actually works?
>
> 2. The same functions are called with the same data (sign in), env and stub
> are created once more, and sign is being conducted, but I get a "memory
> access violation" on :
>             ret_node =  axis2_svc_client_send_receive_with_op_qname(
> svc_client, env, op_qname, payload);
>
>
> Methods are auto-generated, so I guess they should be ok.
>
> Any ideas why this should happen? We don't have env and stub open all the
> time because it may be that there is no activity for several hours.
>
> Thank you...
>