history files.json

ertank
Posts: 61
Joined: 06.06.2021 21:56

history files.json

Post by ertank »

Hello,

I am using CudaText 1.142.0.0 win64-x86

For some reason I filled up my entire drive where CudaText is installed. At that point history files.json size turned zero.

I cleared up some space but even after a restart CudaText gives error message on each auto file reload. (I did not save that error message)

Problem was probably due to empty file not having a valid json string inside.

Quite a corner case, but just wanted to share in here.
main Alexey
Posts: 2708
Joined: 25.08.2021 18:15

Post by main Alexey »

Maybe I can add checking for free-disk-space, require at least 1 M and give an error if it's less.
main Alexey
Posts: 2708
Joined: 25.08.2021 18:15

Post by main Alexey »

Done, pls test the beta (I tested it on drive C:, but I don't get situation when disk space is low)
http://www.uvviewsoft.com/c/
ertank
Posts: 61
Joined: 06.06.2021 21:56

Post by ertank »

main Alexey wrote:Maybe I can add checking for free-disk-space, require at least 1 M and give an error if it's less.
Empty disk space check should work. I will see if I can repeat the problem.
When I faced the problem for the first time, CudaText was running and I tried to restore a big database backup which in time filled up my entire drive. What I was thinking as a solution is when starting/stopping check history.json file size. If filesize is zero, simply delete it. Deleting fixes the issue as far as I can tell.
Empty disk space check might miss when CudaText is actually running in the memory.
main Alexey
Posts: 2708
Joined: 25.08.2021 18:15

Post by main Alexey »

> If filesize is zero, simply delete it. Deleting fixes the issue as far as I can tell.

It will hide the error (on next Cud start) but... file will be lost (history file). with the current update, you get a warning, do Alt+Tab, free space, Alt+Tab, click Retry btn.
ertank
Posts: 61
Joined: 06.06.2021 21:56

Post by ertank »

Hello,

I got another problem with "history session.json" recently.

I got my computer locked when CudaText was running, and I forcefully power down it. When I run CudaText the next time, I see below error:

Code: Select all

ERROR: Cannot parse config: history session.json; "E:\cudatext\settings\history session.json" is not a valid JSON configuration file.
Problem is, this error never clears. It stays on for each startup and my skin of choice is not used but the default one. When I check mentioned file, Notepad++ displayed its content as in attached image.

I am using a NVMe and forceful power down may result any open file to be filled with all NULL values like this. It has happened to me even for my code files.

It would be nice to see error message. It would be great if CudaText identify file as all NULL and simply deletes/overwrites. There will be no data loss as all data is lost already.

Thank you for your consideration.

Regards,
Ertan
Attachments
Capture.JPG
main Alexey
Posts: 2708
Joined: 25.08.2021 18:15

Post by main Alexey »

Notepad++ shows that file is filled with NULs. so Cud tells you that it's incorrect. JSON file cannot contain NULs. The only remedy - delete this file.

EDIT
Maybe I can add detectioon if such files - if the first file byte is NUL. But silently delete such file? it's bad UX for users, IMO.
ertank
Posts: 61
Joined: 06.06.2021 21:56

Post by ertank »

main Alexey wrote: Maybe I can add detectioon if such files - if the first file byte is NUL. But silently delete such file? it's bad UX for users, IMO.
I was actually asking for such a solution as such files are really useless and only option is to delete them anyway.
main Alexey
Posts: 2708
Joined: 25.08.2021 18:15

Post by main Alexey »

OK, I added the checks for null bytes (for 3 cases: history.json, history files.json, and session files).
It will give an error msgbox which allows to delete this bad file, if you press OK.
main Alexey
Posts: 2708
Joined: 25.08.2021 18:15

Post by main Alexey »

You can test it
http://uvviewsoft.com/c/
Post Reply