Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

memory leak in twotp #4

Open
springstar opened this issue Mar 17, 2014 · 0 comments
Open

memory leak in twotp #4

springstar opened this issue Mar 17, 2014 · 0 comments

Comments

@springstar
Copy link

I write my server as a backend to receive message from erlang node with twotp, it's simply a echo like server but without echo back,i found RES in top inreased continuously,code like below

class EventLoop(object): def **init**(self, node_name, proc_name, server): self.server = server print node_name, proc_name cookie = readCookie() nodeName = buildNodeName(node_name) log.startLogging(sys.stdout) self.connection_mgr = ConnectionManager() self.process = Process(nodeName, cookie) self.process.register(proc_name) self.process.listen().addCallback(lambda x:self._recv_msg(self.process))
def Loop(self):                                                                                                                                                                                         
    lc = LoopingCall(self.server.process_async_tasks)                                                                                                                                                   
    lc.start(0.02)                                                                                                                                                                                      
    reactor.run()  

# receive message from erlang node                                                                                                                                                                                                      
def _recv_msg(self, process):                                                                                                                                                                           
    def _recv_cb(response):                                                                                                                                                                            
        msg_type = response[1]                                                                                                                                                                          
        msg = response[2].value                                                                                                                                                                         
        identifier = response[0]    

       # nothing to do in DispatchMessage                                                                                                                                       
        self.server.msg_dispatcher.DispatchMessage(identifier, msg_type, msg)                                                                                                                                                            

    def _error_cb(error):                                                                                                                                                                               
        pass   

    return self.process.receive().addCallback(_recv_cb).addCallback(_error_cb).
                                    addBoth(lambda x: self._recv_msg(self.process))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant