Jump to content
Registration disabled at the moment Read more... ×

Der schöne Günther

Members
  • Content Count

    739
  • Joined

  • Last visited

  • Days Won

    12

Everything posted by Der schöne Günther

  1. Der schöne Günther

    Need help investigating an app crash

    I have a Delphi app that is running 24/7, around the globe. On one very important installation, it will just crash and terminate, with no sign of an error message. Of course, I do log full stack traces on any exception as well as Windows resource exhaustion and other things. But this time, I am really stuck. Here is what is happening: The app is constantly polling another device through TCP. I am using the delphi-modbus library, which is, of course, based on Indy. At some point, the main thread will also talk to the device, and fail with a custom exception type. What bothers me, is at the exact same time, the background thread will also fail polling the device. That points to a resource being used by two threads at once, but the connection is entirely guarded by a Critical Section. Now the really interesting part: A third thread (one of Indy's scheduler threads) will now crash with an Access Violation. And at that moment, Windows shuts down my entire application. I have not attached the callstacks for (2) because I don't think they provide any useful information. As for (3), my app was able to log the following callstack: 24/07/2025 14:31:32 [63.4] Thread-ID 9052 ("TIdThreadWithTask")EAccessViolation: "Access violation at address 0098638C in module 'MyStuff.exe'. Write of address 00000004" [0098638C] IdTask.TIdTask.DoBeforeRun [00CA9106] JclHookExcept.DoExceptFilter [00CA92D9] JclHookExcept.HookedExceptObjProc [0040BAA3] System.@HandleAnyException [004E2399] System.Classes.ThreadProc [0040C6F8] System.ThreadWrapper Then, Windows will log the following two entries in the event viewer: First, there is an exception of 0xc0000409, which, according to Raymon Chen, just means "that the application decided to terminate itself with great haste" Event[1]: Log Name: Application Source: Application Error Date: 2025-07-24T14:31:32.4810000Z Event ID: 1000 Task: Application Crashing Events Level: Error Opcode: Info Keyword: Classic User: N/A User Name: N/A Description: Faulting application name: MyStuff.exe, version: 63.4.0.0, time stamp: 0x67b5aae0 Faulting module name: MyStuff.exe, version: 63.4.0.0, time stamp: 0x67b5aae0 Exception code: 0xc0000409 Fault offset: 0x020b025d Faulting process id: 0x1e5c Faulting application start time: 0x01dbfc922ab483ef Faulting application path: C:\Users\Public\MyStuff.exe Faulting module path: C:\Users\Public\MyStuff.exe Report Id: 2a531142-03f7-461e-9fa5-9f50df86ef33 A few milliseconds afterwards, the access violation is also logged Event[0]: Log Name: Application Source: Application Error Date: 2025-07-24T14:31:32.9150000Z Event ID: 1000 Task: Application Crashing Events Level: Error Opcode: Info Keyword: Classic User: N/A User Name: N/A Description: Faulting application name: MyStuff.exe, version: 63.4.0.0, time stamp: 0x67b5aae0 Faulting module name: unknown, version: 0.0.0.0, time stamp: 0x00000000 Exception code: 0xc0000005 Fault offset: 0xf0a79e3d Faulting process id: 0x1e5c Faulting application start time: 0x01dbfc922ab483ef Faulting application path: C:\Users\Public\MyStuff.exe Faulting module path: unknown Report Id: 9b3d67f1-32be-44df-bae9-466d2f36d1b8 Faulting package full name: Faulting package-relative application ID: For me, it looks like "Something" triggers stack corruption, which windows logs as a "Stack Buffer Overrun" Possibly within Indy's code (TIdTask) Windows will then shut the process down, wrapping it in an unhandled "Access violation" My dilemma: How on earth can I get behind this? I see I can use tools like procdump to automatically create a dump when the application gets shut down, but even then, I don't know what I would to with it. I have looked up the "fault offset" in the first exception (adding the base address to 0x020b025d), and I don't see any useful code there. Of course there is probably something wrong with my code, but I am rattled by Indy code being the final code running before the lights go out. Maybe @Remy Lebeau does have an idea? My Indy version (10.6.2.5311) is an older one. I have tried looking up changes since then, but Github doesn't go that far back. Where else can I check?
  2. Der schöne Günther

    Need help investigating an app crash

    It's an industrial line. There is no internet involved.
  3. Der schöne Günther

    Need help investigating an app crash

    I have reverted the firmware of the device in question to an earlier version and so far, no crashes in the Delphi app anymore. I am not sure if this is just a happy coincidence or really the cause. Still, I haven't been able to reproduce it which is really frustrating.
  4. Der schöne Günther

    Need help investigating an app crash

    This is deliberate, because the device is a simple controller that cannot serve multiple requests. It can only keep one socket connection open. Therefore, the Delphi app is only opening one connection and sharing it throughout the code. I know. It's not that easy to debug software on an industrial line that is processing tons of raw materials while the line is also on display for an exhibition. I'm doing what I can 😳 I haven't been able to reproduce it. There are other lines running the exact same software and configuration, and they're fine too. I am currently investigating a different software version on said microcontroller, but I am still at loss how this could affect the Delphi app so deeply. Thank you, I will check. Many thanks for all your replies so far! ❤️
  5. Der schöne Günther

    Need help investigating an app crash

    Is there anything else I can include? I've tried running a debug build with "Debug DCUs", Range and Overflow Checking enabled, but that didn't change anything. As of now, I had to disable integration of that one device, and the software has been running completely fine since then.
  6. Der schöne Günther

    Need help investigating an app crash

    Are you 100 % certain? I have been doing so for many years. I am aware of things like Windows GDI resources which can only be used from the thread they were created (something like this), but I suppose Indy should absolutely be fine, as long as everything is properly serialized through things like critical sections... Yes, I eventually do. That sounds exactly what my code is doing. Thank you! I will investigate.
  7. Der schöne Günther

    Advise for building a document

    We are still using it, but nobody has touched that code in years. I honestly wouldn't use it again. For our next product, we will probably go straight to html and then print or PDF-export straight from a WebView.
  8. This is the same question as last time, right? Problem time execution Mode DEBUG or RUN Library Vosk - Delphi IDE and APIs - Delphi-PRAXiS [en] There is no functional problem, it's just that the performance is not acceptable when being debugged, right? Have you tried using a regular profiler?
  9. Der schöne Günther

    JSON benchmarks

    As far as I know, nowhere does it specify that keys must be unique.
  10. Der schöne Günther

    VCL TEdgeBrowser not initialising

    I am using TEdgeBrowser excessively, up to the point of completely replacing a VCL-based UI with a web-based interface, as well as injecting and calling JavaScript at runtime. Can you provide a minimal example of your project? One caveat is that you have to wait for the TEdgeBrowser to finish navigation and _then_ do something with its content, but I suppose that is the same when being wrapped by TWebBrowser.
  11. Der schöne Günther

    VCL TEdgeBrowser not initialising

    The TEdgeBrowser has an event handler to catch initialization (OnCreateWebViewCompleted and OnProcessFailed). Have you checked those?
  12. Can you show an example, how you would typically make use of it?
  13. After we had migrated a project from 10.0 Seattle to 10.4 without any issues and it was working great, we have now migrated the next (bigger) project by 95 %. However, we are constantly having trouble with code completion in 10.4.1, it often stops working completely. As code completion appears to be a separate process, we have three "DelphiLSP.exe" living besides the good old "bds.exe". When code completion stops working, I thought terminating these processes would trigger the IDE to restart them. But this doesn't happen. Do I have another option besides completely shutting down the IDE, opening it again, loading the project and navigating to where I just left off?
  14. Der schöne Günther

    Delphi apps on ARM CPU?

    Thank you for your first hand insights into using a Windows ARM machine with Delphi. I stopped following the progress on WindowsOnARM a few years ago, so I am not up to date. Would you be willing to tell more about your daily usage, maybe in a separate thread? I'd be absolutely interested in typical day to day usage, battery runtimes, standby/wakeup times and where it could start to get tricky (old printer drivers, shell extensions, obscure software,...).
  15. Der schöne Günther

    VSoft.System.Console - Delphi implementation of c# Console class

    For me, the demo code bails out with an exception on SetWindowSize(..). For some reason, GetLargestConsoleWindowSize returns (240, 54) which then causes your function to raise an EArgumentOutOfRangeException. Which seems to be matching the .NET counterpart. So all is fine, and my computer is acting up. Weird.
  16. I don't get a warning for the above code at all 🤷‍♂️
  17. Der schöne Günther

    Cannot register at German delphipraxis.net!?

    Neu bei DP registrieren klappt anscheinend nicht - Delphi-PRAXiS
  18. Have you considered joining Embarcadero's marketing team?
  19. Embarcadero has been having too many coals in the fire for years now. Instead of opening the next can of worms, they should be fixing basics like code completion. I remember being in the Microsoft Technology Adoption Program where you got Teams meetings with the developers behind WinUI and other Windows components, got shown not yet released roadmaps and got to ask questions. Back then, it was basically impossible to properly use WinUI outside of Microsoft's Visual Studio (not sure if it was WinUI2 or 3). At that time, they openly replied to me that they had no plans to change that. Except WebView2 has been usable for basically everybody from everywhere, and it's actually good. You can see it being used in a lot of software, not just Microsoft's own products. Just look at how much stuff Microsoft has abandoned in the last couple of years, how much of the "Universal Windows" approach has been dialled down or completely removed already. Not to mention that new GUI stuff has been highly dependant on the most current Windows version. WebView2 even works in Windows 7. I honestly was interested in WinUI around 2018 to 2020 or so, but it certainly never took off. I firmly believe it is not relevant anymore.
  20. I am fully aware that Delphi's VCL interface library exclusively lives in the main thread. Everything VCL related must happen in the main thread. Do not access VCL elements, don't even create and destroy something like a VCL Bitmap or Canvas in a thread. Maybe you don't have to be that cautious, but that's what I remember. Yet, it still occasionally happens to us. An event that used to run in the main thread gets moved to a different thread. Sometimes, things might trigger something that might cause the UI to refresh something. I know that with perfect documentation and more attention this probably wouldn't happen. Yet, it does. My question: Are there any kind of "runtime checks" I can enable to "detect" -anything- from outside the main thread touches the VCL? My motivation is to easier "find" places where the UI layer is accidently accessed from outside of the main thread.
  21. Thank you both, that is exactly what I was looking for. 😇 It's a pity the VCL itself uses it just this once but I am sure there were performance considerations. I think this brought me on the right track. I will probably use a TVirtualMethodInterceptor and use the OnBefore hook to watch for methods like ['Repaint', 'Update', 'SetBounds', 'DefaultHandler'] and then call CheckNonMainThreadUsage(). Not sure if it will be sufficient to just use one interceptor on a TForm or TFrame, or if I will need to have a VirtualMethodInterceptors for every kind of control (Buttons, Panels, ...). I will still need to figure that out. 🤔
  22. Thank you, I am well aware of that. I am not directly accessing any GUI elements from threads. I am invoking events to which a VCL form or frame might be subscribed. Or background event handler might trigger something else that might then update the UI. Similar to like FastMM can throw an access violation at runtime when using memory after it has been freed, I am looking for something that might ~detect~ accessing the VCL in the context of a different thread.
  23. Der schöne Günther

    MacOS and Locking a File

    I cannot contribute how to solve this, but having dealt mostly with Windows I also was surprised recently to find out about how differently this is handled on other platforms like macOS or Linux. Delphi's standard library was initially built for Windows and suggests you could easily enforce this on other platforms as well. For other languages like C++ or Rust, the standard library's file access mechanism don't even support any way "sharing" or "locking". Their default implementation is even "Don't lock anything, allow everything" which I found surprising. Maybe that was just my old Windows habits.
  24. Der schöne Günther

    Delphi 12.3 is available

    I only skimmed through the changelog, but what interests me most is the introduction of an entirely new debugger for Win64: https://docwiki.embarcadero.com/RADStudio/Athens/en/64-bit_IDE#Delphi_Debugger That -could- mean a huge step forward in writing & debugging Delphi code outside of the RAD Studio IDE.
  25. Der schöne Günther

    How to capture a mouse click outside a modal window?

    Can you narrow it down further if the click you want to catch will be Still inside your own application Outside of your application, causing it to lose focus If mouse coordinates matter of you're just interested that a click happened
×