Java AppServer fails to get instanceID using Service API
I believe stack trace should be enough for a further investigation:
WARNING: /modules/versions-details com.google.appengine.api.labs.modules.ModulesException: No valid instance id for this instance. at com.google.appengine.api.labs.modules.ModulesServiceImpl.getCurrentInstanceId(ModulesServiceImpl.java:75) at com.appscale.hawkeye.modules.GetVersionDetailsHandlerServlet.doGet(GetVersionDetailsHandlerServlet.java:29) at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
Java code can be found here: https://github.com/AppScale/hawkeye/pull/117/files#diff-cdf7813908fa46f7bf416e941bae89dc
#2 Updated by Chris Donati over 2 years ago
- Status changed from New to In Progress
My goal was to generate a fake instance ID like the Python AppServer does.
I first tried modifying the LocalHttpRequestEnvironment, where this property is set, but since each request generates a new environment, the instance ID would change for each request.
I then tried passing in the dummy instance ID from the JettyContainerService in handleImpl. This made the instance ID consistent across requests, but it turns out that the main SDK process calls the runtime's getCurrentInstanceId API, so it did not function correctly when the API call did not raise an exception. (The main SDK process expects the instance ID to be -1).
I tried modifying DevAppServerModulesFilter to always return -1 instead of calling the runtime's API, but I got quite a few missing class errors from the packages that it imports, and I'm not sure if any other places call that user API.
I may continue looking into this if I have time, but I don't think it should be a blocker for the release.