<?xml version="1.0" encoding="UTF-8" ?>

<bugzilla version="5.2"
          urlbase="https://bugzilla.altlinux.org/"
          
          maintainer="jenya@basealt.ru"
>

    <bug>
          <bug_id>2887</bug_id>
          
          <creation_ts>2003-08-27 16:26:03 +0400</creation_ts>
          <short_desc>postgresql silently fails to start if pidfile exists</short_desc>
          <delta_ts>2012-03-16 13:57:12 +0400</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>4</classification_id>
          <classification>Development</classification>
          <product>Sisyphus</product>
          <component>postgresql-server</component>
          <version>unstable</version>
          <rep_platform>all</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>blocker</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>3459</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Michael Shigorin">mike</reporter>
          <assigned_to name="Denis Smirnov">mithraen</assigned_to>
          <cc>ldv</cc>
    
    <cc>mithraen</cc>
    
    <cc>ns</cc>
    
    <cc>rider</cc>
          
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>5817</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Shigorin">mike</who>
    <bug_when>2003-08-27 16:26:03 +0400</bug_when>
    <thetext>trickster:~&gt; sudo service postgresql restart            
Service postmaster is not running. [PASSED]
Adjusting environment for postgresql: [ DONE ]
Starting postmaster service: [ DONE ]
Link postgresql socket: [FAILED]
[...strace session =&gt; problem indication skipped...]
[root@trickster root]# rm /etc/init.d/postgresql
[root@trickster root]# service postgresql restart
Service postmaster is not running. [PASSED]
Adjusting environment for postgresql: [ DONE ]
Starting postmaster service: [ DONE ]
Link postgresql socket: [ DONE ]
[root@trickster root]# pidof postmaster
19357 19355 19342

==&gt; we&apos;d better remove pidfile somewhere in stop() ?
ldv: should service scripts check for that?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>5842</commentid>
    <comment_count>1</comment_count>
    <who name="Dmitry V. Levin">ldv</who>
    <bug_when>2003-08-28 19:52:26 +0400</bug_when>
    <thetext>stop() already removes stale pidfile: 
 
$ fgrep -n &apos;rm -f &quot;$PIDFILE&quot;&apos; /etc/init.d/functions 
354:            [ -z &quot;$PIDFILE&quot; ] || rm -f &quot;$PIDFILE&quot; </thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>5892</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Shigorin">mike</who>
    <bug_when>2003-08-31 10:53:14 +0400</bug_when>
    <thetext>what&apos;s the problem, then? :(

-- 
mike, confused</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>16716</commentid>
    <comment_count>3</comment_count>
    <who name="Michael Shigorin">mike</who>
    <bug_when>2004-07-07 21:47:07 +0400</bug_when>
    <thetext>до сих пор актуально :(

проверено при обновлении с 20040505 на 20040706</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>17479</commentid>
    <comment_count>4</comment_count>
    <who name="Michael Shigorin">mike</who>
    <bug_when>2004-07-23 22:01:59 +0400</bug_when>
    <thetext>сделать NMU?  это надо фиксить -- сегодня актуально</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>17803</commentid>
    <comment_count>5</comment_count>
    <who name="Michael Shigorin">mike</who>
    <bug_when>2004-08-04 18:35:10 +0400</bug_when>
    <thetext>Константин, а можно осведомиться, почему это осталось в новой сборке?

С ней в итоге при обновлении наблюдается та же проблема.

Это _важно_!

(в изначальном сообщении rm /var/lock/subsys/postgresql, конечно же -- как меня
так переклинило)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>17805</commentid>
    <comment_count>6</comment_count>
    <who name="Michael Shigorin">mike</who>
    <bug_when>2004-08-04 18:41:50 +0400</bug_when>
    <thetext>ха... тут еще и postmaster толком не умирал...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>17814</commentid>
    <comment_count>7</comment_count>
    <who name="Kostya Timoshenko">kt</who>
    <bug_when>2004-08-05 07:54:39 +0400</bug_when>
    <thetext>я не могу повторить описанную ошибку, все время стартует нормально</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>17833</commentid>
    <comment_count>8</comment_count>
    <who name="Michael Shigorin">mike</who>
    <bug_when>2004-08-05 11:39:00 +0400</bug_when>
    <thetext>Эх.  А я ее практически постоянно ловлю...

Давайте так -- я постараюсь отловить и зафиксить у себя (просто ловилось редко
-- при обновлениях -- и фиксилось *максимально* оперативно кувалдой по месту,
потому что на нем живет dict.linux.org.ua, который мягкий продакшн).  Если
выйдет и у Вас фикс не сломает чего еще -- хорошо бы в пакет.

Простите за нервничанье, просто эта же проблема и с sec updates может вылезти --
прикладываем обновление и сервер не подымается.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>18507</commentid>
    <comment_count>9</comment_count>
    <who name="Michael Shigorin">mike</who>
    <bug_when>2004-08-31 23:16:06 +0400</bug_when>
    <thetext>Вот, обновился.

root@fly ~ # cat /var/lib/pgsql-root/var/lib/pgsql/data/postmaster.pid
12833
/var/lib/pgsql/data
  5432001   9142276
root@fly ~ # ps auxww | grep 12833                                    
postgres 12833  0.0  0.1 16204  740 ?        S    Aug26   0:02
/usr/bin/postmaster -D /var/lib/pgsql/data -S -r /var/lib/pgsql-root
root     28306  0.0  0.1  1592  552 pts/14   S    22:12   0:00 grep 12833
root@fly ~ # file /var/lock/subsys/postgresql
/var/lock/subsys/postgresql: empty
root@fly ~ # service postgresql restart    
Service postmaster is not running.                                      [PASSED]
Adjusting environment for postgresql:                                   [ DONE ]
Starting postmaster service:                                            [ DONE ]
Link postgresql socket:                                                 [FAILED]
root@fly ~ # rm /var/lib/pgsql-root/var/lib/pgsql/data/postmaster.pid
root@fly ~ # service postgresql restart                              
Service postmaster is not running.                                      [PASSED]
Adjusting environment for postgresql:                                   [ DONE ]
Starting postmaster service:                                            [ DONE ]
Link postgresql socket:                                                 [ DONE ]

NB: в изначальном багрепорте что-то не то я из xterm&apos;ов слепил -- прибивать надо
/var/lib/pgsql-root/var/lib/pgsql/data/postmaster.pid, а вовсе не инитскрипт. %)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>19069</commentid>
    <comment_count>10</comment_count>
    <who name="Denis S. Filimonov">den</who>
    <bug_when>2004-10-06 06:12:09 +0400</bug_when>
    <thetext>а воз и ныне там :(  
после краша не хотел подниматься постгрес из-за pid файла.. 
 
&gt;я не могу повторить описанную ошибку, все время стартует нормально 
есть подозрение, что проявляется это только тогда, когда в системе есть левый 
процесс с pid записанным в этом файле. 
 
$ rpm -q postgresql-server 
postgresql-server-7.4.5-alt1 
 </thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>22127</commentid>
    <comment_count>11</comment_count>
    <who name="Sir Raorn">raorn</who>
    <bug_when>2005-02-17 19:54:27 +0300</bug_when>
    <thetext>А посмотреть на инитскрипты из debian, например, не Б.М.?

У меня точно такая же проблема при апгрейде постгреса.  Плюс совсем не нравится
то, что происходит в stop :-/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>22467</commentid>
    <comment_count>12</comment_count>
    <who name="Michael Shigorin">mike</who>
    <bug_when>2005-03-10 13:11:47 +0300</bug_when>
    <thetext>Date: Sat, 5 Mar 2005 15:30:50 +0300
From: Alex Gorbachenko &lt;agent_007 immo.ru&gt;
To: community altlinux.ru
Subject: Re: [Comm] Re: Postgresql

а всё потому, что правильный stop делается через pg_ctl. тогда и pid
файл удалится, да и самих вариантов останова несколько поболее.
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>22476</commentid>
    <comment_count>13</comment_count>
    <who name="Denis Smirnov">mithraen</who>
    <bug_when>2005-03-10 14:29:15 +0300</bug_when>
    <thetext>бум фиксить</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>22479</commentid>
    <comment_count>14</comment_count>
    <who name="Denis Smirnov">mithraen</who>
    <bug_when>2005-03-10 15:07:11 +0300</bug_when>
    <thetext>7.4.7-alt2 ушло в incoming -- прошу тестировать</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>22542</commentid>
    <comment_count>15</comment_count>
    <who name="algor">algor</who>
    <bug_when>2005-03-14 17:22:28 +0300</bug_when>
    <thetext>для pg_ctl stop следует подрисовать &quot;-mi&quot;. иначе останова придётся ждать до тех
пор, пока добровольно не отвалятся все клиенты. у меня, например, такого не
бывает никогда, как следствие restat|stop не выполнится.

---/bin/su -s /bin/bash -c &quot;/usr/bin/pg_ctl -D \&quot;$PGDATA\&quot; stop&quot; postgres
+++/bin/su -l postgres -s /bin/sh -c &apos;/usr/bin/pg_ctl stop -D \&apos;$PGDATA\&apos; -mi&apos;

зависимость на /bin/bash в данном случае лишняя, по моему.
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>22549</commentid>
    <comment_count>16</comment_count>
    <who name="Sir Raorn">raorn</who>
    <bug_when>2005-03-14 17:29:52 +0300</bug_when>
    <thetext>(In reply to comment #15)
&gt; для pg_ctl stop следует подрисовать &quot;-mi&quot;. иначе останова придётся ждать до тех
&gt; пор, пока добровольно не отвалятся все клиенты.
-mi нельзя, лучше -mf.

Или как wait_socker - -ms с таймаутом, по истечении которого -mf.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>22551</commentid>
    <comment_count>17</comment_count>
    <who name="algor">algor</who>
    <bug_when>2005-03-14 17:38:20 +0300</bug_when>
    <thetext>согласен.  stop с &quot;-mf&quot; и какой-нибудь forcestop с &quot;-mi&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>22552</commentid>
    <comment_count>18</comment_count>
    <who name="Denis Smirnov">mithraen</who>
    <bug_when>2005-03-14 18:43:51 +0300</bug_when>
    <thetext>restart как должен делаться?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>22554</commentid>
    <comment_count>19</comment_count>
    <who name="algor">algor</who>
    <bug_when>2005-03-14 19:41:54 +0300</bug_when>
    <thetext>stop()
{
&lt;skip&gt;
/bin/su -l postgres -s /bin/sh -c &apos;/usr/bin/pg_ctl stop -D \&apos;$PGDATA\&apos; -mf
&lt;skip&gt;
}

restart()
{
    stop
    start
}
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>25281</commentid>
    <comment_count>20</comment_count>
    <who name="Denis Smirnov">mithraen</who>
    <bug_when>2005-06-04 20:13:49 +0400</bug_when>
    <thetext>fix ушёл в incoming/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>25296</commentid>
    <comment_count>21</comment_count>
    <who name="Ivan Fedorov">ns</who>
    <bug_when>2005-06-05 10:13:23 +0400</bug_when>
    <thetext>К 8.0 оно тоже надо?..</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>25301</commentid>
    <comment_count>22</comment_count>
    <who name="Denis Smirnov">mithraen</who>
    <bug_when>2005-06-05 13:05:13 +0400</bug_when>
    <thetext>Да.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>29335</commentid>
    <comment_count>23</comment_count>
    <who name="Michael Shigorin">mike</who>
    <bug_when>2005-08-30 02:19:41 +0400</bug_when>
    <thetext>closing</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>29480</commentid>
    <comment_count>24</comment_count>
    <who name="Michael Shigorin">mike</who>
    <bug_when>2005-08-30 02:27:49 +0400</bug_when>
    <thetext>closing</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>37517</commentid>
    <comment_count>25</comment_count>
    <who name="Michael Shigorin">mike</who>
    <bug_when>2006-04-22 11:32:22 +0400</bug_when>
    <thetext>Представился случай проверить, что работает:

Committing changes...
Preparing packages for installation...
libpq3-7.4.12-alt0.M24.1
postgresql-7.4.12-alt0.M24.1
postgresql-server-7.4.12-alt0.M24.1
Stopping postgresql service: [ DONE ]
rm: cannot remove `/var/lib/pgsql-root/var/lib/pgsql/data/postmaster.pid&apos;: No
such file or directory
Adjusting environment for postgresql: [ DONE ]
Starting postmaster service: [ DONE ]
Link postgresql socket: [ DONE ]

И -- работает. :)
Спасибо!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>52497</commentid>
    <comment_count>26</comment_count>
    <who name="Michael Shigorin">mike</who>
    <bug_when>2007-07-07 02:38:52 +0400</bug_when>
    <thetext>Ты будешь смеяться -- опять вылезло на postgresql8.2-server из Server 4.0,
засунутом в VE... локфайл присутствует, сервер не запускается, link socked тоже
failed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>52498</commentid>
    <comment_count>27</comment_count>
    <who name="Michael Shigorin">mike</who>
    <bug_when>2007-07-07 02:56:10 +0400</bug_when>
    <thetext>хотя... темплейт получился совсем минимальный, без etcnet =&gt; сети.
ладно, завтра продолжу.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>52499</commentid>
    <comment_count>28</comment_count>
    <who name="Michael Shigorin">mike</who>
    <bug_when>2007-07-07 03:09:59 +0400</bug_when>
    <thetext>пускаю руками -- бред какой-то:

# /usr/bin/postgres --pidfile /var/lib/pgsql/data/postmaster.pid --background
--make-pidfile -- -D /var/lib/pgsql/data -C /var/lib/pgsql-root 
FATAL:  --pidfile requires a value
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>52502</commentid>
    <comment_count>29</comment_count>
    <who name="Ivan Fedorov">ns</who>
    <bug_when>2007-07-07 15:21:12 +0400</bug_when>
    <thetext>Миш, у тебя тут половина параметров какие-то левые... в init-скрипте там куча
парамеров для всех команд разом! :(

А учитывая, что chroot-патч я делал уже из последних сил, то диагностика
обработки параметров вообще почти отсутствует в случае неверных параметров для
chroot. :(</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>52506</commentid>
    <comment_count>30</comment_count>
    <who name="Michael Shigorin">mike</who>
    <bug_when>2007-07-07 16:23:34 +0400</bug_when>
    <thetext>(In reply to comment #29)
&gt; Миш, у тебя тут половина параметров какие-то левые... в init-скрипте там куча
&gt; парамеров для всех команд разом! :(
Это было из sh -x /etc/init.d/postgresql restart; попробую на более свежую
голову ещё раз посмотреть.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>