× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi Don,

I wouldn't want to send an escape message when its unable to delete the debug file.  Keep in mind that this procedure can be called when the file doesn't exist -- we sure don't want it to end the program with an escape message!

My thinking is to change the code in http_debug to look like this:


     c                   if        peStatus = *ON
     c                   if unlink(HTTP_DEBUG_FILE) < 0
     c                   eval      NumErr = errno
     c                   if        errno <> ENOENT
     c                   callp     util_diag('Unlink debug file failed +
     c                             with errno=' + %char(NumErr))
     c                   endif
     c                   endif
     c                   endif

So if it fails to delete it, it'll put a diagnostic message in the job log.  (Except when the error is ENOENT, which means the file doesn't exist.)  If we wanted additional diagnostics we could add more calls to util_diag to check things like the HTTP_DEBUG_FILE value, the value of wkDbg, or anything else you can think to log.

-SK


On 12/3/2019 5:32 PM, Don Brown via MIDRANGE-L wrote:
Thanks for the reply Scott.

The debug option is extremely useful to identify a production failure - as
we all know the internet is not perfect and third parties are not 100%
reliable so we need to cater for anomalies or failures.

So we monitor for a failed process and in this case we email attaching the
http debug file so it can be investigated.

With this issue I am positive that the http_debug() is being called, I
have run the process in debug and stepped through the program to the point
where the unlink is being executed and verified the path and file name are
correct but the file is not deleted and I have found no way to increase
the logging to determine why.

I wrote a very simple test program to duplicate the unlink and it worked -
the file was deleted.

The file and directories have *public access so it is not an authority
issue.

As for error checking (and directly from your website) is the following
the only option;

if unlink('/ifstest/littlepgm.com') < 0
callp EscErrno(errno)
endif

Or is there other options on ways to check for a failure on the unlink ?

Thanks


Don Brown





From: "Scott Klement" <midrange-l@xxxxxxxxxxxxxxxx>
To: midrange-l@xxxxxxxxxxxxxxxxxx
Date: 04/12/2019 05:32 AM
Subject: Re: httpapi debug file appending not replacing
Sent by: "MIDRANGE-L" <midrange-l-bounces@xxxxxxxxxxxxxxxxxx>



Hi Don,

I could certainly add error checking to this -- but, I never expected
people to use the debug file in production environments. The idea of the
debug file was to be able to generate diagnostics to send to me when
people are having problems. You see, it was a very common dilemma that
something would not work, and the programmer would have no clue what
information to give me or how to get that information, so I created the
debug file to output lots of diagnostics for them to send to me.

So it was really only intended as something used by developers who were
writing/testing their programs to send to me. It was not intended to be
something people using on an ongoing basis. As such, I didn't take
error handling, et al, seriously.

You mention that the file is growing and not being replaced -- but,
please understand that the only thing that triggers it to be replaced is
when the caller calls http_debug(). So, if the caller has previously
called http_debug() to enable debugging, it would be cleared -- but
after that, they can do any number of requests (millions if needed)
without the file being cleared again -- unless they called http_debug()
again, it would simply keep appending.

So its hard to say from your post whether anything is actually
malfunctioning?

If indeed they are calling http_debug() to try to replace the file, then
all I can suggest is that I add more error checking so we can see why
it's not clearing/deleting the file.

-SK

On 11/30/2019 7:16 PM, Don Brown via MIDRANGE-L wrote:
I am using HTTPAPI on V7R3.

I have debugging turned on.

I have found a debug file that is large.

The code suggests the file should be unlinked when the procedure is
called.

The debug file is in /tmp/httpapi_debug.txt and *public has *rwx
authority
The http_debug procedure does the following;

callp http_dclose <== This closes the stream file using
the extproc(close)

if peStatus = *ON <== Debugging is ON
callp unlink(HTTP_DEBUG_FILE)
endif


The result of unlink is not being checked - would this be logged to the
job log ?

How can I determine why the stream file is growing rather than being
recreated on each call to httpapi ?
Thank you for any suggestions


______________________________________________________________________
This email has been scanned for computer viruses. Although MSD has taken
reasonable precautions to ensure no viruses are present in this email, MSD
cannot accept responsibility for any loss or damage arising from the use
of this email or attachments.
______________________________________________________________________

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.