Recent

Author Topic: recover files after ide crash  (Read 934 times)

Чебурашка

  • Hero Member
  • *****
  • Posts: 568
  • СЛАВА УКРАЇНІ! / Slava Ukraïni!
recover files after ide crash
« on: October 05, 2022, 10:09:19 am »
Hello,
today lazarus (2.0.10 on debian 11.5) crashed while I was editing files and I lost some work.

I was wondering if lazarus has the feature that stores on filesystem the modified files (unsaved) while they are being edited, and in case of crash it proposes to recover them. I haven't found it.

Thank you
FPC 3.2.0/Lazarus 2.0.10+dfsg-4+b2 on Debian 11.5
FPC 3.2.2/Lazarus 2.2.0 on Windows 10 Pro 21H2

Чебурашка

  • Hero Member
  • *****
  • Posts: 568
  • СЛАВА УКРАЇНІ! / Slava Ukraïni!
Re: recover files after ide crash
« Reply #1 on: October 10, 2022, 11:15:05 am »
Any idea or suggestion?
Thanks
FPC 3.2.0/Lazarus 2.0.10+dfsg-4+b2 on Debian 11.5
FPC 3.2.2/Lazarus 2.2.0 on Windows 10 Pro 21H2

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: recover files after ide crash
« Reply #2 on: October 10, 2022, 11:30:04 am »
Don't believe so, since generally speaking any modern OS will provide enough memory (i.e. handling paging if required) for them to be handled in-RAM.

You'll find that there might be backup files either in a backup directory or ending with ~, depending on how you've set up your IDE.

Full marks for giving the version of Lazarus and OS you're using. I'm pretty sure I ran that for some while (current is 2.2) at least on Debian 10 without seeing crashes.

In the spirit of closing the stable door after the horse has bolted, I'd remark that I do a compile/save on a fairly regular basis so my files are rarely more than a few minutes out of date. I'd also remark that having an accessible VCS (version control system) is a valuable asset, and that it's easy to build Subversion without Apache which leaves it suitably "lean and mean". Other people recommend Git, but that's really overkill unless engaged in cooperative development.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

balazsszekely

  • Guest

Чебурашка

  • Hero Member
  • *****
  • Posts: 568
  • СЛАВА УКРАЇНІ! / Slava Ukraïni!
Re: recover files after ide crash
« Reply #4 on: October 10, 2022, 01:41:32 pm »
Don't believe so, since generally speaking any modern OS will provide enough memory (i.e. handling paging if required) for them to be handled in-RAM.

You'll find that there might be backup files either in a backup directory or ending with ~, depending on how you've set up your IDE.

Full marks for giving the version of Lazarus and OS you're using. I'm pretty sure I ran that for some while (current is 2.2) at least on Debian 10 without seeing crashes.

In the spirit of closing the stable door after the horse has bolted, I'd remark that I do a compile/save on a fairly regular basis so my files are rarely more than a few minutes out of date. I'd also remark that having an accessible VCS (version control system) is a valuable asset, and that it's easy to build Subversion without Apache which leaves it suitably "lean and mean". Other people recommend Git, but that's really overkill unless engaged in cooperative development.

MarkMLl

Normally I also compile/build often, but in this unfortunate case I was editing one of those 30000 lines file with some DB related table structure definitions that I love so much.
FPC 3.2.0/Lazarus 2.0.10+dfsg-4+b2 on Debian 11.5
FPC 3.2.2/Lazarus 2.2.0 on Windows 10 Pro 21H2

Чебурашка

  • Hero Member
  • *****
  • Posts: 568
  • СЛАВА УКРАЇНІ! / Slava Ukraïni!
Re: recover files after ide crash
« Reply #5 on: October 10, 2022, 01:58:53 pm »
There is an autosave package in OPM:
https://forum.lazarus.freepascal.org/index.php?topic=41050.0
https://forum.lazarus.freepascal.org/index.php/topic,41052.0.html

If I understand correctly, the one described in the post is a "periodic auto save=just like I press the Save button, but instead of me to do it, it is the underlying thread doing that".

I do not think this is how the feature should be implemented, instead I believe it should work like this:

If I press save (or, if enabled the autosave, I do compile/build/run) then the target file has to be modified permanently on the filesystem and any temporary file related to the target file has to be deleted.

Otherwise, while I modify the file (save every keypress? every Xms if modified? we can talk about), the IDE has to maintain a separate file where my modifications have to be persisted on filesystem, so that, in case of any IDE crash, once I reboot the IDE, it finds that there where unsaved modifications, and proposes me to recover these modifications (in the editor windows, not overwriting the target file). If I do recover I will continue my previously interrupted editing, otherwise I simply restart from original file how it was at last "save".

This is how I expect to work.

FPC 3.2.0/Lazarus 2.0.10+dfsg-4+b2 on Debian 11.5
FPC 3.2.2/Lazarus 2.2.0 on Windows 10 Pro 21H2

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: recover files after ide crash
« Reply #6 on: October 10, 2022, 02:00:19 pm »
Normally I also compile/build often, but in this unfortunate case I was editing one of those 30000 lines file with some DB related table structure definitions that I love so much.

I sympathise, while typing I was wondering what sort of situations make me skip the "save often" rule and the obvious answer is a big systematic edit that can't easily be done by a replace operation.

However at that point I think we both need to ask ourselves: instead of editing thousands of lines of code in-situ, would it be better to write a 25-line program (not necessarily in Pascal) that regenerated it from some other form? For example, I think the last oversized edit I did was related to writing a disassembler based on C&Ped documentation, while in your case you might be able to work from some sort of database metadata.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Чебурашка

  • Hero Member
  • *****
  • Posts: 568
  • СЛАВА УКРАЇНІ! / Slava Ukraïni!
Re: recover files after ide crash
« Reply #7 on: October 10, 2022, 02:17:03 pm »
Normally I also compile/build often, but in this unfortunate case I was editing one of those 30000 lines file with some DB related table structure definitions that I love so much.

I sympathise, while typing I was wondering what sort of situations make me skip the "save often" rule and the obvious answer is a big systematic edit that can't easily be done by a replace operation.

However at that point I think we both need to ask ourselves: instead of editing thousands of lines of code in-situ, would it be better to write a 25-line program (not necessarily in Pascal) that regenerated it from some other form? For example, I think the last oversized edit I did was related to writing a disassembler based on C&Ped documentation, while in your case you might be able to work from some sort of database metadata.

MarkMLl

Thanks for the suggestion.

I have a big file containing a enum and a array[enum] containing the instructions to build a xml file that will be later used to generate the sql to create the dbstructure in sqlite/postgresql/sqlserver using liquibase. And also the array[enum] is used around the code in order to automatically generate the table names, some queries, the field list (for copying data) and so on and so on and so on and so on and so on...

It a weird usage that is quite effective in my context, and, fortunately, I was not in need of modifying very often, only this time that I had to revise certain datastructures.

Anyway, I believe that unsaved file recovery would be nice regradless... IDEs (in general) can crash from time to time.

FPC 3.2.0/Lazarus 2.0.10+dfsg-4+b2 on Debian 11.5
FPC 3.2.2/Lazarus 2.2.0 on Windows 10 Pro 21H2

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: recover files after ide crash
« Reply #8 on: October 10, 2022, 02:22:46 pm »
IDEs (in general) can crash from time to time.

Rare in the case of Lazarus. The biggest problem I experience is putting a breakpoint in the wrong place which locks up the desktop... a root login via <Ctrl><Alt><F1> sorts that out, and since everything will be saved before a compilation there should be no loss.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Чебурашка

  • Hero Member
  • *****
  • Posts: 568
  • СЛАВА УКРАЇНІ! / Slava Ukraïni!
Re: recover files after ide crash
« Reply #9 on: October 10, 2022, 02:30:06 pm »
IDEs (in general) can crash from time to time.

Rare in the case of Lazarus. The biggest problem I experience is putting a breakpoint in the wrong place which locks up the desktop... a root login via <Ctrl><Alt><F1> sorts that out, and since everything will be saved before a compilation there should be no loss.

MarkMLl

I confirm the breakpoint while debugging graphical applications is (a little) problematic.

But what created problems to me was unrelated to debugging, IDE was disappearing while doing some activity on the IDE windows (my brain circular cache was filled up of bad words and the record of the actual situation in which was occurring is now lost, next time I will try to memorize if happend again).
FPC 3.2.0/Lazarus 2.0.10+dfsg-4+b2 on Debian 11.5
FPC 3.2.2/Lazarus 2.2.0 on Windows 10 Pro 21H2

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: recover files after ide crash
« Reply #10 on: October 10, 2022, 02:53:05 pm »
I confirm the breakpoint while debugging graphical applications is (a little) problematic.

I think the problem is limited to event handlers.

Quote
But what created problems to me was unrelated to debugging, IDE was disappearing while doing some activity on the IDE windows (my brain circular cache was filled up of bad words and the record of the actual situation in which was occurring is now lost, next time I will try to memorize if happend again).

That definitely shouldn't be happening. The usual cause is starting up the IDE from a shell and- for some reason- either closing the shell session or inadvertently feeding it a ^C (or some other signal).

Apart from that... I'd suggest running top to make sure that you're not heading towards resource exhaustion (which might cause the kernel to start killing processes) and to check your hardware: note Torvalds' recent experience where something he initially thought was a kernel problem turned out to be dud DIMMs (and the expected rant about the paucity of quallity ECC DIMMs).

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Чебурашка

  • Hero Member
  • *****
  • Posts: 568
  • СЛАВА УКРАЇНІ! / Slava Ukraïni!
Re: recover files after ide crash
« Reply #11 on: October 10, 2022, 03:07:30 pm »
Quote
That definitely shouldn't be happening. The usual cause is starting up the IDE from a shell and- for some reason- either closing the shell session or inadvertently feeding it a ^C (or some other signal).

No, I ran laz from kde startup menu.


Quote
Apart from that... I'd suggest running top to make sure that you're not heading towards resource exhaustion (which might cause the kernel to start killing processes) and to check your hardware: note Torvalds' recent experience where something he initially thought was a kernel problem turned out to be dud DIMMs (and the expected rant about the paucity of quallity ECC DIMMs).

MarkMLl

I an in a VM 4Gb, and I was editing just that file, and sometimes running the program inside the IDE to generate an xml file on the filesys, I have difficulty to think about resource fillup.
Also, the stuff of the DIMMs, might be of course but this machine is kinda new and I did not see any other problem on it so far (and I also ran couple of times the bios mem inspection tools)

Anyway, if it happens again, I will try to remain calm (difficult :D) and make up a more serious analysis of reproducibility.

To be honest? I still have 101% respect and faith in lazarus no matter what.
FPC 3.2.0/Lazarus 2.0.10+dfsg-4+b2 on Debian 11.5
FPC 3.2.2/Lazarus 2.2.0 on Windows 10 Pro 21H2

 

TinyPortal © 2005-2018