It is possible that sometimes Xfmdataosurce tends to get hung and will not shutdown gracefully. But it should be a rare scenario and not happening regularly. Also We need make sure DB is fine and there is no network issues or other environmental issues.
Generlly dsstartup option as 0 which is default. This means when application will be shutdown automatically when the last user logs out. Frequent shutdown and startup can also cause issues sometimes. It is better to make dsstartup option to 2 which means application datasource starts when first user tries to login and will be active until HFM Java services are stopped.
To do this open Workspace go to Navigate->Administer->Consolidation Administration->System-> Settings-> Look for DSSStartup options in the list of settings and change the value to 2 and save it, Log out and Restart HFM Services for changes to take affect.
Thanks,
Mady