EmClient rebuild database after hibernate

When my laptop goes into sleep when EmClient was still on and when I awake the systemit has to rebuild the database because of a corrupte shut down of the program it says.
Using Windows 10 (v2004) 64b.

What version of EM Client are you running ?

Latest (8.0.2820). But I have this with versions before.


@Wilco Ok. Do you close EM Client before your computer hibernates ?

You need to do a safe close on EC before sleep kicks in to assure the database will be OK.

No I do not close EMclient before hibernate or when it go to sleep.
@fitness. I guess this is the conclusion unfortunately. With Outlook I didn’t have these issues.

@Wilco Yes you normally do have to close EM Client before going into Hybernation or you will normally get database errors.

I guess Microsoft must have specially programmed Outlook .PST / .OST files to still work ok even when resumed from Hybernation mode.

Apparently Windows has by default a “Hybrid sleep mode” that is supposed to save open documents & applications to memory when it goes into hibernation mode to then automatically open when resumed, but obviously doesn’t guarantee to work with all programs such as EM Client.

This could be bug in eM Client 8. In version 7 there are no problems with hibernation or sleep. I’m using most stable version 7.2.37929.0.
If You can, try to download previous version from release history page.
It is very likely you will have to delete current database and start fresh.

@cyberzork You are wrong, little other programs have problems with sleep or hibernation, be it SQL databases, graphics editors, browsers and many more, and that are results of bugs in these programs, not sleep/hibernation behaviour. I am programmer and did many programs, some with SQL (sqlite, mssql/localdb, hash tables/db) for multiple systems (Windows/Linux/FreeBSD) and when you do no error, there are no possibility your program will not work with sleep.
Sometimes you have to make some bypasses (i.e. for no network or not initialized devices when waking from sleep) but this is only something which you should think about and care.

I agree with you Sylwester. I am using 7.2.37629.0, and my computer frequently sleeps and hibernates. In fact I have em Client starting when the computer first starts up, and I never close it. I rarely get database corruption. my system sleeps after 30 minutes of inactivity, and hibernates after a further 30 minutes. I often walk away in the evening, and resume from hibernate the following

cyberzok’s assertion that you are wrong is incorrect. Further - it is not reasonable to expect the user to close em Client before the computer goes into sleep. The whole point of sleep, and hibernate, is that if you are called away from the computer then it will go into an energy efficient mode. The user cannot know that they are going to be away for a while. and therefore in general will not be aware of the need to close em Client.

Windows sends a ‘Suspend’ event to em Client before the computer enters sleep or hibernate. em Client should react to that event by saving the databases into a known state. If it is not - then that is an em Client bug.

1 Like

With regards to earlier EC version 6/7 sleeping peacefully and waking ready to go to work…yes sometimes it did and sometimes I would see the database getting repaired after awaking from sleep. I didn’t know if it was me not closing it down first…but now I read it could have been a glitch…I’ll look to see if this happens in v.8.

@Sylwester_Zarebski That’s great that you and others on this thread claim EM Client 7 works perfectly with Windows Hybernation mode.

Any open file or open application can potentially fail to resume after hybernation or normal Windows restart as I personally have found over the years with all versions of Windows & many different applications.

Windows is automatically saving the file & application to memory in hybernation mode & then restoring them on resume, but anything could go wong in memory and sometimes does. Better in my opinion to close files & applications first to avoid any possible issues.

Same applies for open files when autobacking up on servers. Yes there is many programs that can backup when files are open, but again as I’ve found over the years that doesn’t always guarantee to work everytime & can fail.

Good luck to all with hybernate / resumes working everytime 100% without fail.

You are drawing false conclusions. Windows just save memory to disk (in case of hibernation) or even do not save anything in case of sleep, but just go to lower energy state of CPU/chipset/disk. Access to disks/storage devices are halted/paused, but on any access disks are waken. After wake only when there are some problems (ie. disk is not responding for few minutes) system functions return error codes, before that system functions to read/write to disk just halt.
On properly functioning system with not broken sleep/wake functionality (i.e. because of broken BIOS inits after wake or bugged drivers), there are little to no possibility that any app can distinguish between before sleep and after wake, other than catching global system events of sleep/wake or making assumptions by checking time clock.
In case of hibernation there are no general saving files to disk - open some file in notepad, make changes, do not save them, hibernate, wake and see, that your opened file is still not saved to disk.
Some, i repeat, some programs catch global system events of sleep/hibernate/wake to do some actions, but this is not general idea, but option to work. Properly designed software has little need for catching these event and mostly working with them can introduce deeply hidden bugs which shows only in some situations.

Properly designed network software must be prepared for situations when there are no network even local, you must not do assumptions that connection will work, because it mostly doesn’t.
The same is for making database accesses, connection could be broken just because it is possible and making assumptions it will not is just plain wrong. Going sleep or hibernate would close all network connections (even local ones) and it is normal and proper behaviour.
In case of SQLite (which eM Client uses) there are many good practices which says, that you should close the database and resultset with each operation and not keeping connections open.
Maybe this is real culprit of problems with eM Client 8.

Comparison to backup is false, because saving memory to disk in case of hibernation is completely other thing than locked open files in Windows. Other system has no concept of locked open files, which could be opened in memory-mapped mode nevertheless.

PS. There may be that eM Client 8 is innocent and problem lies in OP computer (i.e. bugged drivers), but this can’t be solved without close cooperation between OP and eM Client staff.

PPS. I’ve just noticed that You wrote save to memory in context of hibernation. Hibernation saves memory to non-volatile storage i.e. disk to allow being PC completely turned off, not other way.
Even there would be no saving at all if You have non-volatile memory, and hibernation then would be better than sleep (allowing turning off instead of only lower energy states).

I have problem too. After sleep any version 8, maybe work or it crashed (disappear). And need start again. And no problem with version 7 on same PC.