Recent

Author Topic: Disk Full Message Possible BUG  (Read 4204 times)

JLWest

  • Hero Member
  • *****
  • Posts: 1293
Disk Full Message Possible BUG
« on: September 04, 2019, 12:05:15 am »
I'm trying to write a file out and I get a message

X Disk Full
   
     Press OK to Ignore and risk data corruption.
     Press Abort to kill program.

No matter what I press the program appears locked.

 Explorer say I have 950 GB free out of 953 GB.

Willing to post data and program

Thanks



 
FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: Disk Full Message Possible BUG
« Reply #1 on: September 04, 2019, 12:25:08 am »
Just gor test reasons if your SDD has gone wild:

Close Lazarus. Open Gimp/Photoshop/whatever. Open a big image. Save it with a new name. And now: Any problems?

Otherwise you might have a problem in your code.

Winni

JLWest

  • Hero Member
  • *****
  • Posts: 1293
Re: Disk Full Message Possible BUG
« Reply #2 on: September 04, 2019, 12:29:58 am »
Just gor test reasons if your SDD has gone wild:

Close Lazarus. Open Gimp/Photoshop/whatever. Open a big image. Save it with a new name. And now: Any problems?

Otherwise you might have a problem in your code.

Winni

Say What? "Open a big image. Save it with a new name."   Save What?

It's Not a Code Problem.

I re-booted the system, Wrote to different drive.
Worked fine.

 


FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: Disk Full Message Possible BUG
« Reply #3 on: September 04, 2019, 12:59:35 am »
Ahh - one of those reboot Operating Systems.

jamie

  • Hero Member
  • *****
  • Posts: 6090
Re: Disk Full Message Possible BUG
« Reply #4 on: September 04, 2019, 01:09:03 am »
maybe you wrote to a write protected drive?

Also if memory serves at one time there are some folders on the user system in windows that has a limited size set to them, it's possible you hit the limit but I am guessing this isn't the case.

 The message you are getting sounds very suspicious, please show us minimum code where you are doing the file open and writing attempts.


The only true wisdom is knowing you know nothing

JLWest

  • Hero Member
  • *****
  • Posts: 1293
Re: Disk Full Message Possible BUG
« Reply #5 on: September 04, 2019, 05:55:06 am »
maybe you wrote to a write protected drive?

Also if memory serves at one time there are some folders on the user system in windows that has a limited size set to them, it's possible you hit the limit but I am guessing this isn't the case.

 The message you are getting sounds very suspicious, please show us minimum code where you are doing the file open and writing attempts.

Code: Pascal  [Select][+][-]
  1. procedure TForm1.SaveMstData(AFILENAME : String);
  2.  Var i : integer = -1;
  3.   OutFile  : Textfile;
  4.   Line     : String = '';
  5.   Bit1     : String = '';
  6.   Bit2     : String = 'BDX0.txt';
  7.   FileName : String = '';
  8.  begin
  9.   ListBox5.ItemIndex := 0;
  10.   LevelUpperBoxes(0);
  11.   Bit1 := AFileName;
  12.   FileName := C_BasePath + Bit2;
  13.   if OneDirectory then begin FileName := LOC + Bit2; end;
  14.   AssignFile(OutFile, FILENAME);
  15.  Try
  16.   Rewrite(OutFile);
  17.   for i := 0 to High(Data) do begin
  18.       SetLine(i);
  19.       if SLOW then begin Application.ProcessMessages; end;
  20.       Line := GetLine;
  21.       if SLOW then begin Application.ProcessMessages; end;
  22.       WriteLn (Outfile,Line);
  23.       if SLOW then begin Application.ProcessMessages; end;
  24.    end;
  25.    finally
  26.     CloseFile(OutFile);
  27.   end;
  28.    ListBox5.ItemIndex := 0;
  29.    LevelUpperBoxes(0);
  30.  end;
  31.  
  32. procedure TForm1.SetLine(AINDEX : Integer);
  33.   begin
  34.    Edit5.Text  := Data[AINDEX].IATACode;
  35.    Edit4.Text  := Data[AINDEX].ICAO;
  36.    Edit6.Text  := Data[AINDEX].FAACode;
  37.    Edit7.Text  := Data[AINDEX].Region;
  38.    Edit8.Text  := Data[AINDEX].Name;
  39.    Edit9.Text  := Data[AINDEX].City;
  40.    Edit20.Text := Data[AINDEX].State;
  41.    Edit10.Text := Data[AINDEX].Country;
  42.    Edit11.Text := Data[AINDEX].Lat;
  43.    Edit12.Text := Data[AINDEX].Lon;
  44.   end;      

May look odd but the data I'm trying to write to disk is in a Dynamic Array of records. And I want it to look like this:

"|1CA|Nil|Nil|K2|Rio Vista Municipal|Rio Vista|CA|United States|38.19333333|-121.70361111| "

Because this performs IO to the screen I have a global Boolean VAR SLOW : Boolean = False; set. Therefore, Application.ProcessMessages; can be turned off.


FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

Zvoni

  • Hero Member
  • *****
  • Posts: 2319
Re: Disk Full Message Possible BUG
« Reply #6 on: September 04, 2019, 09:18:08 am »
What's the Value of "FileName" in your Line 14?
Because right now i can't make heads or tails from your code in Line 12 and Line 13
In Line 12, you construct your local var "FileName" from something called "C-BasePath" and "Bit2" (which you seem to use as a constant).
What's C_BasePath (Yes, i can guess what it is!)?
In the next Line you check a (boolean)-Variable from somewhere, and if True, you overwrite the Value in "FileName" with something called "LOC" and Bit2 again.
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

Bart

  • Hero Member
  • *****
  • Posts: 5275
    • Bart en Mariska's Webstek
Re: Disk Full Message Possible BUG
« Reply #7 on: September 04, 2019, 10:18:21 am »
Can you verify that Filename is what you expect it to be?
Put a ShowMessage('Filename="'+Filename+'"') in your code, just before the call to AssignFile.
IIRC DiskFull errors sometimes get raised on filenames windows cannot digest.

Bart

Zvoni

  • Hero Member
  • *****
  • Posts: 2319
Re: Disk Full Message Possible BUG
« Reply #8 on: September 04, 2019, 10:55:34 am »
Can you verify that Filename is what you expect it to be?
Put a ShowMessage('Filename="'+Filename+'"') in your code, just before the call to AssignFile.
IIRC DiskFull errors sometimes get raised on filenames windows cannot digest.

Bart
Exactly my thoughts.
Another suspicion i have is that thing with C_BasePath+SomeThing: looks like the C-Rootfolder, and that's a big no no
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

jamie

  • Hero Member
  • *****
  • Posts: 6090
Re: Disk Full Message Possible BUG
« Reply #9 on: September 04, 2019, 04:20:43 pm »
Prior to Assigning the file name do this..

Assert(DirectoryExists(FileName),'Oops, don't see directory '+FILENAME);

and turn on Asserts in your debugging panel for project options.
The only true wisdom is knowing you know nothing

JLWest

  • Hero Member
  • *****
  • Posts: 1293
Re: Disk Full Message Possible BUG
« Reply #10 on: September 05, 2019, 09:51:19 pm »
What's the Value of "FileName" in your Line 14?
Because right now i can't make heads or tails from your code in Line 12 and Line 13
In Line 12, you construct your local var "FileName" from something called "C-BasePath" and "Bit2" (which you seem to use as a constant).
What's C_BasePath (Yes, i can guess what it is!)?
In the next Line you check a (boolean)-Variable from somewhere, and if True, you overwrite the Value in "FileName" with something called "LOC" and Bit2 again.

Heads or Tails;
    Var
Line 6    Bit2     : String = 'BDX0.txt';

Line 9    ListBox5.ItemIndex := 0;             <-- Setting focus
Line 10  LevelUpperBoxes(0);                    <-- procedure which  set focus on 9 other listboxes
Line 11  Bit1 := AFileName;                       <-- Contains AFILENAME (Passed to the Write proc
Line 12  FileName := C_BasePath + Bit2;    <-- Explained below
Line 13  if OneDirectory then begin FileName := LOC + Bit2; end;  <-- Explained below
Line 14  AssignFile(OutFile, FILENAME);                                        <-- Explained below

 
I work with really large files, 8,9 and 11 million lines of Text files.

I keep all of these files on X:\FAAFiles\ . Which is declared:
Const  C_BasePath = 'X:\FAAFiles\';
In FormCreate I do a LOC := Application.Location;

So the procedure is called:

 SaveMstData('BDX0.txt');

 Bit1 := 'BDX0.txt';
 FileName := C_BasePath + Bit2; So  FileName = 'X:\FAAFiles\BDX0.txt' <--Normal file path

I have a GLOBAL software switch called OneDirectory : Boolean = False;

if OneDirectory is set to false the FileName at  Line 13  in the AssignFile(OutFile, FILENAME); will be  'X:\FAAFiles\BDX0.txt'.

if OneDirectory is set to True then the FILENAME at  Line 13  in the AssignFile(OutFile, FILENAME) will be 'D:\CurrentProject\ BDX0.txt';

I have this in all my read and write procedures for two reasons.

I can set up test data, throw the switch to True and work with a different set of data. And I do this where my program executable is loaded.

If I'm asked to post  a program, I can set the switch to True, zip the program and data and post. Whoever looks at it can build and run all in on directory. When there done delete the directory.

Hope this answer your questions.   
FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

JLWest

  • Hero Member
  • *****
  • Posts: 1293
Re: Disk Full Message Possible BUG
« Reply #11 on: September 05, 2019, 10:01:41 pm »
Can you verify that Filename is what you expect it to be?
Put a ShowMessage('Filename="'+Filename+'"') in your code, just before the call to AssignFile.
IIRC DiskFull errors sometimes get raised on filenames windows cannot digest.

Bart

I think so Bart. I ran it under the Debugger and it was correctly set.

When I got the disk full message I was running the program in normal mode. I then ran it under the debugger and got the same message.

Filename was correctly set.

So I set the ONEDIRECTORY switch to true and wrote to another drive just fine. Turned off the ONEDIRECTORY  switch, Disk Full.

Rebooted the computer and everything seems to work, can't reproduce the problem now. So I don't know if it's Windows 10 Pro, my Intel SSD Drive or Free Pascal problem.

FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

jamie

  • Hero Member
  • *****
  • Posts: 6090
Re: Disk Full Message Possible BUG
« Reply #12 on: September 05, 2019, 10:06:24 pm »
Back in older times, drive "X" was an invalid drive.

For example using the GetDir.

I don't know where it is these days
The only true wisdom is knowing you know nothing

PascalDragon

  • Hero Member
  • *****
  • Posts: 5446
  • Compiler Developer
Re: Disk Full Message Possible BUG
« Reply #13 on: September 09, 2019, 11:39:44 am »
Back in older times, drive "X" was an invalid drive.
Since at least Windows NT that isn't the case anymore.

Zvoni

  • Hero Member
  • *****
  • Posts: 2319
Re: Disk Full Message Possible BUG
« Reply #14 on: September 09, 2019, 12:04:04 pm »
Can you verify that Filename is what you expect it to be?
Put a ShowMessage('Filename="'+Filename+'"') in your code, just before the call to AssignFile.
IIRC DiskFull errors sometimes get raised on filenames windows cannot digest.

Bart

I think so Bart. I ran it under the Debugger and it was correctly set.

When I got the disk full message I was running the program in normal mode. I then ran it under the debugger and got the same message.

Filename was correctly set.

So I set the ONEDIRECTORY switch to true and wrote to another drive just fine. Turned off the ONEDIRECTORY  switch, Disk Full.

Rebooted the computer and everything seems to work, can't reproduce the problem now. So I don't know if it's Windows 10 Pro, my Intel SSD Drive or Free Pascal problem.
Your drive 'X', is that an external Drive?
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

 

TinyPortal © 2005-2018