Hi Mark,
Cool. With your fix, the C++ server do not send garbage.
However, my client segfaults in the
BenchBasicDataType::~BenchBasicDataType() - the destructor.
Thanks,
Samisa...
On Fri, 2005-07-08 at 10:05, Mark Whitlock wrote:
>
>
> Hi Carsten, Dushshantha,
> Once I read your note, Carsten, I realised what the problem was and I've
> fixed it. AxisBench and ComplexLists now work. The delete [] p1 was
> deleting the strings inside BenchBasicDataType so I
> memset(p1,0,sizeof(BenchBasicDataType)*array.m_Size); before the delete.
> This ensures that the array that's being deleted doesn't reference the
> strings that we want to keep.
>
> I don't like memset'ing objects to zero - I think I'll assign to them a
> clean class whose fields have their default values.
> Thank you for your help in solving this :-)
> Mark
> Mark Whitlock
> IBM
>
> ----- Forwarded by Mark Whitlock/UK/IBM on 08/07/2005 10:58 -----
>
> "Carsten Blecken"
> <[EMAIL PROTECTED]
> sion.com> To
> "Apache AXIS C Developers List"
> 08/07/2005 02:18 <[email protected]>
> cc
>
> Please respond to Subject
> "Apache AXIS C RE: Carston: please help
> Developers List"
>
>
>
>
>
>
>
>
>
> Hi Mark, Dushanta,
>
> first of all sorry for obviously not testing sufficiently.
>
> On the other hand at some point in time we need to get the
> memory leaks stuffed in the stub and not in the client
> program (I had to do this and it was painful).
>
> I ran the AxisBench and had the problems you describe. There
> was one problem in Int.cpp which deallocated the xsd__int
> holder right away in the axis client library. Since that
> was inconsistent with other base types I changed that.
> After that AxisBench finished (commenting out the manual
> delete's), but the StringType was garbled.
>
> As you point out I suspect the copy section in BenchDataType.cpp
> causes the problem.
>
> // Additional code to find is reference is pointer or pointer
> to a pointer
> BenchBasicDataType ** pp1 = param->infos.m_Array;
>
> param->infos.m_Size = array.m_Size;
>
> if( param->infos.m_Array == NULL)
> {
> pp1 = new BenchBasicDataType*[array.m_Size];
> param->infos.m_Array = pp1;
> }
>
> BenchBasicDataType * p1 = (BenchBasicDataType *)
> array.m_Array;
>
> for( int iCount1 = 0; iCount1 < array.m_Size; iCount1++)
> {
> pp1[iCount1] = new BenchBasicDataType();
> *(pp1[iCount1]) = p1[iCount1];
> }
> delete [] p1;
>
> The last delete [] p1; will have now destructors which really deallocate
> the StringType, instead of the keeping the copy as it was before.
> One question : I'm not quite sure I understand why this copy is needed?
>
> I want to try tomorrow to comment out the delete [] p1; - and see where
> this goes.
>
> I don't have the ComplexLists yet up, but I suspect that this is a similar
> problem.
>
> Carsten
>
>
>
>
> -----Original Message-----
> From: Carsten Blecken
> Sent: Wednesday, July 06, 2005 7:05 PM
> To: Apache AXIS C Developers List
> Subject: RE: Carston: please help
>
>
> Hi Mark,
>
> this is a tough one (but we need the destructors working).
> I'll see how far I get. Thanks for looking at it.
>
> Carsten
>
> -----Original Message-----
> From: Mark Whitlock [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, July 06, 2005 3:05 PM
> To: [email protected]
> Subject: Carston: please help
>
>
>
>
>
>
> Hi Carston,
> The fix you made to BeanParamWriter.java on 28/06/05 1.78 has broken a
> couple of our tests and I am struggling to fix them. Please could you help
> me. I agree with your fix - I think the generated classes should clean up
> their storage in their destructor. Unfortunately this breaks the AxisBench
> and ComplexLists tests. AxisBench is set up for unit testing - so that you
> can run it without a server. Just specify
>
> ant -f test.xml -Dtest.name=AxisBench -DmockServer=true
>
> This will run it against a mock server which simply returns the response
> message from AxisBench_ServerResponse.expected.
>
> AxisBench fails by corrupting strings and qnames within the
> BenchBasicDataType and throwing an exception when storage is cleaned at the
> end of the testcase. When I commented out the lines that you added to
> BeanParamWriter, AxisBench passed. The problem occurs in deserialization
> since it is the output object that is corrrupted. Looking in the trace, I
> can see the strings being deserialized correctly by
> SoapDeSerializer::getElementAsString, so it must later on that they are
> corrupted. I am running on Windows, although I expect the problem will
> occur on all platforms.
>
> The similarity between AxisBench and ComplexLists is that they both return
> an array of complex types which contain string types that get corrupted.
> There is code in Axis_Create_BenchBasicDataType that extends an array by
> new'ing a new array, memcpy'ing the old array into the new array and
> deleting the old array. I thought that this might be the problem since
> ~BenchBasicDataType will delete the embedded strings when the old array is
> deleted. So I commented out the delete (just to try it) but this did not
> fix the problem. My guess is that the problem is in this area.
>
> Do you have any thoughts on what the problem might be?
> Any help would be greatly appreciated,
> Thanks,
> Mark
> Mark Whitlock
> IBM
--
Samisa Abeysinghe <[EMAIL PROTECTED]>
Virtusa Corporation