McDermott-Group / servers

Public repo that stores LabRAD servers and other non-measurement related code
0 stars 2 forks source link

[ADR Server] Not context safe #86

Closed roboguy222 closed 7 years ago

roboguy222 commented 7 years ago

If we call methods like stopCompressor, we don't use the same context for all requests from that adr device.

nmGit commented 7 years ago

I ran into this with the MKS PDR2000's a while ago, is it the same problem? I fixed it with deferred locking:

def rw_line(self, code):
        # Don't allow two concurrent read/write calls.

        self._lock = DeferredLock()

        return self._lock.run(partial(self._rw_line, code))

    @inlineCallbacks
    def _rw_line(self, code):
        '''Write data to the device.'''
        yield self.server.write_line(code, context=self.ctx)
        time.sleep(0.2)
        ans = yield self.server.read(context=self.ctx)
        returnValue(ans)
roboguy222 commented 7 years ago

I think, since the adr server does not use any contexts passed down from other clients, it creates its own context, and this should not actually be a problem. Closing issue.