sponsored links

Collapse

Announcement

Collapse
No announcement yet.

Question about YAJL/HTTP timeouts

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Question about YAJL/HTTP timeouts

    I have several programs that make a call like this.
    monitor;
    http_post_stmf(peURL: pePostFile: peRecvFile: peTimeout:
    peUserAgent: peContentType: peSOAPAction);
    on-error ;
    // do stuff
    leavesr;
    endmon;

    After doing some research I have decide that I should be doing this differently. Something like this.
    dcl-s rc = int(10);
    monitor;
    rc = http_post_stmf(peURL: pePostFile: peRecvFile: peTimeout:
    peUserAgent: peContentType: peSOAPAction);
    if rc <> 1 ; // Returns -1 upon failure, 0 upon timeout, 1 for success, or an HTTP response code
    msg = http_error;
    // do stuff
    return;
    endif;
    on-error ;
    // do stuff
    leavesr;
    endmon;

    So the real question is:
    In my current code what happens in a timeout (or some other failure) situation?

  • #2
    The old http_post_stmf() does not throw an error that can be caught with monitor/on-error. You have to check the return code.

    If you want to use monitor/on-error, you will need to use the newer routines like http_stmf() or http_string(). Or else, you will have to throw the message yourself.

    Comment


    • #3
      Scott that cleared that part up, that the monitor/on-error is basically wasted lines of code doing it the way I am doing it (in my old and proposed new technique). I will fix that. I will add the return code check. Not sure what to do if fail/timeout but will figure that out.

      What happens in a timeout situation? Are the connections closed? Is the memory cleared? Etc.

      Let me give you some more information about why I am asking these questions. I did not intend on spoon feeding you the information, sorry.

      Our web programmers are consuming a remote web service from a CC provider. Not wanting to recreate the secure connections. The web programmers created a web service that the IBMi programmers (me) can consume. In turn it calls that CC web service. The CC service returns information, then the local web service passes that information back to the IBMi.
      This worked/works very good.
      Then we opened the flood gates and hit it hard with request.
      After the flood gates were opened we started getting errors in programs after the web service calls. The program getting the error might be in the program that calls the web service or a few programs downstream. The programs and files that faield seem to be random.
      Most of the errors were CPF5257 and CPF4572
      I/O error CPF5257 was detected in file xxxxxxxxxx
      Error message CPF4572 appeared during CLOSE
      When looking at the job logs it would be saying it could not find the file (in most cases). In several of the programs we did a setll/reade/dow/stuff/reade/enddo. The error would be on the reade inside the dow. Or it could be on the setll.
      How could the program lose a file half way thru, no library list changes, no close files?

      When we closed the flood gates all started working good again.

      Near as we could tell, the IBMi timeouts were being hit and many times the CC timeouts were being hit. We are communicating with the CC about web service limits.

      We were wondering if we did not control the timeout would that be causing the issue? Or is it the fact that we could have multiple web service calls happening at the same time?

      Thanks Scott.

      Comment


      • #4
        HTTPAPI creates a new network connection each time you call http_post_stmf(). (If you wanted it to keep the connection open, you're using the wrong routine.) When there is a timeout, yes, it closes the connection that has timed out. But, even if you don't have a timeout, it closes the connection each time when it is finished. I don't understand the question about "is the memory cleared"? Which memory are you referring to?

        The business about I/O errors in the files is not part of HTTPAPI. HTTPAPI does not open any database files... this would be somewhere else, perhaps in your code? You would need to troubleshoot your code to determine why this is failing.

        Comment


        • #5
          Scott, thanks for your help. You clarified several things for me and reinforced some thoughts.

          Comment

          sponsored links

          Collapse

          Working...
          X