Application sometimes freezes up when returning from form to browse

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:

Can you? :grinning: [20 char limit extender]

I have an update on this. It appears to be that when an application freezes up the process hardly takes up more RAM than a well-running precess. But the CPU time is around 27-30% where it normally take 0-7%.

So that means it is probably “busy”. But with what? And why random? It is just a form that closes and returns to the calling browse.

Some more observations:

  1. It appears to happen to some users only (on the same server). But I also noticed that one user who had this problem for a few weeks now seems to have no problem and now another user has the problem for the last two weeks.

  2. When the application freezes up (or is busy) most of the time the form is not closed, but occasionally the browse shines trough the form. It looks like the screen is not completely repainted when closing the form.

Right now I am considering to call the InvalidateRect API when closing the form. Opinions on that?

I’ve used it for fixing the display turds on problem windows. It won’t help your “freezing” though.

“Busy” could mean an endless loop somewhere, either in your control or not.

Endless loop makes sense. But I don’t believe it is caused by my code because it happens too random. Random on which browse/form combination it happens and random when it happens. Or at least it appears to be random to me.

So I am really curious what is causing that endless loop.

Maybe you could try using procmon if it occurs again? Or maybe Spy++ could detect some windows messages?

1 Like

I guess you mean ProcessMonitor from SysInternals? Good suggestion, I will install that now.
Installing Spy++ might be a problem. I will ask our provider tomorrow if he can do that without installing Visual Studio.

I think I got it with WinSdkSetup, but not sure. The file is located here on my machine, but I don’t have Visual Studio installed. “C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools”.

It either came from WinSDKSetup, or VS Code.

OK, I will point our provider to that. I guess they have one of them available.
Meanwhile I tested ProcMon. Takes some time to understand this tool. I must RTFM :grinning:
But indeed it might give a clue once a process appears to be in a endless loop again.

The 3 things you need to know about procmon:

  1. Set your filter correctly, or you’ll get jillions of useless events.
  2. Under the “Filter” menu, make sure “Drop Filtered Events” is selected, or it will get very sluggish.
  3. Ctrl+E will toggle capturing of events.
3 Likes

Thanks for that direction. I overlooked that one.
Coincidently I had a freeze this evening so I could “practise”. Unfortunate no clue yet, but maybe better next time.