Appengine background thread shutdown when using the firebase-server-sdk v 3.0.1

243 views
Skip to first unread message

Joseph Woolley

unread,
Oct 30, 2016, 9:13:22 PM10/30/16
to Firebase Google Group
I recently switched from the firebase-client-sdk v 2.5.2 for Java VM to the firebase-server-sdk v 3.0.1 on appengine. With the client sdk, I was able to use the goOffline method to signal firebase and shutdown all background threads. This allowed basic scaling to stop the instance after a short period of inactivity. With the server sdk, using goOffline, even when preceded with a flush of all pending writes, failed to stop all of the background threads. This causes the service to run indefinitely.

I need to use the server sdk so that I can authenticate the service and override the Auth UID for use with the Firebase Database rules.

Aside from forcefully killing threads via the lifecycle manager (which ends badly; yes, I tried it), is there a way to request the thread shutdown?

I'm using a thread safe reference counter to determine when it is safe to call goOffline.

As a side note, the migration from client sdk to server sdk was fairly easy. Well done firebase team!

Jacob Wenger

unread,
Nov 10, 2016, 6:53:59 PM11/10/16
to fireba...@googlegroups.com
Hey Joseph,

Thanks for the post and sorry for the delay in getting you an answer. I've been trying to track down someone to figure out what is going on, but we are a bit stumped at the moment. The Java SDK should still respect goOffline(), but clearly something is amiss. We are tracking this internally and are going to try to repro this to figure out what is going on.

In the meantime, can you try using the new Firebase Admin Java SDK (latest version as of this comment is 4.0.1) and see if you can repro the same thing? I have a feeling it will have the same issue since I'm not aware of any changes though would have fixed this. But still worth the shot. Side warning: it is a known issue that the Admin Java SDK currently doesn't work in Java 7.

Also, if you could provide us with anything else to help us repro, we would very much appreciate it. For example, is there a minimal repro you can share which exhibits this behavior? Are you using Google App Engine standard or flexible? Are you running on Java 7 or Java 8? Etc.

Hopefully we can get to the bottom of this.

Cheers,
Jacob


--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/079b1746-7ac7-4b30-9bc8-0c7ad062d39a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Doug Stevenson

unread,
Nov 11, 2016, 7:17:14 PM11/11/16
to Firebase Google Group
Joseph,

There is a known issue with the thread that the Firebase server SDK manages that causes problems with GAE manually scaled instances.  It's still being investigated.

Some have found that switching to the new GAE flexible instances resolves the problem.

Doug
Reply all
Reply to author
Forward
0 new messages