google-deepmind / reverb

Reverb is an efficient and easy-to-use data storage and transport system designed for machine learning research
Apache License 2.0
704 stars 92 forks source link

NoneType object is not callable when shutting down replay server #61

Closed B-Manel closed 3 years ago

B-Manel commented 3 years ago

Anyone encountered this exception when stopping replay server? [reverb/cc/platform/default/server.cc:63] Shutting down replay server Exception ignored in: <function Server.del at 0x7f844a1f8c10> Traceback (most recent call last): File "/pythonProject/venv/lib/python3.8/site-packages/reverb/server.py", line 295, in del TypeError: 'NoneType' object is not callable

acassirer commented 3 years ago

Hey,

Would you mind running the following command in a terminal and posting the result to the issue?

awk 'NR>280&&NR310<' /pythonProject/venv/lib/python3.8/site-packages/reverb/server.py

B-Manel commented 3 years ago

Hey, this is what i got

awk: line 1: syntax error at or near end of line

acassirer commented 3 years ago

Ops, sorry that was supposed to be:

awk 'NR>280&&NR<310' /pythonProject/venv/lib/python3.8/site-packages/reverb/server.py

B-Manel commented 3 years ago

if checkpointer is None: checkpointer = checkpointers.default_checkpointer()

self._server = pybind.Server([table.internal_table for table in tables],
                             port, checkpointer.internal_checkpointer())
self._port = port

def del(self): """Stop server and free up the port if was reserved through portpicker.""" if hasattr(self, '_server'): self.stop()

if hasattr(self, '_port'):
  portpicker.return_port(self._port)

def repr(self): return repr(self._server)

@property def port(self): """Port the gRPC service is running at.""" return self._port

def stop(self): """Request that the ReverbService is terminated and wait for shutdown.""" return self._server.Stop()

def wait(self):

acassirer commented 3 years ago

Ok so the error is coming from the line portpicker.return_port(self._port). Not really sure why this is happening but it shouldn't really be causing any issues for you anyway since the message is coming from the garbage collection.

Just out of curiosity. What happens if you open up a python interpreter and do:

>>> import portpicker
>>> port = portpicker.pick_unused_port()
>>> port
23075
>>> portpicker.return_port(port)

?

B-Manel commented 3 years ago

Yeah it's not causing any issues just wanted to know what might be the cause.

Return_port isn't outputting anything so i guess that's why i get NoneType error, no clue why it's happening though. In any case thanks for your answer!

import portpicker port = portpicker.pick_unused_port() port 24178 portpicker.return_port(port)

acassirer commented 3 years ago

Yeah I also have no idea why it is happening but I can't imagine this causing any issues (apart from noisy logs) so I'm going to close this issue down.

Thanks for raising the issue though!

samarth-robo commented 3 years ago

I have the same error. It seems like the portpicker.return_port function itself is None.

This is consistent with the observation here that globally imported modules might already have been deleted before they are used in __del__().