Application sometimes freezes up when returning from form to browse

GPF reporter is present in the application and it helped me in the past to find errors. But in this case it is not a GPF, just a freezing up. As if it came in an endless loop. “As if” because it makes no sense that closing a random form most of the time works and sometimes freezes up.

That might be a good idea, but the OS doesn’t see the application as unresponsive. Now you mention that, I realize that is a bit odd. The application is for sure unresponsive, even if we wait for an few hours.

There are a couple things to try next time it happens;
a) press Esc. If there is an open (hidden, or off-screen window) which is just waiting, then pressing Esc can close it. Ditto Alt-F4. Both worth trying. If the system then becomes responsive again, then it becomes a question of figuring out the window.

b) Press Alt-Space, then M. Then press the right-arrow key… If a window is open “out of sight” then this will allow the "border of the window to become visible.

c) If you have been “logged out” of the SQL database - ie the SQL side has closed the open connection, then you can get this effect. Typically you would see this only if the app has “sat” for a while - not so much browse - form browse, but browse - form (long delay stretching to multiple minutes or hours) and then form closes. See (e) below.

d) It’s helpful to know if the app is “frozen” or “busy”. Your report would suggest “busy” (CPU rises.) This would suggest not a Critical Section issue. Those typically manifest as Cpu going to 0 and Ram remaining static. Your report suggests that the code has entered some sort of “endless loop”. This is especially true if the CPU on one core goes right up - near 100% for that core.

e) make use of UltimateDebug in your app to log entry, and exit of each procedure.

In case it matters - I think it’s highly doubtful this is the Clarion runtime. It’s much more likely to be code in your app, perhaps added there by a 3rd party product. Assuming it is the runtime will ultimately be unhelpful because if you believe that, then you won’t look harder at the actual code.

If you believe the problem in in build 13630, then perhaps update to the 13815 build.

3 Likes

Spy++ is good for that. It will show the coordinates of the window off screen with this psychometric testing operating system called Windows.

It could be the issue where pressing and releasing the ALT key, without pressing any other key, makes the program appear to hang. IIRC pressing Ctrl+Esc restored keyboard use, maybe it was another key combo.

There is a template that prevents it.

Also look if you have “Enabled Real-time Translation” checked in Global Properties / Actions …

Using it caused problems like the behavior described.

If it is, then using the NSA Ghidra can legally be used to decompile the runtime and try to find the offending code and then fix it, but normally people click on ok to save a form, or maybe enter to trigger the default button which is usually a forms ok button.

I know when I used to Rohitab api monitor to establish why apps were freezing I could see the api calls for the windows were in the wrong order. I even posted this on the ngs, dont know if they still exist but I think that was on the C7 ngs.

@Bostjan_Laba discovered that, though others may have too. I suspected its use of CriticalProcedure, but didn’t test long enough to know for sure where it happens.

You can’t use an ASSERT in a procedure with a critical procedure defined. Obviously you can’t do any UI in a Critical Procedure, and ASSERT counts as UI.

There were a number of cases in the ABC classes where there were Asserts in Critical Procedures, but I reported that back in C9 and I believe it has all been fixed by C11, or before.

1 Like

And now you are asking I am a bit in doubt. I am sure the use RAM is static be a lot more then when the application is running. Not sure about the used CPU. It is certainly not (approx.) 100%, but I don’t know what it is. I must check that better next time the problem occurs.

For sure I have that enabled. I need it to translate the Clarion messages. buttons, etc into Dutch. I will examine the suggested solution. Thank you for this suggestion.

I’ve had that app freezing problem and I dont use the translator, I just use english.

fwiw.

Is that also when returning from a form to the calling browse? And only then?

It happened when returning from a form, but I also got it when trying to start a new thread which would load a browse window or some other window.

I tried tricks like slowing down the hardware acceleration
Display Hardware Acceleration Slider - Windows drivers | Microsoft Learn
This doesnt apply if the graphics is provided by the cpu, but does apply if using an addon graphics card.
Win10> Settings > Display> scroll to the bottom and click on Graphics Settings, and toggle the hardware accelerated GPU scheduling. I havent seen the slider mentioned in the MS link above in Win10.

The slider referred to in the link is available from W2k to Win7. I dont know about Win8, but the GPU scheduling options have changed in Win10.

I never could get to the bottom of it, ie could reproduce it in code, but as you can see on my other post in your other thread, because I also had the situation where two clarion apps that communicated via pipes would both freeze when I was only debugging one of them, I needed a way to eliminate the clarion runtime which is why I went with the non clarion app debugview to get msgs out of the clarion apps to narrow down where it was freezing.

The closest I got to narrowing it down, but at the time couldnt replicate with MS api’s was the MDI child windows opening and closing. Using rohitab to watch the api calls, the clarion mdi child window calls worked in a particular way which contradicted code examples I had seen elsewhere. From memory I think two api’s calls were in the wrong order in the clarion runtime.

So its possible to open a mdi child window maximised, but the clarion runtime opens the window at a set size, then looks up the ini file window state and size then changes the window to suit. It was around here that the api calls were different to code examples I’d seen elsewhere.

I havent looked into the api calls with clarion 11. The tool I used to monitor the api calls was rohitab api monitor. You can select the windows dll’s and then select the api’s you want to monitor and it creates a hook into the process (app) and then displays all the api calls with parameter data so you can get a good insight into what is happening inside nearly any program.

If you have the hardware acceleration option, by switching this off, you make your pc more like they used to be in the early days where everything was done by the cpu and separate graphics cards didnt exist. That can help with scheduling.

Something else which can help with cpu scheduling it to alter the quantum. If you want to give background tasks more cpu time, this can help with machines not using windows defender for their anti virus.

[edit]
Know Thy Tick | Microsoft Learn

Look for Win32PrioritySeparation on this link and the different quanta, you can set it to.
FAQ of the Software/Operating Systems section | guru3D Forums

I normally run a 0x26 for a super responsive main app with no lag or minimal lag, but other tasks including services get less cpu time as a result and this can cause the less well written one’s problems especially if they use a driver which some AV software does. (This sounds like some car meet discussing fuel octane, cylinder pressures, injector nozzles, turbo’s etc but it works.)
[/edit]

There is a whole host of possibilities which could be affecting your machine making the apps freeze. Anti virus programs are notorious for interfering with other apps, so adding your app to any ignore list the AV software might have, can help as its reduces what can interfere with your app.

One other thought, when exiting the form, does this typically happen when data is being saved or abandoned like clicking changed and then clicking cancel? If its happening when data is being saved, what are you using for your data source? Tps files? SQL server of sorts? If SQL server is this a server based sql server or one running on the same machine?

It happens both clicking the OK button and the Cancel button. So saving or abandoning makes no difference. In my case it is MS SQL server which is running on a shared dedicated SQL server.

But it might not be related to MS SQL. I also started a thread in the Clarion NG and others reported that it happens to them too using TPS or Firebird. And I have a colleague/friend working in a different company who recognized it too. He is also using MS SQL.

I have a logging that write a log line on several points when closing a form and returning to the form:

  1. In the Kill method of the form
  2. In the Run method of the form just before returning
  3. In the Run method of the calling browse
  4. In the Ask method of the calling browse

They tell me what method is executed. Normally all log lines are written. But when it hangs the last line is the Run method of the form. Consequently, so that gives maybe clue.

You mentioned something about the graphics. That is funny because my colleague thought that the repainting might be the problem.

Certainly I would follow Bruce’s suggestions; they are spot on. I would also disable any 3rd party templates that you do not absolutely need, incase that wasn’t already mentioned. Running under an automated desktop testing system or adding in your own temporary code to set values and POST events to mimic what an automated testing system could do, might be helpful.

Something else I thought of is the ini file. Because there is an ini file read when opening the window in order to get the window state and position and at some point a file write back to the ini probably when the window is closed, I also wonder if its a disk read/write issue

Have you tried disabling the ini file window positions so its not using it to get the window position?

I’m not against the use of a logging file of sorts because like using debugview, the last entry written to file or sent to debugview will be around where it hangs, but if its something in the clarion runtime, writing to file which uses the clarion runtime could make it harder to isolate.

@vitesse mentioned using string theory to do the log writing here OutputDebugString directly to file? - #17 by vitesse.

If stringtheory is using windows api’s and not the clarion runtime to read/write to files, this could also work at helping to isolate the clarion runtime instead of using debugview, but if its a windows disk writing issue because there is a lot going on here in a very very short space of time, would writing to disk help instead of sending it to debugview where it sits in memory until saved to disk?

So can you add some logging to the abc classes then to get more info?

Not yet, comes on my list “Things tot try”. I do not all in the same time, because then I still don’t know what worked.

That I work with a log file is simple. The errors are that random that it can go good for a long time and suddenly out of the blue the freezing up happens. I cannot expect from my users that they use DebugView correctly and report problems to me. With the logfile a can check for every user (the log files are in the user directory) if and when an error occurred. And yes I use StringTheory to log the files, that was the outcome of my other post yesterday.

No idea how I can get that working, using StringTheory. But that is the next step, maybe the logging as I havve it now will do (I hope).

Well it will mean including the string theory class from the abc classes, but its easier to just declare the outputdebugstring api in in a module in the class.

Maybe you could derive the class?

I know what you mean which is why I wouldnt rule anything out, including windows playing up. I’ve said before I think these computers are a variation of Herbert Hoover’s New Deal, in other words these computers are a just a scientific psychometric test of sorts and I say this because I’ve got wise to some of the testing they have done to me over the years.

Well I rule out aliens… :nerd_face: