Thanks for your update.
No, that's not the library I'm using.

I'm using firebase-client-jvm as in 
https://www.firebase.com/docs/android/guide/setup.html

This is Firebase V2, there is a newer Firebase V3 
- https://firebase.google.com/docs/server/setup
but I cannot upgrade yet, since it requires a rewrite.

This is my build.grade in Android Studio:

def appengineVersion = "1.9.38"

dependencies {
    appengineSdk "com.google.appengine:appengine-java-sdk:${appengineVersion}"
    compile "com.google.appengine:appengine-endpoints:${appengineVersion}"
    compile "com.google.appengine:appengine-endpoints-deps:${appengineVersion}"
    compile 'javax.servlet:servlet-api:2.5'
    compile 'com.firebase:firebase-client-jvm:2.5.2'
    compile 'org.json:json:20160212'
    compile 'com.firebase:firebase-token-generator:2.0.0'
    compile 'org.apache.velocity:velocity:1.7'
    compile "com.google.appengine:appengine-api-1.0-sdk:${appengineVersion}"
    compile 'com.google.appengine.tools:appengine-gcs-client:0.6'
}


I'm using Google App Engine Standard Environment with Manual scaling. I 
access GAE with Cloud Endpoints from and iOS and Android client.

Here's a code snippet that works a couple of days, but then stops working:

@ApiMethod(name = "sendNotificationsBean")
public NotificationsBean sendNotificationsBean(@Named("uid") final String uid) {

  logger.info("Calling sendNotificationsBean method with uid:" + uid);   // 
this is executed every time, even after a couple of days
  final Firebase firebase = new Firebase(DataService.getInstance().
NEW_BASE_URL);
  firebase.authWithCustomToken(DataService.getInstance().getNewFirebaseToken
(), new Firebase.AuthResultHandler() {
      @Override
      public void onAuthenticationError(FirebaseError error) {
          logger.info("Login Failed! " + error.getMessage());    // this is 
*not* executed after a couple of days
          ApiProxy.flushLogs();
      }

      @Override
      public void onAuthenticated(AuthData authData) {
          logger.info("Login Succeeded!");    // this is *not* executed 
after a couple of days
          firebase.addListenerForSingleValueEvent(new ValueEventListener() {
              @Override
              public void onDataChange(DataSnapshot dataSnapshot) {
                  for (DataSnapshot notificationItem : dataSnapshot.
getChildren()) {   // this is *not* executed after a couple of days



See above code with comments where the problem is.


On Tuesday, July 5, 2016 at 7:44:26 PM UTC+2, Nick (Cloud Platform Support) 
wrote:
>
> Just a quick update, it seems based on the above-linked repository, that 
> there could be one explanation: 
>
> if MessageProcessorServlet 
> <https://github.com/GoogleCloudPlatform/firebase-appengine-backend/blob/master/src/main/java/com/google/cloud/solutions/flexenv/backend/MessageProcessorServlet.java>
>  creates 
> an instance of MessagePurger 
> <https://github.com/GoogleCloudPlatform/firebase-appengine-backend/blob/master/src/main/java/com/google/cloud/solutions/flexenv/backend/MessagePurger.java>
>  (extends 
> Thread) and starts it, this thread will run forever unless interrupted, 
> since it has a "while (true)" loop in its run() method. 
> MessageProcessorServlet 
> <https://github.com/GoogleCloudPlatform/firebase-appengine-backend/blob/master/src/main/java/com/google/cloud/solutions/flexenv/backend/MessageProcessorServlet.java>
>  should 
> call interrupt() on the MessagePurger 
> <https://github.com/GoogleCloudPlatform/firebase-appengine-backend/blob/master/src/main/java/com/google/cloud/solutions/flexenv/backend/MessagePurger.java>
>  during MessageProcessorServlet.destroy() 
> <https://github.com/GoogleCloudPlatform/firebase-appengine-backend/blob/master/src/main/java/com/google/cloud/solutions/flexenv/backend/MessageProcessorServlet.java>.
>  
> If the servlet isn't destroyed, though, or is destroyed without a call to 
> destroy(), the MessagePurger 
> <https://github.com/GoogleCloudPlatform/firebase-appengine-backend/blob/master/src/main/java/com/google/cloud/solutions/flexenv/backend/MessagePurger.java>
>  thread 
> might run long enough (as here) to be killed by the runtime. Or, given that 
> in this case there doesn't appear to be any error text with the log line, 
> perhaps these are simply long-running MessagePurger 
> <https://github.com/GoogleCloudPlatform/firebase-appengine-backend/blob/master/src/main/java/com/google/cloud/solutions/flexenv/backend/MessagePurger.java>
>  threads 
> which *were *properly destroyed, albeit after a long run.
>
> I hope this is helpful, let me know your thoughts and any feedback on 
> whether this is the library you're using.
>
> Cheers,
>
> Nick
> Cloud Platform Support
>
> On Tuesday, July 5, 2016 at 12:51:54 PM UTC-4, Nick (Cloud Platform 
> Support) wrote:
>>
>> Hey Olof,
>>
>> Apologies for the slight delay. I'm still looking into any possible 
>> cause. Could you share any of the information mentioned in my last message 
>> to help speed this along? I'm looking at 
>> https://github.com/GoogleCloudPlatform/firebase-appengine-backend right 
>> now. Is this the library you're using?
>>
>> Sincerely,
>>
>> Nick
>> Cloud Platform Community Support
>>
>> On Friday, July 1, 2016 at 5:00:20 AM UTC-4, Olof Gunnarsson wrote:
>>>
>>> I don't fully understand the logs, but it looks like it's older 
>>> background threads. The timestamps in the screenshot are 5 hours apart.
>>> The log messages "onAuthenticated" and "onDataChange" are Firebase 
>>> callbacks. These log messages are not written after a couple of days, and 
>>> they are also not executed (I delete stuff from Firebase in onDataChange, 
>>> but the deletions stop after a couple of days)
>>>
>>> Attached is a better view of the log.
>>>
>>>
>>>
>>> On Friday, July 1, 2016 at 1:48:10 AM UTC+2, Nick (Cloud Platform 
>>> Support) wrote:
>>>>
>>>> Hey Olof,
>>>>
>>>> This is interesting. Could you clarify whether the logs are associated 
>>>> with recent calls, or whether they are perhaps older background threads 
>>>> which are closing due to their age? It appears the logs output got a bit 
>>>> mangled as well during copy-paste, is there any chance a more faithful 
>>>> reproduction of the complete logs info, or a screenshot with all fields 
>>>> expanded, could be provided?
>>>>
>>>> Cheers,
>>>>
>>>> Nick
>>>> Cloud Platform Community Support
>>>>
>>>> On Tuesday, June 28, 2016 at 5:24:02 AM UTC-4, Olof Gunnarsson wrote:
>>>>>
>>>>>
>>>>> I'm using Google Cloud Endpoints and Google App Engine with Firebase 
>>>>> (java). Firebase calls are done in a background thread "/_ah/background", 
>>>>> which works fine. However, after a couple of days the background thread 
>>>>> stops executing. Calls to GAE still work but calls to Firebase are not 
>>>>> executed. A restart of the instance makes everything work again.
>>>>>
>>>>> I get these in the log which contains log messages from my calls to 
>>>>> Firebase, and then suddenly I don't get anymore of these logs and the 
>>>>> calls 
>>>>> to Firebase stops executing.
>>>>>
>>>>> Any ideas?
>>>>>
>>>>> 17:02:46.795GET0 B56,999.2 sUnknown/_ah/background
>>>>> 17:02:46.795GET0 B34,555.2 sUnknown/_ah/background
>>>>> 17:02:46.795GET0 B17,351 sUnknown/_ah/background
>>>>> 17:02:46.795GET0 B17,350.9 sUnknown/_ah/background
>>>>> 17:02:46.795GET0 B8,925.6 sUnknown/_ah/background
>>>>> 17:02:46.795GET0 B8,923.4 sUnknown/_ah/background
>>>>> 17:02:46.795GET0 B8,866 sUnknown/_ah/background
>>>>> 17:02:46.795GET0 B8,131.1 sUnknown/_ah/background
>>>>> 17:02:46.795GET0 B8,103.3 sUnknown/_ah/background
>>>>> 17:02:46.795GET0 B8,101.8 sUnknown/_ah/background
>>>>> 17:02:46.795GET0 B8,079.2 sUnknown/_ah/background
>>>>>
>>>>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/67689d5c-c12b-4f23-a470-1d492fd48f9c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
  • [google-appengine] /... Olof Gunnarsson
    • [google-appengi... 'Nick (Cloud Platform Support)' via Google App Engine
      • [google-app... 'Nick (Cloud Platform Support)' via Google App Engine
      • [google-app... 'Nick (Cloud Platform Support)' via Google App Engine
        • [google... 'Nick (Cloud Platform Support)' via Google App Engine
          • [go... Olof Gunnarsson
            • ... 'Nick (Cloud Platform Support)' via Google App Engine
              • ... Olof Gunnarsson
                • ... Aran Arunakiri
                • ... Olof Gunnarsson
                • ... Aran Arunakiri
                • ... Olof Gunnarsson

Reply via email to