Sublime Forum

Lost an afternoon's work using ST2

#1

I just lost an entire afternoon’s work using ST2, and was wondering if anyone else has run into a similar situation.

Here’s what happened:

  • I plugged my laptop in at a Starbucks and did several hours work which involved creating a new file in ST2 as well as editing several other files using a different text editor (jEdit). Being my normal, cautious self, I saved all edited files frequently. The ST2 file was probably last edited and saved an hour or two before I wrapped up the session.
  • My Windows 7 laptop was (unknown to me) suffering from the bug that prevents charging the battery when plugged in. The battery had over time lost its charge (since the bug was preventing it from charging). So when I left Starbucks and closed the lid and unplugged it, the machine crashed.
  • When I got home and went to resume editing the file, I first had to wait while the machine mysteriously had to re-boot (I didn’t know about the battery bug at this point).
  • Once re-booted, I restarted ST2, only to find that the file I had been editing was blank.
  • All of the other files I had been editing in jEdit were fine.
  • The ST2 file existed, and had a size of about 5K (probably the right size), but when I checked its contents more closely, I found that every byte was a \x00.

Now, I’m tempted to blame this on the Windows 7 file cache never having been flushed to disk before the crash, but since it probably had over a hour before the crash to flush it to disk, I doubt that is the problem. And since the jEdit files were all fine, this leads me to think that somehow ST2 was involved in the lost data.

I don’t know if ST2 was to blame, but it does now have the dubious distinction of being the only text editor I have used in the last 20 years that has caused me to lose data :frowning:

0 Likes

#2

Maybe you have a Dell computer with this setting?

0 Likes

#3

Sublime usually saves work during a powerout, with the autosave/session feature.

Ouch. An on_save backup plugin could better your odds.

0 Likes

#4

Sublime Text does a simple fopen, fwrite, fclose sequence to write a file. Null bytes are not written to disk at any point.

0 Likes

#5

[quote=“iamntz”]Maybe you have a Dell computer with this setting?
[/quote]

Actually it is a Samsung. Once I realized there was a problem, I googled for it and quickly found that it was a fairly common Windows 7 bug. I followed a long sequence of steps to remedy the problem, and the end result was that the battery started charging again. Don’t know why the problem suddenly starting occurring, but it seems to be gone for the moment…

0 Likes

#6

I thought I had something similar happen to a tomcat .log file I had open just now and I remembered this post and thought I’d mention it. I had deleted everything in it and saved it to get a clean log, did some testing, went back to the tomcat log file tab and it looked something similar, mostly (but not all) null bytes. Then i realized it looked a lot like the hex editor that ST2 uses for binary files, so I used the reopen with encoding option to UTF-8 and it looked normal again. Every time I open that file however it still opens it in hex and to view it normally I have to reopen with encoding. Restarting ST2 doesn’t seem to fix it. All my other log files open normally though…

0 Likes