Subject: Re: perl threads problems using 20040720 snapshot
From: Yitzchak Scott-Thoennes <[email-masked]>
To: [email-masked]
Date: Sun, 25 Jul 2004 13:51:08 -0700

On Wed, Jul 21, 2004 at 12:18:36AM -0700, Yitzchak Scott-Thoennes wrote:
> When using recent snapshots, perl threads have some problems.  For example:
> 
> $ perl -we'use threads; threads->new( sub { print "go" } )->join(); <>; print "done"';
> 
> Here, when the thread exits (after printing go), the whole process
> also exits, instead of waiting for terminal input and printing done.

I am curious to know if this is only me or if others are also seeing it.

The end of the strace for 1.5.10:

35033  634463 [unknown (0x8EC)] perl 3184 fhandler_base::fstat: here
  311  634774 [unknown (0x8EC)] perl 3184 fstat64: 0 = fstat (1, 0xDAECA0)
  248  635022 [unknown (0x8EC)] perl 3184 writev: writev (1, 0xDAEF30, 1)
  117  635139 [unknown (0x8EC)] perl 3184 fhandler_base::write: binary write
  123  635262 [unknown (0x8EC)] perl 3184 fhandler_base::write: 2 = write (0xA0B69D8, 2)
  105  635367 [unknown (0x8EC)] perl 3184 writev: 2 = write (1, 0xDAEF30, 1), errno 0
  664  636031 [unknown (0x8EC)] perl 3184 _cygtls::remove: wait 0xFFFFFFFF
  147  636178 [unknown (0x8EC)] perl 3184 _cygtls::remove: removed 0xDAF140 element 1
  132  636310 [unknown (0x8EC)] perl 3184 _cygtls::remove: wait 0x0
 9480  645790 [main] perl 3184 close: close (-1)
  164  645954 [main] perl 3184 close: -1 = close (-1)
  194  646148 [main] perl 3184 close: close (-1)
  101  646249 [main] perl 3184 close: -1 = close (-1)
  225  646474 [main] perl 3184 close: close (-1)
  100  646574 [main] perl 3184 close: -1 = close (-1)
  753  647327 [main] perl 3184 fhandler_base::set_close_on_exec: set close_on_exec for  to 0
  129  647456 [main] perl 3184 fcntl_worker: 0 = fcntl (0, 2, 0x0)
  160  647616 [main] perl 3184 fhandler_base::fstat: here
  166  647782 [main] perl 3184 fstat64: 0 = fstat (0, 0x22CC10)
  161  647943 [main] perl 3184 readv: readv (0, 0x22CC30, 1) blocking, sigcatchers 0
4149463 4797406 [read_pipe] perl 3184 fhandler_base::read: returning 2, binary mode
  262 4797668 [main] perl 3184 readv: 2 = readv (0, 0x22CC30, 1), errno 0
  130 4797798 [main] perl 3184 fhandler_base::fstat: here
  535 4798333 [main] perl 3184 fstat64: 0 = fstat (1, 0x22ECA0)
  251 4798584 [main] perl 3184 writev: writev (1, 0x22EDB0, 1)
  114 4798698 [main] perl 3184 fhandler_base::write: binary write
  115 4798813 [main] perl 3184 fhandler_base::write: 4 = write (0xA0CC008, 4)
  144 4798957 [main] perl 3184 writev: 4 = write (1, 0x22EDB0, 1), errno 0
82250 4881207 [main] perl 3184 do_exit: do_exit (0), exit_state 0
  130 4881337 [main] perl 3184 void: 0x0 = signal (20, 0x1)
  100 4881437 [main] perl 3184 void: 0x0 = signal (1, 0x1)
   92 4881529 [main] perl 3184 void: 0x0 = signal (2, 0x1)
   94 4881623 [main] perl 3184 void: 0x0 = signal (3, 0x1)
  116 4881739 [main] perl 3184 sigproc_terminate: entering
  131 4881870 [sig] perl 3184 wait_sig: done
  121 4881991 [sig] perl 3184 _cygtls::remove: wait 0x0
  310 4882301 [main] perl 3184 proc_terminate: nchildren 0, nzombies 0
  124 4882425 [main] perl 3184 proc_terminate: leaving
  939 4883364 [main] perl 3184 set_console_title: title '~/pbed'
  180 4883544 [main] perl 3184 do_exit: 3184 == sid 3184, send SIGHUP to children
  728 4884272 [main] perl 3184 __to_clock_t: dwHighDateTime 0, dwLowDateTime 1502160
  114 4884386 [main] perl 3184 __to_clock_t: total 00000000 00000096
  240 4884626 [main] perl 3184 __to_clock_t: dwHighDateTime 0, dwLowDateTime 3505040
  100 4884726 [main] perl 3184 __to_clock_t: total 00000000 0000015E
 1817 4886543 [main] perl 3184 _pinfo::exit: Calling ExitProcess 0

and for the 20040724 snapshot:

29723  680773 [unknown (0x9CC)] perl 2652 __cygwin_lock_lock: threadcount 2.  locking
  254  681027 [unknown (0x9CC)] perl 2652 fhandler_base::fstat: here
  116  681143 [unknown (0x9CC)] perl 2652 fstat64: 0 = fstat (1, 0xDAECA0)
  169  681312 [unknown (0x9CC)] perl 2652 __cygwin_lock_unlock: threadcount 2.  unlocked
  136  681448 [unknown (0x9CC)] perl 2652 __cygwin_lock_lock: threadcount 2.  locking
  126  681574 [unknown (0x9CC)] perl 2652 writev: writev (1, 0xDAEF30, 1)
  119  681693 [unknown (0x9CC)] perl 2652 fhandler_base::write: binary write
  122  681815 [unknown (0x9CC)] perl 2652 fhandler_base::write: 2 = write (0xA0DABA0, 2)
  103  681918 [unknown (0x9CC)] perl 2652 writev: 2 = write (1, 0xDAEF30, 1), errno 0
  100  682018 [unknown (0x9CC)] perl 2652 __cygwin_lock_unlock: threadcount 2.  unlocked
  103  682121 [unknown (0x9CC)] perl 2652 __cygwin_lock_lock: threadcount 2.  locking
  186  682307 [unknown (0x9CC)] perl 2652 __cygwin_lock_unlock: threadcount 2.  unlocked
  123  682430 [unknown (0x9CC)] perl 2652 __cygwin_lock_lock: threadcount 2.  locking
  197  682627 [unknown (0x9CC)] perl 2652 __cygwin_lock_lock: threadcount 2.  locking
  187  682814 [unknown (0x9CC)] perl 2652 __cygwin_lock_lock: threadcount 2.  locking
  106  682920 [unknown (0x9CC)] perl 2652 __cygwin_lock_lock: threadcount 2.  locking
  105  683025 [unknown (0x9CC)] perl 2652 close: close (0)
  136  683161 [unknown (0x9CC)] perl 2652 close: 0 = close (0)
  120  683281 [unknown (0x9CC)] perl 2652 __cygwin_lock_unlock: threadcount 2.  unlocked
  106  683387 [unknown (0x9CC)] perl 2652 __cygwin_lock_unlock: threadcount 2.  unlocked
  101  683488 [unknown (0x9CC)] perl 2652 __cygwin_lock_unlock: threadcount 2.  unlocked
  110  683598 [unknown (0x9CC)] perl 2652 __cygwin_lock_lock: threadcount 2.  locking
  182  683780 [unknown (0x9CC)] perl 2652 __cygwin_lock_lock: threadcount 2.  locking
  105  683885 [unknown (0x9CC)] perl 2652 __cygwin_lock_lock: threadcount 2.  locking
  101  683986 [unknown (0x9CC)] perl 2652 __cygwin_lock_lock: threadcount 2.  locking
  103  684089 [unknown (0x9CC)] perl 2652 __cygwin_lock_unlock: threadcount 2.  unlocked
   99  684188 [unknown (0x9CC)] perl 2652 close: close (1)
  110  684298 [unknown (0x9CC)] perl 2652 close: 0 = close (1)
  107  684405 [unknown (0x9CC)] perl 2652 __cygwin_lock_unlock: threadcount 2.  unlocked
  104  684509 [unknown (0x9CC)] perl 2652 __cygwin_lock_unlock: threadcount 2.  unlocked
  115  684624 [unknown (0x9CC)] perl 2652 __cygwin_lock_unlock: threadcount 2.  unlocked
  100  684724 [unknown (0x9CC)] perl 2652 __cygwin_lock_lock: threadcount 2.  locking
  178  684902 [unknown (0x9CC)] perl 2652 __cygwin_lock_lock: threadcount 2.  locking
  105  685007 [unknown (0x9CC)] perl 2652 __cygwin_lock_lock: threadcount 2.  locking
  100  685107 [unknown (0x9CC)] perl 2652 __cygwin_lock_lock: threadcount 2.  locking
  102  685209 [unknown (0x9CC)] perl 2652 __cygwin_lock_unlock: threadcount 2.  unlocked
   99  685308 [unknown (0x9CC)] perl 2652 close: close (2)
  111  685419 [unknown (0x9CC)] perl 2652 close: 0 = close (2)
  108  685527 [unknown (0x9CC)] perl 2652 __cygwin_lock_unlock: threadcount 2.  unlocked
  117  685644 [unknown (0x9CC)] perl 2652 __cygwin_lock_unlock: threadcount 2.  unlocked
  102  685746 [unknown (0x9CC)] perl 2652 __cygwin_lock_unlock: threadcount 2.  unlocked
   98  685844 [unknown (0x9CC)] perl 2652 __cygwin_lock_lock: threadcount 2.  locking
  179  686023 [unknown (0x9CC)] perl 2652 __cygwin_lock_lock: threadcount 2.  locking
  104  686127 [unknown (0x9CC)] perl 2652 __cygwin_lock_lock: threadcount 2.  locking
  103  686230 [unknown (0x9CC)] perl 2652 close: close (0)
  101  686331 [unknown (0x9CC)] perl 2652 close: -1 = close (0)
   98  686429 [unknown (0x9CC)] perl 2652 __cygwin_lock_unlock: threadcount 2.  unlocked
  103  686532 [unknown (0x9CC)] perl 2652 __cygwin_lock_unlock: threadcount 2.  unlocked
  153  686685 [unknown (0x9CC)] perl 2652 __cygwin_lock_unlock: threadcount 2.  unlocked
  110  686795 [unknown (0x9CC)] perl 2652 __cygwin_lock_lock: threadcount 2.  locking
  102  686897 [unknown (0x9CC)] perl 2652 __cygwin_lock_lock: threadcount 2.  locking
  104  687001 [unknown (0x9CC)] perl 2652 __cygwin_lock_lock: threadcount 2.  locking
  102  687103 [unknown (0x9CC)] perl 2652 __cygwin_lock_lock: threadcount 2.  locking
  103  687206 [unknown (0x9CC)] perl 2652 __cygwin_lock_unlock: threadcount 2.  unlocked
  103  687309 [unknown (0x9CC)] perl 2652 close: close (1)
  101  687410 [unknown (0x9CC)] perl 2652 close: -1 = close (1)
  158  687568 [unknown (0x9CC)] perl 2652 __cygwin_lock_unlock: threadcount 2.  unlocked
  518  688086 [unknown (0x9CC)] perl 2652 __cygwin_lock_unlock: threadcount 2.  unlocked
  152  688238 [unknown (0x9CC)] perl 2652 __cygwin_lock_unlock: threadcount 2.  unlocked
  245  688483 [unknown (0x9CC)] perl 2652 __cygwin_lock_lock: threadcount 2.  locking
  101  688584 [unknown (0x9CC)] perl 2652 __cygwin_lock_lock: threadcount 2.  locking
  110  688694 [unknown (0x9CC)] perl 2652 __cygwin_lock_lock: threadcount 2.  locking
   94  688788 [unknown (0x9CC)] perl 2652 __cygwin_lock_lock: threadcount 2.  locking
   94  688882 [unknown (0x9CC)] perl 2652 __cygwin_lock_unlock: threadcount 2.  unlocked
   94  688976 [unknown (0x9CC)] perl 2652 close: close (2)
   92  689068 [unknown (0x9CC)] perl 2652 close: -1 = close (2)
   91  689159 [unknown (0x9CC)] perl 2652 __cygwin_lock_unlock: threadcount 2.  unlocked
  102  689261 [unknown (0x9CC)] perl 2652 __cygwin_lock_unlock: threadcount 2.  unlocked
  103  689364 [unknown (0x9CC)] perl 2652 __cygwin_lock_unlock: threadcount 2.  unlocked
  102  689466 [unknown (0x9CC)] perl 2652 __cygwin_lock_unlock: threadcount 2.  unlocked
  103  689569 [unknown (0x9CC)] perl 2652 _cygtls::remove: wait 0xFFFFFFFF
  110  689679 [unknown (0x9CC)] perl 2652 _cygtls::remove: removed 0xDAF140 element 1
  133  689812 [unknown (0x9CC)] perl 2652 _cygtls::remove: wait 0x0
  528  690340 [main] perl 2652 __cygwin_lock_lock: threadcount 1.  not locking
  144  690484 [main] perl 2652 __cygwin_lock_unlock: threadcount 1.  not unlocking
   99  690583 [main] perl 2652 __cygwin_lock_lock: threadcount 1.  not locking
  108  690691 [main] perl 2652 __cygwin_lock_unlock: threadcount 1.  not unlocking
 7423  698114 [main] perl 2652 __cygwin_lock_lock: threadcount 1.  not locking
  167  698281 [main] perl 2652 __cygwin_lock_unlock: threadcount 1.  not unlocking
  105  698386 [main] perl 2652 __cygwin_lock_lock: threadcount 1.  not locking
  100  698486 [main] perl 2652 __cygwin_lock_unlock: threadcount 1.  not unlocking
   94  698580 [main] perl 2652 __cygwin_lock_lock: threadcount 1.  not locking
  112  698692 [main] perl 2652 __cygwin_lock_lock: threadcount 1.  not locking
   93  698785 [main] perl 2652 __cygwin_lock_unlock: threadcount 1.  not unlocking
   91  698876 [main] perl 2652 __cygwin_lock_unlock: threadcount 1.  not unlocking
  104  698980 [main] perl 2652 __cygwin_lock_lock: threadcount 1.  not locking
   97  699077 [main] perl 2652 __cygwin_lock_unlock: threadcount 1.  not unlocking
   99  699176 [main] perl 2652 __cygwin_lock_lock: threadcount 1.  not locking
   96  699272 [main] perl 2652 __cygwin_lock_unlock: threadcount 1.  not unlocking
  109  699381 [main] perl 2652 __cygwin_lock_lock: threadcount 1.  not locking
   97  699478 [main] perl 2652 __cygwin_lock_lock: threadcount 1.  not locking
   92  699570 [main] perl 2652 __cygwin_lock_unlock: threadcount 1.  not unlocking
  101  699671 [main] perl 2652 __cygwin_lock_unlock: threadcount 1.  not unlocking
  102  699773 [main] perl 2652 __cygwin_lock_lock: threadcount 1.  not locking
   96  699869 [main] perl 2652 __cygwin_lock_unlock: threadcount 1.  not unlocking
   98  699967 [main] perl 2652 __cygwin_lock_lock: threadcount 1.  not locking
   96  700063 [main] perl 2652 __cygwin_lock_lock: threadcount 1.  not locking
   91  700154 [main] perl 2652 __cygwin_lock_unlock: threadcount 1.  not unlocking
  125  700279 [main] perl 2652 __cygwin_lock_unlock: threadcount 1.  not unlocking
  634  700913 [main] perl 2652 __cygwin_lock_lock: threadcount 1.  not locking
  120  701033 [main] perl 2652 __cygwin_lock_unlock: threadcount 1.  not unlocking
  102  701135 [main] perl 2652 fcntl_worker: -1 = fcntl (0, 2, 0x0)
  127  701262 [main] perl 2652 __cygwin_lock_lock: threadcount 1.  not locking
  107  701369 [main] perl 2652 __cygwin_lock_unlock: threadcount 1.  not unlocking
  194  701563 [main] perl 2652 __cygwin_lock_lock: threadcount 1.  not locking
  139  701702 [main] perl 2652 __cygwin_lock_unlock: threadcount 1.  not unlocking
  127  701829 [main] perl 2652 __cygwin_lock_lock: threadcount 1.  not locking
  110  701939 [main] perl 2652 __cygwin_lock_unlock: threadcount 1.  not unlocking
   99  702038 [main] perl 2652 __cygwin_lock_lock: threadcount 1.  not locking
   95  702133 [main] perl 2652 __cygwin_lock_unlock: threadcount 1.  not unlocking
70765  772898 [main] perl 2652 __cygwin_lock_lock: threadcount 1.  not locking
  160  773058 [main] perl 2652 __cygwin_lock_unlock: threadcount 1.  not unlocking
  108  773166 [main] perl 2652 __cygwin_lock_lock: threadcount 1.  not locking
   99  773265 [main] perl 2652 __cygwin_lock_unlock: threadcount 1.  not unlocking
  106  773371 [main] perl 2652 __cygwin_lock_lock: threadcount 1.  not locking
  101  773472 [main] perl 2652 __cygwin_lock_unlock: threadcount 1.  not unlocking
   97  773569 [main] perl 2652 __cygwin_lock_lock: threadcount 1.  not locking
   97  773666 [main] perl 2652 __cygwin_lock_unlock: threadcount 1.  not unlocking
  105  773771 [main] perl 2652 __cygwin_lock_lock: threadcount 1.  not locking
  100  773871 [main] perl 2652 __cygwin_lock_unlock: threadcount 1.  not unlocking
  631  774502 [main] perl 2652 __cygwin_lock_lock: threadcount 1.  not locking
  113  774615 [main] perl 2652 __cygwin_lock_unlock: threadcount 1.  not unlocking
   99  774714 [main] perl 2652 do_exit: do_exit (0), exit_state 0
   97  774811 [main] perl 2652 void: 0x0 = signal (20, 0x1)
  109  774920 [main] perl 2652 void: 0x0 = signal (1, 0x1)
   93  775013 [main] perl 2652 void: 0x0 = signal (2, 0x1)
   94  775107 [main] perl 2652 void: 0x0 = signal (3, 0x1)
   95  775202 [main] perl 2652 sigproc_terminate: entering
  131  775333 [sig] perl 2652 wait_sig: done
  112  775445 [sig] perl 2652 _cygtls::remove: wait 0x0
  261  775706 [main] perl 2652 proc_terminate: nchildren 0, nzombies 0
  120  775826 [main] perl 2652 proc_terminate: leaving
  874  776700 [main] perl 2652 set_console_title: title '~/pbed'
  179  776879 [main] perl 2652 do_exit: 2652 == sid 2652, send SIGHUP to children
  188  777067 [main] perl 2652 __to_clock_t: dwHighDateTime 0, dwLowDateTime 1602304
   93  777160 [main] perl 2652 __to_clock_t: total 00000000 000000A0
   92  777252 [main] perl 2652 __to_clock_t: dwHighDateTime 0, dwLowDateTime 2603744
   92  777344 [main] perl 2652 __to_clock_t: total 00000000 00000104
 1454  778798 [main] perl 2652 _pinfo::exit: Calling ExitProcess 0

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/