Skip to content
This repository has been archived by the owner on Apr 7, 2022. It is now read-only.

Async mode server pushing events segfaults #172

Closed
tiagocoutinho opened this issue Oct 26, 2017 · 1 comment
Closed

Async mode server pushing events segfaults #172

tiagocoutinho opened this issue Oct 26, 2017 · 1 comment

Comments

@tiagocoutinho
Copy link
Contributor

  • Start the following server D1.py with one device of class D1
  • Start c1.py which listens to events and floods the device with read attribute requests

Shortly after the server segfaults

server code:

# ----- D1.py -----
import gevent
from tango import GreenMode
from tango.server import Device, attribute

class D1(Device):

  def init_device(self):
    Device.init_device(self)
    self.set_change_event('a1', True, False)
    self.task = gevent.spawn(self.__loop)

  def delete_device(self):
    self.task.kill()

  @attribute
  def a1(self):
    return 4.5678

  def __loop(self):
    while True:
      gevent.sleep(0.01)
      self.push_change_event('a2', 1.234)

D1.run_server(green_mode=GreenMode.Gevent)

... and the client code:

# ----- c1.py -----
import sys
from tango import DeviceProxy, EventType

def f(e): pass

d = DeviceProxy(sys.argv[1])
d.subscribe_event('a1', EventType.CHANGE_EVENT, f)

while True:
  print d.a1
@tiagocoutinho
Copy link
Contributor Author

Might be related with #168

@t-b t-b closed this as completed Apr 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants