Closed Neugeniko closed 8 years ago
Some more info on our Slack conversation:
Error1 Clicking login eve multiple times and it tries to create another server again on same port and fails. Also fails to launch browser.
Error2 When I logout character I cant login again as it tries to create server on same port and fails.
I do not have these issues with the Windows build. I can click the "Login" button multiple times and apparently start multiple servers. I have a feeling that the server stop command is not functional, as even when the server is supposed to time out after 60 seconds I can still access localhost:6461
which should not happen.
I am using code that I found online for the simple server. Looking more closely at it, the stop command doesn't stop the server itself, but sets a flag so that when a request is made it will honor the request or pass on it. I'll look into fixing this or maybe changing the implementation.
Can you please pull from the crest_fitting branch and test? I made a few changes:
handle_timeout
instead of threading.Timer
which will attempt to close the server if it was already closed.I still get this error.
Traceback (most recent call last):
File "/home/neugeniko/src/Pyfa-crest_fitting/gui/crestFittings.py", line 288, in addChar
uri = sCrest.startServer()
File "/home/neugeniko/src/Pyfa-crest_fitting/service/crest.py", line 115, in startServer
self.httpd = service.StoppableHTTPServer(('', 6461), service.AuthHandler)
File "/usr/lib/python2.7/SocketServer.py", line 419, in __init__
self.server_bind()
File "/home/neugeniko/src/Pyfa-crest_fitting/service/server.py", line 60, in server_bind
BaseHTTPServer.HTTPServer.server_bind(self)
File "/usr/lib/python2.7/BaseHTTPServer.py", line 108, in server_bind
SocketServer.TCPServer.server_bind(self)
File "/usr/lib/python2.7/SocketServer.py", line 430, in server_bind
self.socket.bind(self.server_address)
File "/usr/lib/python2.7/socket.py", line 224, in meth
return getattr(self._sock,name)(*args)
socket.error: [Errno 98] Address already in use
However the server does stop eventually and I'm able to logout and login again. It doesnt crash pyfa.
Same thing in client mode, have to wait between adding characters.
Can you please give detailed step by step reproduction steps, and post the debug messages as well? (run pyfa through interpreter with -d
). The probably that I'm having is that the server is handled by another thread, so the traceback simply starts with sCrest.startServer()
which isn't too helpful.
Also, make sure there's only one pyfa running. The old problematic process may still be running in the background from before the new repo pull since the server goes to a different thread. I did have that probably a couple of times during development
Adding -d switch didnt seem to add anymore information. Steps to reproduce.
python pyfa.py -d
doesn't work? WTF?
I don't really know what to tell you without seing some debug messages and figuring out the logic flow. As it is, it doesn't seem like the server is getting the stop message on your end for unknown reasons.
Keep trying to fiddle with it and collect more data if you can. I'll try to contact you on Slack in the coming days - it's easier to troubleshoot with a real-time platform. But I really want to get whatever this is fixed before we ship on Tuesday. =)
Sorry I did python -d pyfa.py instead of python pyfa.py -d.
Heres the output.
2015-10-29 14:29:34,030 root INFO Starting pyfa
2015-10-29 14:29:44,778 root DEBUG Starting server
2015-10-29 14:30:04,778 service.crest DEBUG Handling CREST login with: {'access_token': ['oY6_atX8jwvXGaax-Js-EmiNJ_S8x2U2uakWD2lQo6rRE2VptNVxd6KooFfQ9KZqBpp73taveTGCH3RtlUP2BA2'], 'token_type': ['Bearer'], 'state': ['19f6588d-3608-4caf-b545-6df4cf7e05df'], 'expires_in': ['1200']}
2015-10-29 14:30:04,822 pycrest.eve DEBUG Getting resource https://api-sisi.testeveonline.com/
2015-10-29 14:30:04,824 pycrest.eve DEBUG Cache miss for resource https://api-sisi.testeveonline.com/ (params={}
2015-10-29 14:30:04,825 pycrest.eve DEBUG Getting resource https://api-sisi.testeveonline.com/ (params={})
2015-10-29 14:30:04,867 requests.packages.urllib3.connectionpool INFO Starting new HTTPS connection (1): api-sisi.testeveonline.com
2015-10-29 14:30:06,377 requests.packages.urllib3.connectionpool DEBUG "GET / HTTP/1.1" 200 None
2015-10-29 14:30:06,379 pycrest.eve DEBUG Getting resource https://sisilogin.testeveonline.com/oauth/verify
2015-10-29 14:30:06,380 pycrest.eve DEBUG Cache miss for resource https://sisilogin.testeveonline.com/oauth/verify (params={}
2015-10-29 14:30:06,380 pycrest.eve DEBUG Getting resource https://sisilogin.testeveonline.com/oauth/verify (params={})
2015-10-29 14:30:06,382 requests.packages.urllib3.connectionpool INFO Starting new HTTPS connection (1): sisilogin.testeveonline.com
2015-10-29 14:30:07,868 requests.packages.urllib3.connectionpool DEBUG "GET /oauth/verify HTTP/1.1" 200 221
2015-10-29 14:30:07,869 service.crest DEBUG Got character info: {u'Scopes': u'characterFittingsRead characterFittingsWrite', u'ExpiresOn': u'2015-10-29T03:50:03', u'TokenType': u'Character', u'CharacterName': u'Illbe Frank', u'CharacterOwnerHash': u'QoAn7I4EIAXTYrTgnsuIyn5whf0=', u'CharacterID': 604821304}
2015-10-29 14:30:07,870 root DEBUG Stopping Server
2015-10-29 14:30:13,575 root DEBUG Character logout
2015-10-29 14:30:16,343 root DEBUG Starting server
Traceback (most recent call last):
File "/home/neugeniko/src/pyfa/gui/mainFrame.py", line 525, in ssoLogin
uri = sCrest.startServer()
File "/home/neugeniko/src/pyfa/service/crest.py", line 115, in startServer
self.httpd = service.StoppableHTTPServer(('', 6461), service.AuthHandler)
File "/usr/lib/python2.7/SocketServer.py", line 419, in __init__
self.server_bind()
File "/home/neugeniko/src/pyfa/service/server.py", line 60, in server_bind
BaseHTTPServer.HTTPServer.server_bind(self)
File "/usr/lib/python2.7/BaseHTTPServer.py", line 108, in server_bind
SocketServer.TCPServer.server_bind(self)
File "/usr/lib/python2.7/SocketServer.py", line 430, in server_bind
self.socket.bind(self.server_address)
File "/usr/lib/python2.7/socket.py", line 224, in meth
return getattr(self._sock,name)(*args)
socket.error: [Errno 98] Address already in use
That is odd, and I'm not sure why it's happening.
I have an idea though. Instead of re initializing the server every time, I might be able to just start and stop handling the requests once it is started. I also need to look into threading a bit more and try to ensure that child threads are killed when the main thread closes.
Also, IIRC you're on debian, correct? I may put together a debian VM to help with debugging
@Neugeniko, can you pull latest crest_fitting
and try out the newest changes? It works for me under Debian and Windows
I basically did not understand sockets well enough before. My previous change gave the socket a 60 second timeout. The problem with this is that this apparently prevents the socket from closing until the timeout happens or a request is received.
I changed it up a bit to shorten the timeout so that is can actually check if it's still running, and moving the 60-second window to count how many timeouts have happened, and then set run to false if too many timeouts.
After speaking with @Neugeniko, I think it's safe to mark this as resolved.
I get this error when clicking Login EVE repeatedly, Login Character out of CREST and trying to Login EVE again and Login EVE after token expires.