pg_ctl wrong status info on Windows

Started by Lucian Curelaruabout 14 years ago4 messagesbugs
Jump to latest
#1Lucian Curelaru
lucian.curelaru@gmail.com

Hi

I have a Postgresql 9.1.2 installed on a Windows 7 machine and noticed
the following thing:

- I start the postgresql by windows service ( on default port )
- when I run pg_ctl -D on the same data directory the response is "no
server running" even the server is in fact running already
- if I try to start using pg_ctl start ... I receive the error that
the port is occupied ( correct )
- if I try to start it on a diffrent port.. the start is succesful and
I'm able to run two servers on same data via two diffrent ports. I've
connected to them and modified diffrent things in the two databases :)
and the databases behived like diffrent ones until the next restart of
both servers when inserted data has mixed and messed up ( partially
was lost / partially mixed up)
Anyway.. back to the original issue it seems not ok from my point of
view that pg_ctl seems not to be aware of the postgres instance
started by the windows service. I've tried also to first start server
from pg_ctl and then from service.. and the service tried to start and
then aborted leaving the current server to run alone (correct)
I've noticed also that the windows service is creating the pid file
but the pg_ctl seems to ignore it on status commands and overwrite it
on start commands.
On the other hand I've performed several tests (starting , stoping
,status servers on same datadir) only with pg_ctl and all seems to
work correctly.
Am I missing something or just find a bug?

Lucian

#2Xiong He
iihero@qq.com
In reply to: Lucian Curelaru (#1)
Re: pg_ctl wrong status info on Windows

When you install PG as a service, the default service account is "postgres".
But when you run cmd line: pg_ctl status
It's running under your current user account other than "postgres".

Could you run:
runas /user:postgres cmd
Then in the new command window: pg_ctl status

------------------
----------------------------------------------------------
iihero(Xiong He) http://www.sql9.com
----------------------------------------------------------

------------------ Original ------------------
From: "Lucian Curelaru"<lucian.curelaru@gmail.com>;
Date: Thu, Apr 5, 2012 11:22 PM
To: "pgsql-bugs"<pgsql-bugs@postgresql.org>;

Subject: [BUGS] pg_ctl wrong status info on Windows

Hi

I have a Postgresql 9.1.2 installed on a Windows 7 machine and noticed
the following thing:

- I start the postgresql by windows service ( on default port )
- when I run pg_ctl -D on the same data directory the response is "no
server running" even the server is in fact running already
- if I try to start using pg_ctl start ... I receive the error that
the port is occupied ( correct )
- if I try to start it on a diffrent port.. the start is succesful and
I'm able to run two servers on same data via two diffrent ports. I've
connected to them and modified diffrent things in the two databases :)
and the databases behived like diffrent ones until the next restart of
both servers when inserted data has mixed and messed up ( partially
was lost / partially mixed up)
Anyway.. back to the original issue it seems not ok from my point of
view that pg_ctl seems not to be aware of the postgres instance
started by the windows service. I've tried also to first start server
from pg_ctl and then from service.. and the service tried to start and
then aborted leaving the current server to run alone (correct)
I've noticed also that the windows service is creating the pid file
but the pg_ctl seems to ignore it on status commands and overwrite it
on start commands.
On the other hand I've performed several tests (starting , stoping
,status servers on same datadir) only with pg_ctl and all seems to
work correctly.
Am I missing something or just find a bug?

Lucian

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

#3Lucian Curelaru
lucian.curelaru@gmail.com
In reply to: Xiong He (#2)
Re: pg_ctl wrong status info on Windows

Hi

I've already tried yesterday to switch the service from the postgres
acount to the local acount but the result was the same. I'll check
again also your solution and get back.

Lucian

On Fri, Apr 6, 2012 at 2:21 AM, iihero <iihero@qq.com> wrote:

When you install PG as a service,  the default service account is
"postgres".
But when you run cmd line:  pg_ctl status
It's running under your current user account other than "postgres".

Could you run:
runas /user:postgres cmd
Then in the new command window:  pg_ctl status

------------------
----------------------------------------------------------
iihero(Xiong He)  http://www.sql9.com
----------------------------------------------------------

------------------ Original ------------------
From:  "Lucian Curelaru"<lucian.curelaru@gmail.com>;
Date:  Thu, Apr 5, 2012 11:22 PM
To:  "pgsql-bugs"<pgsql-bugs@postgresql.org>;
Subject:  [BUGS] pg_ctl wrong status info on Windows

Hi

I have a Postgresql 9.1.2 installed on a Windows 7 machine and noticed
the following thing:

- I start the postgresql by windows service ( on default port )
- when I run pg_ctl -D on the same data directory the response is "no
server running" even the server is in fact running already
- if I try to start using pg_ctl start ...   I receive the error that
the port is occupied ( correct )
- if I try to start it on a diffrent port.. the start is succesful and
I'm able to run two servers on same data via two diffrent ports. I've
connected to them and modified diffrent things in the two databases :)
and the databases behived like diffrent ones until the next restart of
both servers when inserted data has mixed and messed up ( partially
was lost / partially mixed up)
Anyway.. back to the original issue it seems not ok from my point of
view that pg_ctl seems not to be aware of the postgres instance
started by the windows service. I've tried also to first start server
from pg_ctl and then from service.. and the service tried to start and
then aborted leaving the current server to run alone (correct)
I've noticed also that the windows service is creating the pid file
but the pg_ctl seems to ignore it on status commands and overwrite it
on start commands.
On the other hand I've performed several tests (starting , stoping
,status servers on same datadir) only with pg_ctl and all seems to
work correctly.
Am I missing something or just find a bug?

Lucian

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

--
http://luci.astroclubul.org/
http://luci.astroclubul.org/gallery/

#4Lucian Curelaru
lucian.curelaru@gmail.com
In reply to: Lucian Curelaru (#3)
Re: pg_ctl wrong status info on Windows

Hi

You were right. This was the problem. I've modified yesterday the user
for the service but beeing in a rush I've used the system user not the
logged user so the situation was quite same. I've cheched now your
solution and worked. Also switching the service user to same user you
run the pg_ctl also worked.
Thanks!

Lucian

On Fri, Apr 6, 2012 at 8:12 AM, Lucian Curelaru
<lucian.curelaru@gmail.com> wrote:

Hi

I've already tried yesterday to switch the service from the postgres
acount to the local acount but the result was the same. I'll check
again also your solution and get back.

Lucian

On Fri, Apr 6, 2012 at 2:21 AM, iihero <iihero@qq.com> wrote:

When you install PG as a service,  the default service account is
"postgres".
But when you run cmd line:  pg_ctl status
It's running under your current user account other than "postgres".

Could you run:
runas /user:postgres cmd
Then in the new command window:  pg_ctl status

------------------
----------------------------------------------------------
iihero(Xiong He)  http://www.sql9.com
----------------------------------------------------------

------------------ Original ------------------
From:  "Lucian Curelaru"<lucian.curelaru@gmail.com>;
Date:  Thu, Apr 5, 2012 11:22 PM
To:  "pgsql-bugs"<pgsql-bugs@postgresql.org>;
Subject:  [BUGS] pg_ctl wrong status info on Windows

Hi

I have a Postgresql 9.1.2 installed on a Windows 7 machine and noticed
the following thing:

- I start the postgresql by windows service ( on default port )
- when I run pg_ctl -D on the same data directory the response is "no
server running" even the server is in fact running already
- if I try to start using pg_ctl start ...   I receive the error that
the port is occupied ( correct )
- if I try to start it on a diffrent port.. the start is succesful and
I'm able to run two servers on same data via two diffrent ports. I've
connected to them and modified diffrent things in the two databases :)
and the databases behived like diffrent ones until the next restart of
both servers when inserted data has mixed and messed up ( partially
was lost / partially mixed up)
Anyway.. back to the original issue it seems not ok from my point of
view that pg_ctl seems not to be aware of the postgres instance
started by the windows service. I've tried also to first start server
from pg_ctl and then from service.. and the service tried to start and
then aborted leaving the current server to run alone (correct)
I've noticed also that the windows service is creating the pid file
but the pg_ctl seems to ignore it on status commands and overwrite it
on start commands.
On the other hand I've performed several tests (starting , stoping
,status servers on same datadir) only with pg_ctl and all seems to
work correctly.
Am I missing something or just find a bug?

Lucian

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

--
http://luci.astroclubul.org/
http://luci.astroclubul.org/gallery/

--
http://luci.astroclubul.org/
http://luci.astroclubul.org/gallery/