Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB Binaries » View Thread |
Messages 1 to 10 of 18 total |
"Cannot lock the session manager" Demo |
Wed, May 25 2022 11:10 AM | Permanent Link |
Heiko Knuettel | Hi!
Since I'm still experiencing this error I tried to boil down my CS application to a demo project. Interestingly this error only happens in this scenario when I have the application.processmessages in the onProgress event. I do that because it's the easiest way to keep the application responsive during long queries. Cheers, Heiko Attachments: EDBTest.zip |
Thu, May 26 2022 4:14 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Heiko
>Interestingly this error only happens in this scenario when I have the application.processmessages in the onProgress event. I do that because it's the easiest way to keep the application responsive during long queries. OK it is the easiest way but I've seen masses of warnings about using it. For long processes I'll generally spin of a thread and use that (there are components that simplify the process - look for BMDThread on Torry.net). User feedback is a bit more tricky but if all you want to do is let them know its done then its not a problem. Personally I send messsages back to the main thread and have a custom message handler with a visual indicator that sonething is happening - think the loading web page indicator on a browser tab. You're half way there with the function you're using to run the sql in your demo. Are you wanting for the users to do other things whilst waiting or just want them to be able to click stop if they want? Roy |
Thu, May 26 2022 8:28 AM | Permanent Link |
Jose Eduardo Helminsky HPro Informatica | Heiko
Have you tried using RemotePing to avoid this situation (disconnecting) ? Eduardo |
Thu, May 26 2022 8:58 AM | Permanent Link |
Jose Eduardo Helminsky HPro Informatica | Heiko
Forget my last post. Just after that I read carefully and I see the issue is another thing. |
Thu, May 26 2022 9:21 AM | Permanent Link |
Heiko Knuettel | Roy
>>Are you wanting for the users to do other things whilst waiting or just want them to be able to click stop if they want?<< Neither. I just want to prevent the application from freezing during queries, which leads either to automatically minimizing the form after it's done, or Windows declaring the application as hung (gets transparent, dialog if you want to wait, user clicks terminate). Visual "I am busy" feedback would be nice, but I can live without it. Any way, the user has to wait for the result, they are not doing anything else in the meantime, and they don't have the option to cancel. Depending on the user load and the environment (some of my clients use terminal servers and thin clients or terminal software, painfully slow) this freezing can happen during a lot of queries. I don't want to go down the rabbit hole of separating UI from db access via threads for the whole application. This would probably take me years, the app isn't designed in a way that would make that easy. The wonders of organic growth... Thanks for the BMDThread tip nevertheless, I will look into it. Could come in handy for at least some scenarios. |
Thu, May 26 2022 9:22 AM | Permanent Link |
Heiko Knuettel | Jose
Thanks anyway |
Thu, May 26 2022 10:08 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Heiko
>Neither. I just want to prevent the application from freezing during queries, which leads either to automatically minimizing the form after it's done, or Windows declaring the application as hung Is a progressbar a standard feature in the forms where this is happening? How easy would it be to modify queries OnProgress events? To confess my ignorance I do not know exactly what makes Windows decide a program is frozen. I have an idea about an application specific message handler (I use one in a couple of my apps - only a few lines of code) basically just eat any messsages whilst a query is running but I have no idea if it will prevent the problem. Roy |
Thu, May 26 2022 1:13 PM | Permanent Link |
Heiko Knuettel | >>Is a progressbar a standard feature in the forms where this is happening? How easy would it be to modify queries OnProgress events? <<
That's what I have done. Every query has the onProgess event set. So this problem is solved. I was just explaining why there is an application.processmessages in the onProgess. Whatever you do with the UI (progressbar or whatever), you need that, otherwise it is not redrawn. BUT - as demonstrated - this leads to the "cannot lock the session manager" error. Why, I can't tell. This shouldn't even be related. |
Fri, May 27 2022 3:38 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Heiko
My bet would be that Application.ProcessMessages is causing reentrancy which can screw all sorts of things up. Have a look at these https://stackoverflow.com/questions/5389097/what-causes-a-program-to-freeze https://yeahexp.com/what-is-the-difference-between-refresh-update-repaint-invalidate-and-application-processmessages/ The reason I was asking about ease of changing the OnProgress event is that it might be worthwhile changing Application.ProcessMessages to progressbar.Update. Roy Lambert |
Fri, May 27 2022 10:46 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Heiko
I took the time to adjust your code to run on my primitive D2007 - changed procedure TForm1.EDBQuery1Progress(Sender: TObject; PercentDone: Integer; var Continue: Boolean); begin progressbar1.Update; // application.ProcessMessages; end; and it works. Roy Lambert |
Page 1 of 2 | Next Page » | |
Jump to Page: 1 2 |
This web page was last updated on Saturday, April 27, 2024 at 08:52 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |