Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firestore listeners stop receive updates - Java #896

Open
lucazin opened this issue Dec 21, 2023 · 2 comments
Open

Firestore listeners stop receive updates - Java #896

lucazin opened this issue Dec 21, 2023 · 2 comments

Comments

@lucazin
Copy link

lucazin commented Dec 21, 2023

Java Spring Boot 3.0.2
Firestore Listeners ( 7 )
Region FireStore - Sao paulo
Region Server - Sao Paulo AWS
Issue related : googleapis/google-cloud-java#3514
googleapis/java-firestore#1511

I have this kind of problem @schmidt-sebastian

i have 7 listeners, but always disconnecting some listeners and stop registering information in database. Im using Java.

What i have to do..to stop this behavior..?? because its intermitent situation.

I have to move to realtime database? or have some config extra to fix that? Because when i restart the server the listener back again..

Again, we are having a strange behavior of listeners. We have 7 listeners active and some time just 6..just 5.. and back to 7 ..but with this behavior we can put our plataform in production stage.

im using this

https://firebase.google.com/docs/admin/setup#java

implementation 'com.google.firebase:firebase-admin:9.2.0'

##########################

Resource resource = resourceLoader.getResource("classpath:prod-firebase.json");
    String fileLines = new BufferedReader(new InputStreamReader(resource.getInputStream(), StandardCharsets.UTF_8))
            .lines()
            .collect(Collectors.joining());
    InputStream serviceAccount = new ByteArrayInputStream(fileLines.getBytes());

    FirebaseOptions options = new FirebaseOptions.Builder()
            .setCredentials(GoogleCredentials.fromStream(serviceAccount))
            .setDatabaseUrl("realtimedatabaseurl") //we are using realtimedatabase 
            .build();
    FirebaseApp.initializeApp(options);

    databaseReference = FirebaseDatabase.getInstance().getReference();

    dbfirestore = FirestoreClient.getFirestore(); // firestore instance

image

image

the problem is higher workload .. i check three times the workload and if we see the listener drop when the workload if high. the clock below each graph show us.. everytime have a peak drop listener.

now..i dont know what to do.. :(

Can someone help me?

@google-oss-bot
Copy link

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@lucazin
Copy link
Author

lucazin commented Dec 24, 2023

Hello everyone!
Merry chrismas to all!

Today in the morning we face this issue again.. the listener stop listen updates until i restart the server.
How can i fix this?

`Resource resource = resourceLoader.getResource("classpath:firebase.json");
String fileLines = new BufferedReader(new InputStreamReader(resource.getInputStream(), StandardCharsets.UTF_8))
.lines()
.collect(Collectors.joining());
InputStream serviceAccount = new ByteArrayInputStream(fileLines.getBytes())

    InstantiatingGrpcChannelProvider channelProvider =
            InstantiatingGrpcChannelProvider.newBuilder()
                    .setKeepAliveTime(Duration.ofSeconds(60L))
                    .setKeepAliveTimeout(Duration.ofMinutes(5L))
                    .setPoolSize(5)
                    .build();
    FirestoreOptions firestoreOptions = FirestoreOptions.newBuilder()
            .setChannelProvider(channelProvider).build();

    FirebaseOptions options = new FirebaseOptions.Builder()
            .setCredentials(GoogleCredentials.fromStream(serviceAccount))
            .setDatabaseUrl("https://rtdb-url.firebaseio.com/")
            .setFirestoreOptions(firestoreOptions)
            .build();
    FirebaseApp firebaseApp =FirebaseApp.initializeApp(options,"websocket");   
    this.resourceLoader = resourceLoader;
    dbfirestore = FirestoreClient.getFirestore(firebaseApp);

`

i have 6 listeners, but in firestore graph show 7.. some times 5 or 8... this is very strange and causing big problems to our applications.. and stop random listener...so a order listener or billing listener stop ...we have a big problem..

@schmidt-sebastian can you help us please we are stuck in this situation.

@lucazin lucazin changed the title Firestore client stops functioning after 10 snapshot listeners are registered - JAVA Firestore listeners stop receive updates - Java Dec 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants