Are you using the
httpd module by any chance?
The default configuration randomizes the port it listens on to avoid conflicts with other apps.
This does however create a new LocalStorage database for each port which makes it look like it's being cleared out on each app restart.
If you're using LocalStorage you'll therefore need to set a fixed port for your app: