Postgres is going to sleep or something...
doug at artsman.com
Wed Feb 2 19:24:02 UTC 2022
when you say ‘it' goes to sleep, do you mean your omnis connection? Meaning its omnis that you are using and its gone to sleep.
OR, do you mean that if you also start up pgadmin or have a pgadmin connection going, that pgadmin also loses its connection?
if its omnis — you you allow that to go into energy saver mode? if you do, postgres won’t be sleeping, but I suspect omnis put a bunch of things to sleep or your computer put things to sleep, like maybe your network connection.
Mac’s and windows are notorious for sleeping things to make them energy efficient. I’ve had to diagnose a couple of clients' windows machines this month where (out of the box), they kept discconnecting from the server. There is a setting on windows ethernet cards that need to be set to never turn off.
needless to say, energy efficient is not efficient for developers.
here is a list of things we tell people to do when installing postgres on machines. It is not postgres that is the issue, per se, its omnis. some of these may help you.
finally, it could be the dam going to sleep. If anybody has any knowledge of a connection time limit setting in the dam, I’d love to hear about it. I haven’t gone looking — here are the things you can set on postgres
now, we have people that wander around with laptops that go from one wifi to another, or close their machines. so we have implemented a way to check the connection status
you can. check the state
and we also have a retry count on some sql statement — so if we retry a read a few times and it fails, then we figure out its been disconnected. then we re-login again.
whats all this compared to omnis multi user connections or sqllite.
with sql-litem, you don’t worry — its all file based. the machine wakes up, the file system wakes up. its single user, so not a problem
with omnis databases, whether using data bridge or not, you have to worry about disconnects and have to test for those cases.
with postgres, once you establish a connection, it is permanent. unless you put some component of your machine to sleep (even inadvertently - app nap will do it) or purposely (like closing the lid of the laptop and putting to sleep).
omnis does not recover the dam connection — you have to do that yourself. and thats because postgres notices that you hung up on it.. it will give you a bit of time, but it will clear the connection if you go away — you thne have to log in again.
this is far better than the data bridge that leaves things kind of locked up if you put machines to sleep (based on the many years that we used the data bridge, sleep on a machine was always a problem)
hope that helps.
Arts Management Systems Ltd.
mailto:doug at artsman.com
Phone (403) 650-1978
> On February 2, 2022, at 9:42 AM, Das Goravani <goravanis at gmail.com> wrote:
> If some time passes and I have not logged on and done something it seems postgres is going to sleep because I cannot log on
> When I hit the logon command I get the watch and I have to type command period to get my cursor back
> Postgres is on my Mac server
> I have long ago done all the things you need to do to not let your server sleep
> My server is serving my web sites no problem, it is not going to sleep, for years now
> Today it did this … it went to sleep so to speak
> So I did a Terminal command string to start up postgres
> It went through the motions and said "server started"
> Would it say "server is already started" if it were already started?
> Trying to get to the bottom of why I can’t log on if I haven’t done so in awhile
> The time that passes is hours, it takes hours for it to go to sleep
> I know Doug said that it doesn’t go to sleep
> Yes, I have installed using the Enterprise DB installer for Mac, which Doug said turns postgres on permanently so to speak
> So I’m confused as to why I am getting this hanging behavior when I try to log on after awhile
> Manage your list subscriptions at https://lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com
More information about the omnisdev-en