Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8684555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:20:12+00:00 2026-06-12T22:20:12+00:00

I have upgraded from gevent 13.x to 1.0b4. I have Failover code that checks

  • 0

I have upgraded from gevent 13.x to 1.0b4.

I have Failover code that checks if a connection is till alive by sending “HUGZ” every 5 seconds. If HUGZ’s fail to arrive a an alternative connection to a different location is made. This failover mechanism stopped working because Timeout behaviour changed.

I made some test code with a with Timeout and the and it works as expected,
BUT the exact same code does not work anymore in my the context of my application. The failover code used to work before.

I’m using gevent-zeromq to recv messages in a with TimeOut block, but the with TimeOut blocks, and never ‘times outs` and continues execution, so recovery code is not getting executed.

What could cause the Timeout mechanism not to be working?
The previously working Timeout code does not work anymore.

if active_socket:
    print 'waiting for message'

    with Timeout(2, False):
        node_message = NodeMessage.recv(active_socket)

    When no message arrives in time, the code block after this text 
    does not get executed. and it should!! and did before.


    logging.info('ping..')
    logging.info(node_message.name)

    # deal with message from plc_server.
    if node_message:
        handle_node_message(plc_client, plc_server, node_message)
    else:
       # no nodemessage or hugz recieved.
       # plc_server has died a horrible death? reboot?

The recv method:

  @classmethod
  def recv(cls, socket):
      """Reads name-value message from socket"""

      while True:
          message = socket.recv()
          if message:
              return cls.from_message(message)

The socket is a initialized in a connection object of which I have a few:

 from gevent import Timeout
 from gevent_zeromq import zmq

 ..yada yada yada...

    self.subscriber = ctx.socket(zmq.SUB)
    self.subscriber.setsockopt(zmq.SUBSCRIBE, '')
    self.subscriber.connect('%s:%d' % (address, port + 1))
    self.subscriber.linger = 0

yolk:

gevent-zeromq   - 0.2.5        - active 
gevent          - 1.0b4        - active 
greenlet        - 0.4.0        - active 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T22:20:13+00:00Added an answer on June 12, 2026 at 10:20 pm

    changeing:

    with Timeout(2, False):
        node_message = NodeMessage.recv(active_socket)
    

    to:

    class MessageContext(object):
        node_message = None
    
    messageContext = MessageContext()  //shared memmory between greenlets
    
    ...
    
    def get_next_message(active_socket)
        messageContext.node_message = NodeMessage.recv(active_socket)
    
    with Timeout(2, False):
         ..putting the actual receving of a message in its own greenlet
         ..makes TimeOut failover/Timeout work again..
    
        gevent.spawn(get_next_message, active_socket).job()
    
    node_message = messageContext.node_message
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Going mad now. I have a MVC solution that i've upgraded from MVC 1
I have a C# 4.0 Winform app that I just upgraded from 3.5 to
I have upgraded from SQL Server 2005 to 2008. I remember that in 2005,
I have several projects that I just upgraded from Visual Studio 2003 and ASP.NET
I have an XtraTreeView control that I've upgraded from 9.2 to 10.2. The hierarchy
I have recently upgraded from VS2005 to VS2010. In my .Net 2.0 code I
I have a rails application that is being upgraded from Rails 2.3.5 to Rails
I have a Plone site that is upgraded from Plone 3.3.5 to 4.0.7. From
I have an app that I've upgraded from 3.5 to 4.0. But not all
I have an InfoPath 2010 web form that was upgraded from a 2007 version.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.