-
Notifications
You must be signed in to change notification settings - Fork 146
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
Exception when trying to check the status of a starting server in a while loop #53
Comments
Seems like the problem is that there's no socket to close when the connection failed or has been closed already... |
@Reviville Does inactivity mean you resolved your issue or you gave up on it? |
@MarkL4YG i gave up on it as this error still occurs. |
You may try going into mcstatus/protocol/connection.py l153 and mcstatus/protocol/connection.py l182 and replace def __del__(self):
self.socket.close() with def __del__(self):
try:
self.socket.close()
except:
pass and test if the application still halts. This by no means prevents the error, it should just pass the exception allowing the application to continue running as if nothing happened. |
Just did. |
@Reviville FYI The exception indicates that something in the connection failed prior to setting the socket causing a common NullPointerException when the connection is being destroyed for garbage collection. I would ask you not to resolve this issue since the issue still persists in the code and adaptions are necessary to cover such a case. |
Fixed in #56 |
Hey ho,
as the title already mentions, im trying to check the status of a starting minecraft server using a while-loop with
server.status()
My log then shows the following exception:
AttributeError: 'TCPSocketConnection' object has no attribute 'socket' Exception ignored in: <bound method TCPSocketConnection.__del__ of <mcstatus.protocol.connection.TCPSocketConnection object at 0x7fb4005e1e10>> Traceback (most recent call last): File "/path/to/project/.venv/lib/python3.6/site-packages/mcstatus/protocol/connection.py", line 153, in __del__ self.socket.close()
If the server is up, it works. So it works if you request the server a single time, just not when trying to request it several times in a loop.
Any suggestions?
The text was updated successfully, but these errors were encountered: