Program crash on Win 10 + Firebird database lazarus / 16-Databases ---------------------------------------------------------------------- luckylynx · 2020-05-06 11:21 Hi, I developed a quite big order / purchase processing program with Lazarus (2.04/32) ,  Win 10 prof., Firebird 3.01 /32. The program worked fine without any errors for 2 years in a network with 5 old Win XP PC's. With new hardware ( Fujitsu Server, Lenovo clients ), Software Win Server 2019, Firebird 3.05 /64  the nightmare starts. Ocasionally one or the other client crashed in different program areas without any errors. Just gone. In the event viewer I can find always two two error messages : Error 1000 and error 1005 Protokollname: Application Quelle:        Application Error Datum:         30.04.2020 17:58:15 Ereignis-ID:   1000 Aufgabenkategorie:(100) Ebene:         Fehler Schlüsselwörter:Klassisch Benutzer:      Nicht zutreffend Computer:      PC03.loc Beschreibung: Name der Application: Myprogram.exe Name des fehlerhaften Moduls: fbclient.dll, Version: 3.0.1.32609 Ausnahmecode: 0xc0000006 Fehleroffset: 0x00087918 Protokollname: Application Quelle:        Application Error Datum:         04.05.2020 14:25:22 Ereignis-ID:   1005 Aufgabenkategorie:(100) Ebene:         Fehler Schlüsselwörter:Klassisch Benutzer:      Nicht zutreffend Computer:      PC03.loc Beschreibung: Windows cannot access the file for one of the following reasons: there is a problem with the network connection, the disk that the file is stored on, or the storage drivers installed on this computer, or the disk is missing. Windows closed the program because of this error. I already switched off the virus program and the firewall, without any success. I compiled the program in 64 Bit. No success. The current Firebird is 64 Bit. The former version was 32 Bit. Could this cause the problem or is someone out there which has the same problem or can help ? Switching back to 32 Bit Firebird ? Is this possible to restore a 64 bit version on a 32 bit DB? Thanks in advance Luckylynx ---------------------------------------------------------------------- rvk · 2020-05-06 12:15 Quote from: luckylynx on May 06, 2020, 01:21:46 pmThe current Firebird is 64 Bit. The former version was 32 Bit. Could this cause the problem or is someone out there which has the same problem or can help ? The server version of Firebird shouldn't matter. For the 32bit App, the 32bit client-library is used. For a 64bit app the 64bit client- library is used. So there shouldn't be a problem regarding mixing bitness. (And otherwise it just wouldn't run anyway) > Ausnahmecode: 0xc0000006 This is familiar to me, but not in the fbclient.dll module. This is a paging error. Are you running the .exe via a samba/windows share? If so, this error occurs when the .exe needs to load a part of the program and can't. In Delphi you could add IMAGE_FILE_NET_RUN_FROM_SWAP flag to the PE file options but I'm not sure about Lazarus. I have this in my .dpr Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i {$SETPEFLAGS IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP or IMAGE_FILE_NET_RUN_FROM_SWAP} These topics suggest you can do the same in Lazarus: https://forum.lazarus.freepascal.org/index.php/topic,31813.msg204315.h tml#msg204315 https://forum.lazarus.freepascal.org/index.php/topic,41486.msg288330.h tml#msg288330 So: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i const  IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP = $0400; // If Image is on removable media, copy and run from the swap file.  IMAGE_FILE_NET_RUN_FROM_SWAP = $0800; // If Image is on Net, copy and run from the swap file.{$SETPEFLAGS IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP or IMAGE_FILE_NET_RUN_FROM_SWAP} The other error (1000) suggests you have a less than optimal network configuration. Quotethere is a problem with the network connection, the disk that the file is stored on, or the storage drivers installed on this computer, or the disk is missing.Look in the event-log just above and below these events for network and (re)connection problems. ---------------------------------------------------------------------- luckylynx · 2020-05-06 12:55 Hi RVK, thanks for the quick reply. I used only {$SETPEFLAGS IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP } in the PE file  , no effect. So I will look/try your proposal today. There is no samba/windows share, but will ask the IT company who installed the hard/software ( except my program and Firebird) ---------------------------------------------------------------------- PascalDragon · 2020-05-06 12:58 Quote from: rvk on May 06, 2020, 02:15:19 pmIn Delphi you could add IMAGE_FILE_NET_RUN_FROM_SWAP flag to the PE file options but I'm not sure about Lazarus. I have this in my .dpr Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i {$SETPEFLAGS IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP or IMAGE_FILE_NET_RUN_FROM_SWAP} These topics suggest you can do the same in Lazarus: https://forum.lazarus.freepascal.org/index.php/topic,31813.msg204315.h tml#msg204315 https://forum.lazarus.freepascal.org/index.php/topic,41486.msg288330.h tml#msg288330 So: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i const  IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP = $0400; // If Image is on removable media, copy and run from the swap file.  IMAGE_FILE_NET_RUN_FROM_SWAP = $0800; // If Image is on Net, copy and run from the swap file.{$SETPEFLAGS IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP or IMAGE_FILE_NET_RUN_FROM_SWAP} The or won't work currently. So use either of the following solutions: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i const  IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP = $0400; // If Image is on removable media, copy and run from the swap file.  IMAGE_FILE_NET_RUN_FROM_SWAP = $0800; // If Image is on Net, copy and run from the swap file.  IMAGE_FILE_FLAGS = IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP or IMAGE_FILE_NET_RUN_FROM_SWAP;{$SETPEFLAGS IMAGE_FILE_FLAGS} Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i const  IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP = $0400; // If Image is on removable media, copy and run from the swap file.  IMAGE_FILE_NET_RUN_FROM_SWAP = $0800; // If Image is on Net, copy and run from the swap file.// mutliple invokations will OR the flags together{$SETPEFLAGS IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP}{$SETPEFLAGS IMAGE_FILE_NET_RUN_FROM_SWAP} ---------------------------------------------------------------------- rvk · 2020-05-06 13:28 Quote from: luckylynx on May 06, 2020, 02:55:58 pmI used only {$SETPEFLAGS IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP } in the PE file  , no effect. So I will look/try your proposal today. There is no samba/windows share, but will ask the IT company who installed the hard/software ( except my program and Firebird) I take it you only have one .exe and you have it on a shared folder (like \\MAINCOMPUTER\SHARE\MyProgram.exe or via a mapped driveletter). In that case you'll need to use the IMAGE_FILE_NET_RUN_FROM_SWAP (not the IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP which is for CD and USBs). (And using the suggestion of PascalDragon you can have them both. I didn't know the or doesn't work in FPC) ---------------------------------------------------------------------- PascalDragon · 2020-05-06 14:48 Quote from: rvk on May 06, 2020, 03:28:43 pm(And using the suggestion of PascalDragon you can have them both. I didn't know the or doesn't work in FPC) I only learned that thanks to a recent discussion here on the forum as well. Due to this I've already implemented support for OR, AND, XOR and NOT for integer constants inside compiler directives, but I've yet to fix $SetPEFlags and $SetPEOptFlags.  (but it wouldn't work with the released FPC anyway  ) ---------------------------------------------------------------------- avra · 2020-05-06 16:02 Quote from: luckylynx on May 06, 2020, 01:21:46 pmName des fehlerhaften Moduls: fbclient.dll, Version: 3.0.1.32609You said that you've switched to Firebird 3.05, but your client version seams to be 3.0.1. You can try to switch to the same client and server version 3.0.5, and if that fails then try the old version that worked. ---------------------------------------------------------------------- luckylynx · 2020-05-07 14:03 Hi guys, thanks for your suggestions. avra, my mistake. The clients and the server are installed from the same firebird installation source, so both are 3.01 not 3.05. rvk, I installed this morning a version with your proposal below ( IMAGE_FILE_NET_RUN_FROM_SWAP = $0800.. No effect. Still 1 or 2 crashes until now. The program in stored on the server . The original access was via mapped drive letter but I switched it to a net share like \\server\drive....Still crashes. There are not that many ideas left to solve it, but one is to run on one client with an embedded firebird DB to find out, is it the program or something in the new Server/Client system which I do not know. The last option is to switch back to the 32 Bit Firebird DB. Thanks guys and I'll keep you informed. ---------------------------------------------------------------------- rvk · 2020-05-07 15:51 Quote from: luckylynx on May 07, 2020, 04:03:08 pmI installed this morning a version with your proposal below ( IMAGE_FILE_NET_RUN_FROM_SWAP = $0800.. No effect. Still 1 or 2 crashes until now. Yes, but the question is, if you get the same error 1000 0xc0000006? If not, then that error is solved. You could try a 32bit version of your app and keep the 64bit version of the DB server. It's how I work with my app in Delphi. 32bit app should work fine with 64bit DB server. ---------------------------------------------------------------------- luckylynx · 2020-05-07 16:10 Hi rvk, I tried 64 bit and 32 bit of the program already with no success. So I don't know how to get any further. What's about a compilation in Delphi instead Freepascal? ---------------------------------------------------------------------- Thaddy · 2020-05-07 16:53 Can it be the case that you need a properly formatted manifest resource with the proper acces rights defined? If it worked before and you use no half or not documented Windows API calls, this is often the case. ---------------------------------------------------------------------- egsuh · 2020-05-08 11:01 You may have to Check Windows system, especially authentification, security, etc., because there have been many changes since Windows XP. ---------------------------------------------------------------------- rvk · 2020-05-08 13:47 I don't think the problem is a minifest, security or authentification. Because in that case the program just wouldn't work. Here the program works but stops unexpected. Seeing the error messages I think the problem lies in the network connection. @luckylynx, do you also have this problem locally on the server itself when running your program? ---------------------------------------------------------------------- avra · 2020-05-08 14:17 What antivirus is there? Is it the same if you make a folder exception or change antivirus to some other brand? ---------------------------------------------------------------------- luckylynx · 2020-05-08 18:53 Hi guys, as far as I know it is Norton Antivirus but will check. On Monday next week some IT people, who installed the system, will come over to check everything on spot. Maybe they could find something. To run the program on the server is a good proposal. Additionally I will integrate a PC in the network, which was not installed by them and who runs properly in the former installation. See what happens. So thanks to all and will come back next week with the results. Have a nice weekend ---------------------------------------------------------------------- luckylynx · 2020-05-13 17:48 The latest test was successful. I made a run for two days locally on a client with an embedded version of firebird without any problem. So my question now is if this result shows that the programm is probably not the reason for the crashes. Tomorrow I will try to run the program directly on the server. Regarding your proposal to ste the PE flags. The compiler makes a hint that the local constant IMAGE_FILE_NET_RUN_FROM_SWAP is not used. What does it mean? ---------------------------------------------------------------------- rvk · 2020-05-13 17:51 Quote from: luckylynx on May 13, 2020, 07:48:22 pmRegarding your proposal to ste the PE flags. The compiler makes a hint that the local constant IMAGE_FILE_NET_RUN_FROM_SWAP is not used. What does it mean? You need to look at the post after mine from PascalDragon. You can't use OR in the define yet (like you can in Delphi). You need to use only IMAGE_FILE_NET_RUN_FROM_SWAP (because your not running from usb or cd anyway) or define a separate value and use that (like it was shown in the post after mine from PascalDragon). Now, when you get that warning, only IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP is used and it still doesn't work from a network. ---------------------------------------------------------------------- luckylynx · 2020-05-13 18:19 Hi RVK, I already use only : const   IMAGE_FILE_NET_RUN_FROM_SWAP = $0800;   {$SetPEFlags } ---------------------------------------------------------------------- rvk · 2020-05-13 18:22 Quote from: luckylynx on May 13, 2020, 08:19:04 pmHi RVK, I already use only : const   IMAGE_FILE_NET_RUN_FROM_SWAP = $0800;   {$SetPEFlags } And that still gives that warning? It should be without < and >. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i const  IMAGE_FILE_NET_RUN_FROM_SWAP = $0800; // If Image is on Net, copy and run from the swap file.{$SETPEFLAGS IMAGE_FILE_NET_RUN_FROM_SWAP} ---------------------------------------------------------------------- luckylynx · 2020-05-13 18:27 Did it and compiled without hint. Perfect. Will try it tomorow. Thanks ---------------------------------------------------------------------- avra · 2020-05-13 18:50 Quote from: luckylynx on May 13, 2020, 07:48:22 pmI made a run for two days locally on a client with an embedded version of firebird without any problem. So my question now is if this result shows that the programm is probably not the reason for the crashes.No. You run app locally without network so that does not replicate original environment too well. Read carefully your own post: QuoteWindows cannot access the file for one of the following reasons: there is a problem with the network connection, the disk that the file is stored on, or the storage drivers installed on this computer, or the disk is missing. Windows closed the program because of this error.This means that there is either network or disk problem (or antivirus blocked access to the file). If your application executable is on the network, then try to copy it to local disk and start from there. If your application is on your local disk, then try to copy it to some other disk/partition (best to some root dir and not to program files dir), or simply start it from external USB disk. Also try to update that firebird client DLL to latest 3.0.5. And upgrading server to the same version will not hurt either. You should also update Windows to make sure it has latest drivers. I had a problem that Osisoft PI historian started to have several seconds of empty gaps in recorded data, and it happened randomly once or twice a week. It was hard to troubleshoot the problem, but at the end it turned out that after some update Symantec antivirus started to recognize VNC connection as a potential threat and blocked not only VNC but all network traffic for several seconds. To make things worse, not every connection was recognized as a threat - but only some in a random way. At first I thought that creating an exception for VNC directory would solve the problem but it didn't. It had nothing to do with file scanning, but with network threats. So I really suggest you to test one client without antivirus (or at least with alternative antivirus). ---------------------------------------------------------------------- ASBzone · 2020-05-13 20:01 Quote from: rvk on May 08, 2020, 03:47:57 pmI don't think the problem is a minifest, security or authentification. Because in that case the program just wouldn't work. Here the program works but stops unexpected. It can still be an underlying OS security subsystem that causes this.   It would be good to know what activities are occurring right around the time of the crashes. Quote from: rvk on May 08, 2020, 03:47:57 pmSeeing the error messages I think the problem lies in the network connection. That's a strong possibility as well. ---------------------------------------------------------------------- hrayon · 2020-05-13 21:13 Hi! Perhaps a power management problem? See here: https://www.top-password.com/blog/prevent-windows-10-from- disconnecting-network-during-sleep/ ---------------------------------------------------------------------- luckylynx · 2020-05-31 18:30 Hi again, due to your helpful proposals I installed a firebird client directly on the server and integrated an 'old' Windows7 computer into the domain and, surprise surprise, both systems run for several days without a program crash, which leads me to conclude, that neither my program nor the firebird database is the crash source. Now is time for the IT company to act, because they always rejected, that their new installed system is responsible for the problems. Thank you guys for your support, I have learned a lot.