App Engine can't update "The requested amount of instances has exceeded GCE's default quota" new version is deleted - google-app-engine

I have this annoying error with App Engine; basically our platforms usualy have 2-3 services running on them using Docker container with Flex 'custom' set.
Flex 'custom' uses 2 instances by default. The default quota limit is 4.
When we deploy 2 services we reach the limit; once we've reached the limit we have no way of updating the old versions of the app; we get rejected with "The requested amount of instances has exceeded GCE's default quota" even for updating the exsiting service.
Also the new version gets deleted from App Engine 'versions' so right now we've locked out; we can't update the app, we can't delete it and we can't even stop it as it's the default we're trying to update.
Any ideas?

Related

Google App Engine autohealing affected by Quota usage

I have a Google App Engine Quota of 3000 instances and with 98% usage. Hence the auto healing is being affected. As in the unhealthy instances are not autohealed. (I have a use case where each VM instance comes up hosting the App does some tasks and then marks itself unhealthy, expectation is that App Engine auto heals this and starts New VM with a clean state)
Based on my understanding of autohealing the process is:
New healthy VM is brought up and my app is started on this
Then the unhealthy instance is brought down/killed
Problem: As there is no buffer for the new instance to come up as my usage is 98%, this ends up making many of my VM instances stay in unhealthy state.
Possible Solution: Hence if I increase my instance quota to 3500 and set max_num_instances to 3000 in configuration (leaving 500 buffer for autohealing)will this solve the problem to some extent?

Can't remove appEngineRoutingOverride on Google Cloud Tasks Queue

I can't get my Cloud Tasks queue to stop overriding the app engine service routing. I created the queue through the GCP dashboard, not using queue.yml or anything else.
Description of the queue:
$ gcloud tasks queues describe import
appEngineRoutingOverride:
host: my-project-id.uc.r.appspot.com
name: projects/my-project-id/locations/us-central1/queues/import
purgeTime: '2021-03-31T00:45:22.941195Z'
rateLimits:
maxBurstSize: 100
maxConcurrentDispatches: 1000
maxDispatchesPerSecond: 500.0
retryConfig:
maxAttempts: 100
maxBackoff: 3600s
maxDoublings: 16
minBackoff: 0.100s
state: PAUSED
Attempting to clear the routing override flag with --clear-routing-override appears to be successful but does not actually clear the flag
$ gcloud tasks queues update import --clear-routing-override
WARNING: You are managing queues with gcloud, do not use queue.yaml or queue.xml in the future. More details at: https://cloud.google.com/tasks/docs/queue-yaml.
Updated queue [import].
$ gcloud tasks queues describe import
appEngineRoutingOverride:
host: my-project-id.uc.r.appspot.com
name: projects/my-project-id/locations/us-central1/queues/import
purgeTime: '2021-03-31T01:15:16.727288Z'
rateLimits:
maxBurstSize: 20
maxConcurrentDispatches: 1000
maxDispatchesPerSecond: 100.0
retryConfig:
maxAttempts: 100
maxBackoff: 3600s
maxDoublings: 16
minBackoff: 0.100s
state: PAUSED
If I change the routing to another service with --routing-override the change is successful, but that means I can only have tasks pointing to one specific service in this queue. Additionally, if I change the routing, then click on Edit Queue on the Queue details panel the app engine routing override fields will be blank, not populated with the service I specified earlier. If I click save the appEngineRoutingOverride flag will reset to the default service host. Even if I change the override options through the Edit Queue panel, refresh, then open it back up the service will still not be populated, meaning if I change the service override once and somebody on my team needs to change another setting such as rate limits then the routing will be reset and things will break.
imgur vid to clearly demonstrate the issue
EDIT: This has been reported on the GCP issue tracker a few times
https://issuetracker.google.com/issues/179701687
https://issuetracker.google.com/issues/177651361
https://issuetracker.google.com/issues/176221773
Did some digging, DO NOT use the UI on could.google.com to create or update queues.
New ones will always have a host pointing to defaults.
And updated ones will get a host pointing to default.. and then you have silently messed up your queue.
Use the cli command to create and update queues
gcloud tasks queues update mey-new-queue --max-dispatches-per-second=10 --max-concurrent-dispatches=3
adjust the flags to what you need. This command works as an upsert
(just realized how I messed up my queue, I accidentally updated it through the web UI)

Datastore Issue in Google App Engine making the application not allowing the inputs to work

App engine application is deployed in server and is connected to the database. All the data is loaded in the list and it is showing properly, but if we give some inputs in input box or any other form fields it is not reflecting in the application. The error i got from the console of app engine was this
com.google.apphosting.api.ApiProxy$RequestTooLargeException: The
request to API call datastore_v3.Put() was too large
In the App engine server I cleared the data store entries but it didn't work out well. I disabled the write access of the data store file but for few minutes it worked i was able to give the inputs and it was reflecting but after sometime the URL was not working and then I enabled the write access then the application was accessible.
This error message was caused due the Datastore default limits, most likely the limit related to the limit size for a Datastore entity, since the exception is thrown by datastore_v3.Put():
Maximum size for an entity: 1,048,572 bytes (1 MiB - 4 bytes)
However, also take in mind the limits regarding other Datastore metrics, in the linked documentation.
I would recommend you to double check that the size of the entities you are trying to insert into Datastore falls under this value, as well as under the values of the rest of the limits.

getLastAccessedTime() in GWT sessions returns 0

I'm trying to add timeouts to GWT sessions, by using the following code to check if a session is alive:
public boolean isSessionAlive() {
return System.currentTimeMillis() - getThreadLocalRequest().getSession()
.getLastAccessedTime() < timeout;
}
I based this code on many examples I saw on web for GWT sessions, such as this.
The above code works great while running on a local web server, but after deploying the project to App Engine it doesn't. The following always returns 0 on App Engine:
getThreadLocalRequest().getSession().getLastAccessedTime()
As far as I understand, the last accessed time is updated on each RPC call.
I made several calls, but this value still remains zero and incorrect result is returned.
Does anybody know how to fix this issue?
Things will change after deployed on GAE
Just today attended the session on app engine by #roman irani .
remember that App Engine is a distributed architecture so a difference from Java EE is that you are never guaranteed the same application server instance during request processing as the previous request. While the object is being serialized correctly in memcache, you still have to call setAttribute() every time due to the fact that memory is not shared.
Clear cut picture here to handle the session
I have found a workaround. Adding the following code in war/WEB-INF/web.xml will cause the session to expire after 30 minutes:
<!-- timeout in minutes -->
<session-config>
<session-timeout>30</session-timeout>
</session-config>
Reference: Session Timeouts with GWT RPC calls.

recover local_db.bin

using App Engine and Java I decided to delete the local datastore located in local_db.bin as I had made some changes to class models contained in it. Mistake!
Such local_db file is not created anymore, running the app I get
"The backing store, G:\workspace\test\war\WEB-INF\appengine-generated\local_db.bin, does not exist. It will be created."
but it isn´t. The app runs smoothly time after time and the database is never created (I tried stopping the jetty server and even closing Eclipse).
Any idea? (otherwise I guess I´ll create a new project and migrate the code).
The file is created when data is persisted, but not necessary direct. I deleted my version as a test. Persisted some data. at which point the same message you got was shown. And after some time I got this message: Time to persist datastore: 37 ms. (When deleting the local_db.bin I also deleted the datastore-indexes-auto.xml).

Resources