Author | Topic: Fopen error | |
---|---|---|
Tomasz Hofman | Fopen error on Fri, 04 Apr 2014 10:28:20 +0200 Hi, I have strange problem with my application. This application is a network server, based on TCP/IP connections and ADS database. Application waiting on connections from client on TCP port, connects to ADS database, and reply to client (about 10 conn./sec.). Each connections is loged in txt file (fopen, fwrite, fclose). I have problem with this log file. After a random time (between 30 min and several hours) each fopen or fcreate function return error 6 (invalid handle) and I can't write any files (not only on log file, I can't create or write any file) . Everything works fine, except this functions. After restart application this function works fine. Thanks, Darek | |
James Loughner | Re: Fopen error on Sat, 05 Apr 2014 14:16:43 -0400 Slamming files open and closed is hard on the system. Why not just open the files and write to at as needed. Jim On 04/04/2014 04:28 AM, Tomasz Hofman wrote: > Hi, > > I have strange problem with my application. This application is a > network server, based on TCP/IP connections and ADS database. > Application waiting on connections from client on TCP port, connects to > ADS database, and reply to client (about 10 conn./sec.). Each > connections is loged in txt file (fopen, fwrite, fclose). I have problem > with this log file. After a random time (between 30 min and several > hours) each fopen or fcreate function return error 6 (invalid handle) > and I can't write any files (not only on log file, I can't create or > write any file) . Everything works fine, except this functions. After > restart application this function works fine. > > Thanks, > Darek | |
Tomasz Hofman | Re: Fopen error on Mon, 07 Apr 2014 11:47:14 +0200 Hi, Thank's for reply. I change my code and I open log files on program start. Log files working correctly now, but I have same problem with creating other files (I can't create them at start). I still need help. Thank's Darek W dniu 2014-04-05 20:16, James Loughner pisze: > Slamming files open and closed is hard on the system. Why not just > open the files and write to at as needed. > > > Jim > > On 04/04/2014 04:28 AM, Tomasz Hofman wrote: >> Hi, >> >> I have strange problem with my application. This application is a >> network server, based on TCP/IP connections and ADS database. >> Application waiting on connections from client on TCP port, connects to >> ADS database, and reply to client (about 10 conn./sec.). Each >> connections is loged in txt file (fopen, fwrite, fclose). I have problem >> with this log file. After a random time (between 30 min and several >> hours) each fopen or fcreate function return error 6 (invalid handle) >> and I can't write any files (not only on log file, I can't create or >> write any file) . Everything works fine, except this functions. After >> restart application this function works fine. >> >> Thanks, >> Darek > | |
James Loughner | Re: Fopen error on Mon, 07 Apr 2014 14:18:54 -0400 Opening files uses up file handles. Closing releases files handles but the release may not be instantaneous and if you do it enough the OS falls behind and you end up running out of file handles. I see this as an OS problem not a Xbase++ problem. You may want to redesign your logic so that it is not so hard on the file system Jim On 04/07/2014 05:47 AM, Tomasz Hofman wrote: > Hi, > > Thank's for reply. I change my code and I open log files on program > start. Log files working correctly now, but I have same problem with > creating other files (I can't create them at start). I still need help. > > Thank's > Darek > > > W dniu 2014-04-05 20:16, James Loughner pisze: >> Slamming files open and closed is hard on the system. Why not just >> open the files and write to at as needed. >> >> >> Jim >> >> On 04/04/2014 04:28 AM, Tomasz Hofman wrote: >>> Hi, >>> >>> I have strange problem with my application. This application is a >>> network server, based on TCP/IP connections and ADS database. >>> Application waiting on connections from client on TCP port, connects to >>> ADS database, and reply to client (about 10 conn./sec.). Each >>> connections is loged in txt file (fopen, fwrite, fclose). I have problem >>> with this log file. After a random time (between 30 min and several >>> hours) each fopen or fcreate function return error 6 (invalid handle) >>> and I can't write any files (not only on log file, I can't create or >>> write any file) . Everything works fine, except this functions. After >>> restart application this function works fine. >>> >>> Thanks, >>> Darek >> > | |
Tomasz Hofman | Re: Fopen error on Mon, 07 Apr 2014 21:52:16 +0200 Now, after the change, opening and closing files is rare (about 2 operations/minute) but problem occurs after the same time as before. But, when my problem occurs, in Task Manager I always see about 1100 used handles. When I check this handles most of them are event handles and thread handles (but thread handles are marked as non-existent and I don't see them in ThreadInfo function). Thank's Darek W dniu 2014-04-07 20:18, James Loughner pisze: > Opening files uses up file handles. Closing releases files handles but > the release may not be instantaneous and if you do it enough the OS > falls behind and you end up running out of file handles. I see this as > an OS problem not a Xbase++ problem. You may want to redesign your > logic so that it is not so hard on the file system > > Jim > > On 04/07/2014 05:47 AM, Tomasz Hofman wrote: >> Hi, >> >> Thank's for reply. I change my code and I open log files on program >> start. Log files working correctly now, but I have same problem with >> creating other files (I can't create them at start). I still need help. >> >> Thank's >> Darek >> >> >> W dniu 2014-04-05 20:16, James Loughner pisze: >>> Slamming files open and closed is hard on the system. Why not just >>> open the files and write to at as needed. >>> >>> >>> Jim >>> >>> On 04/04/2014 04:28 AM, Tomasz Hofman wrote: >>>> Hi, >>>> >>>> I have strange problem with my application. This application is a >>>> network server, based on TCP/IP connections and ADS database. >>>> Application waiting on connections from client on TCP port, >>>> connects to >>>> ADS database, and reply to client (about 10 conn./sec.). Each >>>> connections is loged in txt file (fopen, fwrite, fclose). I have >>>> problem >>>> with this log file. After a random time (between 30 min and several >>>> hours) each fopen or fcreate function return error 6 (invalid handle) >>>> and I can't write any files (not only on log file, I can't create or >>>> write any file) . Everything works fine, except this functions. After >>>> restart application this function works fine. >>>> >>>> Thanks, >>>> Darek >>> >> > | |
Klaus Overhage | Re: Fopen error on Tue, 08 Apr 2014 07:06:10 +0200 What Anti virus program you use ? Am 07.04.2014 21:52, schrieb Tomasz Hofman: > > Now, after the change, opening and closing files is rare (about 2 > operations/minute) but problem occurs after the same time as before. > But, when my problem occurs, in Task Manager I always see about 1100 > used handles. When I check this handles most of them are event handles > and thread handles (but thread handles are marked as non-existent and I > don't see them in ThreadInfo function). > > Thank's > Darek > > W dniu 2014-04-07 20:18, James Loughner pisze: >> Opening files uses up file handles. Closing releases files handles but >> the release may not be instantaneous and if you do it enough the OS >> falls behind and you end up running out of file handles. I see this as >> an OS problem not a Xbase++ problem. You may want to redesign your >> logic so that it is not so hard on the file system >> >> Jim >> >> On 04/07/2014 05:47 AM, Tomasz Hofman wrote: >>> Hi, >>> >>> Thank's for reply. I change my code and I open log files on program >>> start. Log files working correctly now, but I have same problem with >>> creating other files (I can't create them at start). I still need help. >>> >>> Thank's >>> Darek >>> >>> >>> W dniu 2014-04-05 20:16, James Loughner pisze: >>>> Slamming files open and closed is hard on the system. Why not just >>>> open the files and write to at as needed. >>>> >>>> >>>> Jim >>>> >>>> On 04/04/2014 04:28 AM, Tomasz Hofman wrote: >>>>> Hi, >>>>> >>>>> I have strange problem with my application. This application is a >>>>> network server, based on TCP/IP connections and ADS database. >>>>> Application waiting on connections from client on TCP port, >>>>> connects to >>>>> ADS database, and reply to client (about 10 conn./sec.). Each >>>>> connections is loged in txt file (fopen, fwrite, fclose). I have >>>>> problem >>>>> with this log file. After a random time (between 30 min and several >>>>> hours) each fopen or fcreate function return error 6 (invalid handle) >>>>> and I can't write any files (not only on log file, I can't create or >>>>> write any file) . Everything works fine, except this functions. After >>>>> restart application this function works fine. >>>>> >>>>> Thanks, >>>>> Darek >>>> >>> >> > | |
Tomasz Hofman | Re: Fopen error on Tue, 08 Apr 2014 08:52:17 +0200 I use Eset Endpoint Antivirus ver. 5. Darek W dniu 2014-04-08 07:06, Klaus Overhage pisze: > What Anti virus program you use ? > > Am 07.04.2014 21:52, schrieb Tomasz Hofman: >> >> Now, after the change, opening and closing files is rare (about 2 >> operations/minute) but problem occurs after the same time as before. >> But, when my problem occurs, in Task Manager I always see about 1100 >> used handles. When I check this handles most of them are event handles >> and thread handles (but thread handles are marked as non-existent and I >> don't see them in ThreadInfo function). >> >> Thank's >> Darek >> >> W dniu 2014-04-07 20:18, James Loughner pisze: >>> Opening files uses up file handles. Closing releases files handles but >>> the release may not be instantaneous and if you do it enough the OS >>> falls behind and you end up running out of file handles. I see this as >>> an OS problem not a Xbase++ problem. You may want to redesign your >>> logic so that it is not so hard on the file system >>> >>> Jim >>> >>> On 04/07/2014 05:47 AM, Tomasz Hofman wrote: >>>> Hi, >>>> >>>> Thank's for reply. I change my code and I open log files on >>>> program >>>> start. Log files working correctly now, but I have same problem with >>>> creating other files (I can't create them at start). I still need >>>> help. >>>> >>>> Thank's >>>> Darek >>>> >>>> >>>> W dniu 2014-04-05 20:16, James Loughner pisze: >>>>> Slamming files open and closed is hard on the system. Why not just >>>>> open the files and write to at as needed. >>>>> >>>>> >>>>> Jim >>>>> >>>>> On 04/04/2014 04:28 AM, Tomasz Hofman wrote: >>>>>> Hi, >>>>>> >>>>>> I have strange problem with my application. This application >>>>>> is a >>>>>> network server, based on TCP/IP connections and ADS database. >>>>>> Application waiting on connections from client on TCP port, >>>>>> connects to >>>>>> ADS database, and reply to client (about 10 conn./sec.). Each >>>>>> connections is loged in txt file (fopen, fwrite, fclose). I have >>>>>> problem >>>>>> with this log file. After a random time (between 30 min and several >>>>>> hours) each fopen or fcreate function return error 6 (invalid >>>>>> handle) >>>>>> and I can't write any files (not only on log file, I can't create or >>>>>> write any file) . Everything works fine, except this functions. >>>>>> After >>>>>> restart application this function works fine. >>>>>> >>>>>> Thanks, >>>>>> Darek >>>>> >>>> >>> >> | |
Thomas Braun | Re: Fopen error on Tue, 08 Apr 2014 13:51:16 +0200 Tomasz Hofman wrote: > I use Eset Endpoint Antivirus ver. 5. Try to deactivate AV (or add an exception for the directory where you create the files) and try if that fixes the problem... Thomas | |
Tomasz Hofman | Re: Fopen error on Tue, 08 Apr 2014 15:26:04 +0200 After disabling AV or adding directory to the exceptions, problem still occurs. Darek W dniu 2014-04-08 13:51, Thomas Braun pisze: > Tomasz Hofman wrote: > >> I use Eset Endpoint Antivirus ver. 5. > Try to deactivate AV (or add an exception for the directory where you > create the files) and try if that fixes the problem... > > Thomas | |
Thomas Braun | Re: Fopen error on Wed, 09 Apr 2014 10:40:10 +0200 Tomasz Hofman wrote: > After disabling AV or adding directory to the exceptions, problem > still occurs. I htink you have to try and create a small sample that reporduces this and send it to Alaska support. Thomas | |
Carlos A Beling | Re: Fopen error on Wed, 09 Apr 2014 09:38:17 -0300 Hello Tomasz: good morning. Did you try to put some delay (ie: Sleep(3)) after FClose()? Beling Best regards Em 9/4/2014 05:40, Thomas Braun escreveu: > Tomasz Hofman wrote: > >> After disabling AV or adding directory to the exceptions, problem >> still occurs. > > I htink you have to try and create a small sample that reporduces this and > send it to Alaska support. > > Thomas > | |
Tomasz Hofman | Re: Fopen error on Wed, 09 Apr 2014 16:08:20 +0200 Hi, No, but I think it's not a problem with closing the file. After the changes in the code files are opened and closed very rare. Thank's Darek W dniu 2014-04-09 14:38, Carlos A Beling pisze: > Hello Tomasz: > good morning. > Did you try to put some delay (ie: Sleep(3)) after FClose()? > > Beling > Best regards > > Em 9/4/2014 05:40, Thomas Braun escreveu: >> Tomasz Hofman wrote: >> >>> After disabling AV or adding directory to the exceptions, problem >>> still occurs. >> >> I htink you have to try and create a small sample that reporduces >> this and >> send it to Alaska support. >> >> Thomas >> |