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

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

    <bug>
          <bug_id>22224</bug_id>
          
          <creation_ts>2009-11-09 16:44:53 +0300</creation_ts>
          <short_desc>Не отрабатывает alarm из Time::HiRes</short_desc>
          <delta_ts>2010-11-14 04:59:45 +0300</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>4</classification_id>
          <classification>Development</classification>
          <product>Sisyphus</product>
          <component>perl-base</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>P3</priority>
          <bug_severity>major</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Andriy Stepanov (stanv)">stanv</reporter>
          <assigned_to name="viy">viy</assigned_to>
          <cc>at</cc>
    
    <cc>crux</cc>
    
    <cc>ldv</cc>
    
    <cc>mike</cc>
    
    <cc>php-coder</cc>
    
    <cc>rider</cc>
    
    <cc>viy</cc>
          
          <qa_contact>qa-sisyphus</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>102858</commentid>
    <comment_count>0</comment_count>
    <who name="Andriy Stepanov (stanv)">stanv</who>
    <bug_when>2009-11-09 16:44:53 +0300</bug_when>
    <thetext>Для perl-base 1:5.8.9-alt3 не срабатывает
alarm из Time::HiRes

Testsuit:

#!/usr/bin/perl -w

use Time::HiRes qw(alarm ualarm);

$SIG{ALRM} = sub {die &quot;alarm&quot;};
alarm(1);
#ualarm(1000000);
while(1) {
 sleep 1;
}

В случае ualarm скрипт отрабатывает как ожидается.

strace -ffv -o log2 ./1.pl

32020 rt_sigprocmask(SIG_BLOCK, [ALRM], [], 8) = 0
32020 rt_sigaction(SIGALRM, {0x7f54f1b426a0, [], SA_RESTORER, 0x7f54f17b1070}, {SIG_DFL, [], 0}, 8) = 0

32020 --- SIGALRM (Alarm clock) @ 0 (0) ---


В случае alarm сигнал не приходит:

32032 rt_sigprocmask(SIG_BLOCK, [ALRM], [], 8) = 0
32032 rt_sigaction(SIGALRM, {0x7f9651b986a0, [], SA_RESTORER, 0x7f9651807070}, {SIG_DFL, [], 0}, 8) = 0

32031 +++ killed by SIGINT +++ (CTRL-C)

сообщения что сигнал ALRM принят нету.

На http://perldoc.perl.org/functions/alarm.html
указано что не следует мешать alarm + sleep:
It is usually a mistake to intermix alarm and sleep calls. (sleep may be internally implemented in your system with alarm).
Тут мы как раз мы это и делаем.

Но по утверждению тестовый скрипт не срабатывает на ветках 5.0/Sisyphus. На 4.X срабатывает как ожидается.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102859</commentid>
    <comment_count>1</comment_count>
    <who name="Andriy Stepanov (stanv)">stanv</who>
    <bug_when>2009-11-09 17:11:30 +0300</bug_when>
    <thetext>#!/usr/bin/perl -w

use Time::HiRes qw(alarm ualarm);

$SIG{ALRM} = sub {die &quot;alarm&quot;};
alarm(1);
#ualarm(1000000);
my ($i,$j);
for ($i=0; $i&lt;100000000; $i++) {
 $j+=$i^2;
}

Подтверждает что где-то ошибка, т.е. sleep в этом тестике роли не играет.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102860</commentid>
    <comment_count>2</comment_count>
    <who name="Andriy Stepanov (stanv)">stanv</who>
    <bug_when>2009-11-09 17:12:37 +0300</bug_when>
    <thetext>&gt; strace -e setitimer perl -MTime::HiRes=ualarm -e &apos;ualarm 2; sleep 4&apos;
setitimer(ITIMER_REAL, {it_interval={0, 0}, it_value={0, 2}}, {it_interval={0, 0}, it_value={0, 0}}) = 0
--- SIGALRM (Alarm clock) @ 0 (0) ---
+++ killed by SIGALRM +++
zsh: alarm      strace -e setitimer perl -MTime::HiRes=ualarm -e &apos;ualarm 2; sleep 4&apos;

в случае alarm тишина:

&gt; strace -e setitimer perl -MTime::HiRes=alarm -e &apos;alarm 2; sleep 4&apos;  
&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>103658</commentid>
    <comment_count>3</comment_count>
    <who name="Anton Farygin">rider</who>
    <bug_when>2009-11-27 17:30:14 +0300</bug_when>
    <thetext>ping ping

Что с этой ошибкой ?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>104053</commentid>
    <comment_count>4</comment_count>
    <who name="Michael Shigorin">mike</who>
    <bug_when>2009-12-09 18:13:57 +0300</bug_when>
    <thetext>Почитав полиси,
предложил nmu
усталый майнтейнер.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>115280</commentid>
    <comment_count>5</comment_count>
    <who name="Dmitry V. Levin">ldv</who>
    <bug_when>2010-11-14 04:59:45 +0300</bug_when>
    <thetext>$ rpmquery perl-base
perl-base-5.12.2-alt00
$ strace -e setitimer perl -MTime::HiRes=alarm -e &apos;alarm 2; sleep 4&apos;
setitimer(ITIMER_REAL, {it_interval={0, 0}, it_value={2, 0}}, NULL) = 0
--- SIGALRM (Alarm clock) @ 0 (0) ---
+++ killed by SIGALRM +++</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>