Application sometimes freezes up when returning from form to browse

Hi All,

Since a year and a half my application randomly freeze up when returning from form procedure to browse procedure. Randomly because it happens only sometimes and also randomly because it happens on different browse/forms.

By freezing up I mean that the user can click anywhere in the application but it doesn’t respond anymore. Examining in the task manager shows that the amount of memory usage is around 35 MB (normal
less than 2 MB) and also the CPU time raises. Only killing the process gives it free.

My suspicion is that it is a problem of the Clarion 11 build 13630 runtime. As far as I can remember we didn’t have this problem in Clarion 9. Two years ago we upgraded van Clarion 9 to Clarion 11 (build 13630) and that is when we noticed this problem. The backend is MS SQL.

Does anybody experiences also this problem? Or does anybody know in which build this is solved? Or maybe a workaround?


Question have you tried adding CapeSoft’s GPF Reporter? That might just show the last error and cause of the freeze.

If an app freeze’s ie becomes unresponsive how would it trigger the gpf reporter?

Is there something I dont know about gpf reporter like it detects and waits the timeout period before firing a gpf report?

If you want to adjust the app timeout period for a user ie how long the OS waits before saying an app is unresponsive this can be used
For current user
HKEY_CURRENT_USER\Control Panel\Desktop\HungAppTimeout Reg_SZ
For all users use
HKEY_USERS.DEFAULT\Control Panel\Desktop\HungAppTimeout Reg_SZ

Default value 5000 milliseconds (5 seconds).

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.


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.


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.

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.)

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.