X-Recipient: archive-cygwin@delorie.com
X-SWARE-Spam-Status: No, hits=0.1 required=5.0	tests=AWL,BAYES_00,DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,FSL_HELO_BARE_IP_2,KHOP_THREADED,NML_ADSP_CUSTOM_MED,RCVD_IN_DNSWL_NONE,RCVD_NUMERIC_HELO,RP_MATCHES_RCVD,SARE_RAND_1,SPF_HELO_PASS
X-Spam-Check-By: sourceware.org
To: cygwin@cygwin.com
From: jojelino <jojelino@gmail.com>
Subject: Re: deadlock with busy waiting on sigfe
Date: Tue, 12 Mar 2013 04:49:44 +0900
Lines: 59
Message-ID: <khlcgj$efi$1@ger.gmane.org>
References: <kd2d69$lam$1@ger.gmane.org> <20130116014646.GB13175@ednor.casa.cgf.cx> <20130116021414.GA14341@ednor.casa.cgf.cx> <kdfuvh$a93$1@ger.gmane.org> <20130120065456.GC17644@ednor.casa.cgf.cx> <khk62q$6n2$1@ger.gmane.org> <20130311143630.GA6498@ednor.casa.cgf.cx> <khlbm8$5tg$1@ger.gmane.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
User-Agent: Mozilla/5.0 (Windows NT 5.2; rv:22.0) Gecko/20100101 Thunderbird/22.0a1
In-Reply-To: <khlbm8$5tg$1@ger.gmane.org>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

On 2013-03-12 AM 4:35, jojelino wrote:
> I was trying to CTRL+C cygwin python process that is executing some
> operation and fell asleep for 60 seconds repeatedly. I'm pretty sure
> that the process was sleeping as i tried interrupt it.
And some operation includes making connection to localhost tcp server 
and sending some command to that. so another thread would be 
mswsock!SockAsyncThread.
this case was very rare and i rarely saw the livelock except this time.
#! /usr/bin/python
from telnetlib import *
import re,sys,time,datetime
t=Telnet()
t.open('127.0.0.1','9051')
def burst(inp):
  for e in inp.split('\n'):
   prep=e
   print prep
   t.write (e+'\n')
   ds=t.expect([re.compile('\n')])
   print ds[2].strip()
#login for tor control protocol
burstcommand=""
burst(burstcommand)
if len(sys.argv)>1:
  f=open(sys.argv[1],'r')
  good=f.readline().split(',')
  others=f.readline().split(',')
  good=filter(lambda x:x not in others,good)
  exclude=f.readline().split(',')
  others=filter(lambda x:x not in exclude,others);
  assert(len(good)>0)
  assert(len(others)>0)
  f.close()
else: raise Exception("list needed")
import random

cont=True
while cont:
  for j in range(10):
   if cont:
    s=list()
    if len(others)>1:
     xx=good[random.randint(0,len(good)-1)]
     s.append(xx)
     s.append(others.pop(random.randint(0,len(others)-1)))
    else:
     print 'others insufficient'
     cont=False
     break
    if cont==True:
     #print "extendcircuit 0", ",".join(s)
     burst("extendcircuit 0 {0}".format(",".join(s)))
   else:
    break
  print "====================================================="
  time.sleep(60)
t.close()
-- 
Regards.


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

