NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: osquiabro on November 16, 2018, 04:09:32 AM

Title: Error and crash
Post by: osquiabro on November 16, 2018, 04:09:32 AM
finally I was able to run one of my programs without the service in one of my clients and curiously when there was no one connected at 11:00 pm he gave the error that is attached, but I have no idea how to solve or what causes it

NT 10.32
Title: Re: Error and crash
Post by: DonRidley on November 18, 2018, 06:03:14 AM
Do you have GPF Reporter?
Title: Re: Error and crash
Post by: osquiabro on November 18, 2018, 02:36:48 PM
no.
Title: Re: Error and crash
Post by: DonRidley on November 18, 2018, 03:48:28 PM
Anything scheduled to run in your app at that particular time?  Not much to go on.

GPF Reporter is an awesome tool for just this sort of thing.

Don
Title: Re: Error and crash
Post by: Bruce on November 19, 2018, 11:14:05 PM
Hi Osa,

Note that it says Thread 773. That suggests you are leaking threads and the program simply ran out of memory.
Or perhaps your max threads setting is waaay too high. The program likely ran out of memory and was terminated.

For generally more useful stack information see
https://clarionhub.com/t/how-to-improve-the-call-stack-when-your-program-gpfs/188

But I think in this case the thread number is the clue.

cheers
Bruce
Title: Re: Error and crash
Post by: osquiabro on November 20, 2018, 04:43:53 AM
my max threads is 1000 is too high? what is a correct setting for this??
Title: Re: Error and crash
Post by: Bruce on November 21, 2018, 10:32:29 PM
Osa,

yes 1000 is likely too high.
Each thread uses some amount of Ram while it is running - the exact amount depends a lot on the size of your dictionary.
(Since all threaded structures take up ram on each thread, and dict tables are usually threaded.)

A recommended number is around 100 - that seems good for most apps - but you can measure, and experiment, to find the "highest" number for your app if you like. (In your case I'd guess the highest number is 772, but hey, you might want to build some room into that so say 500)

Note this is NOT the "number of simultaneous users" = it's the number of _threads_ which is a very different thing. You can easily do thousands of users on a very small number of threads.

Cheers
Bruce
Title: Re: Error and crash
Post by: osquiabro on November 22, 2018, 05:06:53 AM
i changed to 500, but you said "That suggests you are leaking threads and the program simply ran out of memory."
How leaking is produced? sorry for my ignorance in this topic, and how i can detected.

Thanks..
Title: Re: Error and crash
Post by: Matthew51 on November 22, 2018, 04:45:57 PM
Anything that could stop a thread from reaching an end will cause leaks.  Endless loops, and waiting for resources that are never available are some of the most common causes.  It cold also be something that takes a long time (but does end) and the user thinks nothing is happening so they keep mashing the button.

For me I looked at an SQL report of the most run queries and found an endless loop.

Keep an eye on your thread count.  Unless your server is very busy is should be below 10 almost all the time.  If it's over that for more then a few seconds start looking at what the computer and your database are doing.
Title: Re: Error and crash
Post by: Bruce on November 22, 2018, 11:00:38 PM
or a MESSAGE window popping up....

cheers
Bruce
Title: Re: Error and crash
Post by: osquiabro on November 23, 2018, 05:02:01 AM
Matthew51 thanks for your comment.

"It cold also be something that takes a long time (but does end) and the user thinks nothing is happening so they keep mashing the button."

I have a report that consumes a little time but has a progress bar, what happens if the user clicks repeatedly and closes the browser? that process is finished or a leaking is produced?

Bruce how do I control when the NT or clarion triggers a message? I saw a message when there was a waiting timeout to connect to the database to pop-up message of clarion, I do not control it, i checked all my code and it does not contain any message().
Title: Re: Error and crash
Post by: Matthew51 on November 23, 2018, 12:39:29 PM
The server has no way of knowing if a user closed his browser. So if the user starts a report then exits the report will still finish and write the PDF to the disk.  NetTalk deletes the files after about a day if the user doesn't download it.

Nettalk will only make a message box directly if you don't have suppress error messages turned on (you should have it turned on).  Clarion has the ErrorManiger class that can create message boxes.  ErrorManiger is used by FileManager when it runs into an error like invalid record declarations and write errors.  NetTalk uses FileManager for most or all of its file access.

I've extended my ErrorManager so that it writes the error to a file rather then calling Message(). 

I've also installed capesoft's Message Box template.  This let me add code to log all messages, and set a short time out so calls to Message() won't halt a thread till user intervention.
Title: Re: Error and crash
Post by: osquiabro on November 23, 2018, 01:00:22 PM
i have it turned on the suppress error messages all the time and don't how a clarion message error is appeared.

"I've extended my ErrorManager so that it writes the error to a file rather then calling Message().  "

how do you that?

thanks..
Title: Re: Error and crash
Post by: Bruce on November 25, 2018, 09:43:06 PM
Hi Osa,

>> I've also installed capesoft's Message Box template.  This let me add code to log all messages, and set a short time out so calls to Message() won't halt a thread till user intervention.

This is the simplest way to suppress MESSAGE windows.

Cheers
Bruce
Title: Re: Error and crash
Post by: osquiabro on November 27, 2018, 05:05:55 AM
hello, bruce, my system ran for 7 days without problems, but today in the morning it hangs up, there are no messages or errors on the screen. but can not run the login page, I see in the performance tab 20 connections and 187 threads but it is not correct since there is no one connected, what could be happening? Without an error on the screen it is very difficult to know what is happening.

The system is simple only makes queries to a database, before version 10 did not have this problem.
Title: Re: Error and crash
Post by: Bruce on November 27, 2018, 10:14:12 PM
Hi Osa,

>> I see in the performance tab 20 connections and 187 threads but it is not correct since there is no one connected, what could be happening?

First thing I'd be interested in knowing is how you know "no-one is connected".
But that aside, if you have 187 threads then it's likely your system is leaking threads.

In other words one, or possibly more, requests being made to your system end up in a thread "not being finished".

If you look at the log tab you can see the thread number of the most recent request. The "last time" a thread is used is the call that calls it to stall.

So for example if the most recent one was on thread 188, then look back in the log to see the last one for 186, 185, 184 and so on. See if you can spot a specific call (maybe a report) which is common.

Then in your testing try and re-create that call - and see if the thread completes, or if it hangs.

cheers
Bruce
Title: Re: Error and crash
Post by: osquiabro on November 28, 2018, 04:20:08 AM
hi bruce, How can i save the log to the disk? the settings in log screen & disk don't work any NT example have this working?
Title: Re: Error and crash
Post by: Bruce on November 28, 2018, 11:06:20 PM
In app window designer,
right click on the radio buttons and choose Action.
You need to fill in the template settings there.

You will likely use a table in your dictionary - I believe one of the early examples (1, 2 or 3) have this set up.

cheers
Bruce
Title: Re: Error and crash
Post by: osquiabro on November 29, 2018, 05:15:07 AM
after add log settings and compile

 No matching prototype available - C:\Apps\Fecipur\FECIPUR002.clw:1351,20

in declarations generate by NT

AddLog                 PROCEDURE(FILE p_File,*String p_Field,*String p_Name,String p_DataString,<String p_ip>),DERIVED
AddLog                 PROCEDURE(String p_Data,<string p_ip>),DERIVED

NT 10.36
Title: Re: Error and crash
Post by: osquiabro on November 29, 2018, 05:28:22 AM
ignore, i found the problem in web Basicwithmenu have a log table but in DOS driver and my original table is in .tps
Title: Re: Error and crash
Post by: osquiabro on December 11, 2018, 12:32:11 PM
hello bruce, I have the log file when the system is hanging but I can not identify which thread or procedure produced the problem, is it possible with this file to identify the problem, that file is an xml that can be loaded into a table?
Title: Re: Error and crash
Post by: osquiabro on December 12, 2018, 11:53:51 AM
I have another client log with the same problem, the threads begin to auto increment until the system does not accept more requests..

Somebody can help me to find what procedure cause the problem?

Thanks..
Title: Re: Error and crash
Post by: Bruce on December 12, 2018, 11:26:11 PM
I'd say the problem starts on line 40991;

<item>12/11/18,14:12:09,12.205.102.26</item>
<request>GET /SatasGallery?PinNumber=062-090-830-21-063 HTTP/1.1
...
<log>
<item>12/11/18,14:12:09</item>
<thread>5</thread></log>
<log>

You can see that that <log> never closes, suggesting that the request did not complete. The next item is
<item>12/11/18,14:16:43</item>
<thread>6</thread></log>

which is a couple minutes later, but uses thread 6 - indicating that thread 5 is "locked".

So the first place I'd look is the SatasGallery procedure and determine why it's failing.
(perhaps it lost a connection to the database or something?)

cheers
Bruce

Title: Re: Error and crash
Post by: osquiabro on December 13, 2018, 04:14:46 AM
Thank you very much, Bruce, i had my suspicion with this procedure, but I could not understand in the log where the problem started, that procedure is connected to a database of images to generate a gallery, but I have seen that database is not optimized and I have no control over it. , but I will give my suggestions ..

The question is how can control? or How did you find that in the log? Do you have any tools for that? it's like looking for a needle in a haystack
Title: Re: Error and crash
Post by: Bruce on December 13, 2018, 11:36:33 PM
>> How did you find that in the log?

I opened it in notepad and looked for the last instance of thread 6.
By that point it was leaking threads so I looked up a bit from there to see where the leak started, and it seemed to be the SatasGallery one.
It's all in plain text, so easy to read, and then there's a big time gap between that request, and the one after it, and the thread number increments, it indicates that the thread 5 might have become never-ending.

>> The question is how can control?

Well, you need to look at your code to make sure that it "succeeds" or "fails" and doesn't just go into limbo.
I guess whatever you do depends a lot on your code there.


cheers
Bruce
Title: Re: Error and crash
Post by: osquiabro on December 14, 2018, 10:23:22 AM
i saw in log that the field is too short for save a transaction, this is a part of log example not complete..
  end of log"</reques<log>" or never complete the log.

<log>
<item>12/12/18,18:43:38,24.50.233.230</item>
<request>GET /SatasGallery?PinNumber=088-052-308-09-000 HTTP/1.1
Host: www.crimpr.net:88
Connection: keep-alive
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9,es-419;q=0.8,es;q=0.7
Cookie: .ASPXANONYMOUS=6qX_LgrXDGVIwYUgPx-Z5PIXUtJSndjvoMHEQBsW1TMzelkU2tAO4u6WeRow9cVOUwW7RQqWS9eAk2Frl4_0uUKvZJtUp-nrzRj4_wnZZjXoZ6ov0; __utmz=186353659.1544576375.1.1.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=(not%20provided); dnn_IsMobile=False; language=es-ES; __RequestVerificationToken_L2NyaW1kbm41=_fJrKhNerDtaQYxMwTbWhUvyWyMAk_Gm_3z-Ej4TnTjMBoS0KI2T3fHZceT7e5_EgU8XpQ2; __utma=186353659.2060740771.1544576375.1544576375.1544654385.2; __utmc=186353659; __utmt=1; ASP.NET_SessionId=ltevdexrtnjw0j3f<log>
<item>12/12/18,18:43:38</item>
<thread>5</thread></log>
<log>
<item>12/12/18,18:43:40,24.54.207.195</item>
<request>GET /reports/$$$YaHgdfqfijuSHItI.jpg HTTP/1.1
Host: www.crimpr.net:88
Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36
Accept: image/webp,image/apng,image/*,*/*;q=0.8
Referer: http://www.crimpr.net:88/SatasGallery?PinNumber=023-008-373-71-000
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9
Cookie: __utmz=186353659.1536070029.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); .ASPXANONYMOUS=JBURCZK6EZiE4ot95TnOQRRPFj4gevqu8DZX8E5XiF1rDeNKsbVysvswmfXYddbSha-v9np1pYtDsd3PnxaqMcMVsxjgV-FCiRpYK_fl96lowDW80; dnn_IsMobile=False; language=en-US; __RequestVerificationToken_L2NyaW1kbm41=kmllnvgy-nMgCM5Snc0Z41FpRKDZn1E1bMFR-oht0P_L37XslEKs8QgWJ_4TPcRNUgAIHA2; ASP.NET_SessionId=wuph2de22yl5cn0ra1aokqyc; __utma=186353659.2033773045.1536070029.1544462358.1544651899.20; __utmc=186353659; SESSIONIDX=eomNrxdhn8BAlFP01t5qRaHv3VXYna

</reques<log>
Title: Re: Error and crash
Post by: Bruce on December 19, 2018, 01:46:00 AM
I guess that's a function of the size of the field in your DOS table.

cheers
Bruce
Title: Re: Error and crash
Post by: osquiabro on December 19, 2018, 04:27:20 AM
It's not my file  ;D ;D ;D, just copy it from one of your examples ..

is possible to save this log into tps or any other database format?

i think that found and corrected the leak in my both projects, in one project the problem is a client driver version of SQL Server and a function that return a message error that NT don't controler, and in other project for a moment is a  Sata Gallery that you found in a log

thanks very much..
Title: Re: Error and crash
Post by: Bruce on December 20, 2018, 12:23:07 AM
>> It's not my file - just copy it from one of your examples ..

sure. But once it's in your dictionary, it's _your_ table <g>.

>> is possible to save this log into tps or any other database format?

sure, it's just a table in your database with a field....

cheers
Bruce
Title: Re: Error and crash
Post by: osquiabro on December 20, 2018, 03:55:38 AM
don't work with SQL Table when compile received this error:

No matching prototype available - C:\Apps\Fecipur\FECIPUR002.clw:1304,18

self.AddLog(WebLog,WEBLOG1:DataLine,GLO:WebLogName,'<request>' & clip(p_Data) & '</request>',p_ip)

only compile with DOS table..
Title: Re: Error and crash
Post by: Bruce on December 20, 2018, 09:30:35 PM
I suggest you start a new thread as we're off-topic here, and post the example of what you did so I can see...

cheers
Bruce
Title: Re: Error and crash
Post by: osquiabro on December 27, 2018, 08:37:27 AM
bruce i found a problem, NT expect a string field and my field is a cstring because is sql field..