Hi Adrian,
next time I'll be more precious and provide diffs, this time I just wanted to point at places where I identified problems, because I think authors of that code should be able to provide better solution. I consider my changes just a "dirty hacks".

I have one more question, I would like to know how much is axis engine immune to incorrect SOAP messages. The problem I identified in my case was related to passing incorrect data to XML parser input buffer from the HTTP transport library. Consequently the client crashed, instead of reporting error to caller. But what happens when the server replies with an invalid reply? The client crashes too? Also I would like to ask if it is possible to download somewhere older versions of axis c++, I din't find it and on the official apache site is only 1.6beta.

My test is now running almost all day without a problem, there was already about 1000000 iterations so I'm slowly gaining more confidence in it :)

Thanks for reply
Petr


Adrian Dick wrote:
Hi,

After your email yesterday, I've been looking into some of the issues you
highlight, sorry for not getting back sooner.

It would appear you've managed to find a hole in our recent work to improve
memory management, and myself and Fred are currently working on fixing the
generated stubs and beans for rpc/encoded WSDLs.

Of course, we're always pleased to receive fixes.  The preferred manner for
providing fixes is as a context diff file.
If you are providing code fixes, it may be more appropriate to mail these
on the axis-c-dev mailing list.  It's also worthwhile raising new Jira
issues (here: http://issues.apache.org/jira/browse/AXISCPP ) and attaching
the diff files.

Regards,
Adrian
_______________________________________
Adrian Dick ([EMAIL PROTECTED])


Petr Cvachoucek <[EMAIL PROTECTED]> wrote on 30/03/2006 13:20:27:

Hi again,

I did some more investigations and seems successfully solved memory
leaks. In general the source code generated by wsdl2ws tool needs to be
extended and copy constructors and assignment operators must be added,
and destructors must do cleanup. If someone is interested, I can send
what is required to do.

When testing the client and server (both axis c++ - generated by
wsdl2ws, using apache2 on server side), I encountered other serious
problems. The client crashes sometimes, I tried to find the reason and
found bugs in the axis HTTP transport library. Client crashes sometimes
when the server response is in chunked format (but not every time).

The method HTTPTransport::getBytes() doesn't work in all cases, here is
the part I needed to change to make it work correctly:

(original position in HTTPTransport.cpp, line 767)

case eSOAPMessageIsChunked:
{
   if (m_GetBytesState == eSOAPMessageIsChunked)
   {
     if( m_iBytesLeft == 0)
     {
       getNextDataPacket( "No data available for next chunk size.");
     }
     m_iContentLength = getChunkSize();

     while( m_iContentLength + strlen(ASCII_S_CRLF) > m_iBytesLeft)
     {
       getNextDataPacket( "No data available for next chunk.");
     }
     if( m_iBytesLeft >= m_iContentLength + strlen(ASCII_S_CRLF))
     {
       nextChunk = m_strReceived.substr(
         m_iContentLength + strlen(ASCII_S_CRLF));

       m_strReceived = m_strReceived.substr( 0, m_iContentLength);
       m_iBytesLeft = m_iContentLength;

       if( peekChunkLength( nextChunk) == 0)
       {
         m_GetBytesState = eWaitingForHTTPHeader;
       }
     }
     else
     {
       nextChunk = "";
     }

     if( m_bMimeTrue)
     {
       processRootMimeBody();
       m_iBytesLeft = m_strReceived.length();
     }

     break;
   }
}

Also the method HTTPTransport::copyDataToParserBuffer() needs
modification:
(original position in HTTPTransport.cpp, line 1722)


bool HTTPTransport::copyDataToParserBuffer(char * pcBuffer, int *
piSize, int iBytesToCopy)
{
   bool bTransportInProgress = false;
   if( iBytesToCopy > 0)
   {
     int iToCopy = (*piSize < iBytesToCopy) ? *piSize : iBytesToCopy;
     strncpy( pcBuffer, m_strReceived.c_str(), iToCopy);
     m_iBytesLeft -= iToCopy;
     *piSize = iToCopy;

     if( m_iBytesLeft > 0)
     {
       m_strReceived = m_strReceived.substr( iToCopy);
     }
     else
     {
       m_strReceived = "";
     }
     bTransportInProgress = true;
   }
   else
   {
     *piSize = 0;
   }

   return bTransportInProgress;
}


The original behavior was pretty unstable, there were passed invalid
data to xerces parser and then the xerces throws an exception. But seems
it is not handled correctly in axis soap engine, because the axis engine
   crashes.

I'll continue testing and let you know if I find some more bugs. Btw,
does anybody know why it isn't possible to download previous releases of
axis c++ ? (only 1.6beta is on http://www.apache.org/dist/ws/axis-c/).
The 1.6beta is still pretty unstable in my opinion, why there is no
earlier stable version available for download?????

Petr


Reply via email to