[ 
https://issues.apache.org/jira/browse/THRIFT-2463?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13967739#comment-13967739
 ] 

Benoit Sigoure commented on THRIFT-2463:
----------------------------------------

I'm wondering whether this could be caused by a spurious SIGALRM timeout, 
because {{TestServer.py}} arms the alarm for only 2 seconds and it's possible 
that if the machine was under heavy load, it would take more than 2 seconds for 
{{TestServer.py}} to start accepting connections.

Excerpt from the code:
{code}
elif server_type == "TProcessPoolServer":
  import signal
  from thrift.server import TProcessPoolServer
  server = TProcessPoolServer.TProcessPoolServer(processor, transport, 
tfactory, pfactory)
  server.setNumWorkers(5)
  def set_alarm():
    def clean_shutdown(signum, frame):
      print "SIGALRM: Shutting down server"
      for worker in server.workers:
        if options.verbose > 0:
          print 'Terminating worker: %s' % worker                               
                  
        worker.terminate()
      if options.verbose > 0:
        print 'Requesting server to stop()'
      try:       
        server.stop()
      except:
        pass
    signal.signal(signal.SIGALRM, clean_shutdown)
    signal.alarm(2)
  set_alarm()
{code}

I'm sure why the alarm is even armed here, and why so aggressively.  This was 
added in THRIFT-1094 by [~bryanduxbury].

> test/py/RunClientServer.py fails sometimes
> ------------------------------------------
>
>                 Key: THRIFT-2463
>                 URL: https://issues.apache.org/jira/browse/THRIFT-2463
>             Project: Thrift
>          Issue Type: Bug
>          Components: Python - Library
>    Affects Versions: 0.9.1
>            Reporter: Benoit Sigoure
>
> This test is flaky in our CI system and the flakiness is also visible on 
> Jenkins (see examples of failed builds 
> [here|http://mail-archives.apache.org/mod_mbox/thrift-dev/201309.mbox/%3C1012268498.737.1378727603714.JavaMail.hudson@aegis%3E]
>  and [here|https://www.mail-archive.com/[email protected]/msg10124.html]).
> All the test cases of {{AcceleratedBinaryTest}} fail with this signature:
> {code}
> ======================================================================
> ERROR: testByte (__main__.AcceleratedBinaryTest)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "./TestClient.py", line 85, in setUp
>     self.transport.open()
>   File 
> "./../../lib/py/build/lib.linux-i686-2.7/thrift/transport/TTransport.py", 
> line 149, in open
>     return self.__trans.open()
>   File "./../../lib/py/build/lib.linux-i686-2.7/thrift/transport/TSocket.py", 
> line 99, in open
>     message=message)
> TTransportException: Could not connect to localhost:9090
> {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to