Menu

#1109 soap_wsdd_listen, timeouts and accumulated soap_new_SOAP_ENV__Fault

v1.0 (example)
closed-fixed
None
5
2017-03-02
2017-02-22
thomas65g
No

stdsoap2.c[pp] 2.8.43
Win7, WinEC7

We need some clarification about concept and behavior in soap_wsdd_listen

soap_wsdd_listen(serv, -1000000)==SOAP_OK

stops listening after 1 second but has created a fault by calling gsoap_fault

+faultcode  0x00a1c414 "in message exchange"    char *
+faultstring    0x026d6194 "End of file or no input: message transfer interrupted or timed out (1000000us recv delay) (1000000us send delay)"   char *
+faultactor 0x00000000 <Bad Ptr>    char *
+detail 0x00000000 {__any=??? __type=??? fault=??? }    SOAP_ENV__Detail *
+SOAP_ENV__Code 0x00000000 {SOAP_ENV__Value=??? SOAP_ENV__Subcode=??? } SOAP_ENV__Code *
+SOAP_ENV__Reason   0x00000000 {SOAP_ENV__Text=??? }    SOAP_ENV__Reason *
+SOAP_ENV__Node 0x00000000 <Bad Ptr>    char *
+SOAP_ENV__Role 0x00000000 <Bad Ptr>    char *
+SOAP_ENV__Detail   0x00000000 {__any=??? __type=??? fault=??? }    SOAP_ENV__Detail *

because soap_begin_serve fails it let return immediately from soap_wsdd_listen
and it skips soap_destroy(soap);

e.g. case for timeout below

SOAP_FMAC1
int
SOAP_FMAC2
soap_wsdd_listen(struct soap *soap, int timeout)
{
    soap->accept_timeout = soap->recv_timeout = soap->send_timeout = timeout;

    /* event-serve loop (exits upon timeout) */
    for (;;)
    {
        if (!soap_valid_socket(soap_accept(soap))
            || soap_begin_serve(soap))
        {
            /* timeout? */
            if (!soap->errnum)
                return soap->error = SOAP_OK;
            return soap->error;
        }

        /* always close HTTP afterwards */
        soap->keep_alive = 0;

        /* receive event and serve */
        if (soap_wsdd_serve_request(soap))
        {
            /* timeout? */
            if (!soap->errnum)
                return soap->error = SOAP_OK;
#ifdef WITH_FASTCGI
            soap_send_fault(soap);
#else
            return soap_send_fault(soap);
#endif
        }
        /* clean up for next iteration */
        soap_destroy(soap);
        soap_end(soap);
    } 
}

so each second accumulates a structur of soap_new_SOAP_ENV__Fault until the service shut down.
After 6 days, our instrument stops working -

our workaround for today is

if (soap_wsdd_listen(serv, -1000000)==SOAP_OK)
{
    // and clean up SOAP_ENV__Fault
    soap_destroy(serv);
}

but I prefer to have a fix in soap_wsdd_listen

Discussion

  • Robert van Engelen

    Thanks for the feedback. A fix will be included in 2.8.44. Indeed, without cleanup with the usual cleanup calls the errors will accumulate in memory, which is very undesirable. Also, do not forget to call soap_end(serv) after soap_destroy(serv) to remove temp data and malloced strings.

     
  • Robert van Engelen

    • status: open --> pending-fixed
    • assigned_to: Robert van Engelen
     
  • Robert van Engelen

    • status: pending-fixed --> closed-fixed
     

Log in to post a comment.