Context Store damaged after Windows update


last night my windows server rebooted after the November update. After restart Node-RED did not started:

Welcome to Node-RED

14 Nov 07:27:22 - [info] Node-RED version: v1.0.1
14 Nov 07:27:22 - [info] Node.js  version: v10.15.1
14 Nov 07:27:22 - [info] Windows_NT 10.0.17763 x64 LE
14 Nov 07:27:23 - [info] Loading palette nodes
14 Nov 07:27:24 - [info] node-red-contrib-milight-2@1.0.8 started
14 Nov 07:27:25 - [info] Dashboard version 2.17.1 started at /ui
14 Nov 07:27:26 - [info] node-red-contrib-ccu version: 3.0.0
14 Nov 07:27:26 - [info] Settings file  : \Users\cmeinert\.node-red\settings.js
14 Nov 07:27:26 - [info] Context store  : 'memoryOnly' [module=memory]
14 Nov 07:27:26 - [info] Context store  : 'file' [module=localfilesystem]
14 Nov 07:27:26 - [error] Failed to start server:
14 Nov 07:27:26 - [error] Error: Error loading context store: SyntaxError: Unexpected token   in JSON at position 0
    at C:\Users\cmeinert\AppData\Roaming\npm\node_modules\node-red\node_modules\@node-red\runtime\lib\nodes\context\index.js:177:15

I opened the ".json" files and 2 from 3 where filled with nulls. Ups. I‘m running NodeRED as a service and reboots did not caused any problems. I don`t know how these files are written but perhaps the old method of writing a new one and then rename the old to an .bak-file and then rename the new to .json can a) prevent this and b) allways provide a recent backup.

I thought modern OSes have overcome this problem but ... I don`t want to stop windows from autoupdates as they keep an headless server as protected as possible.

Deleting this files made the server start again but I lost all my recent configurations stored there ...

Any Ideas what I can do to prevent this in the future (beside "save often save early", "allways have a backup on hand" or "switch over to linux" :wink: