Posts

ScheduledExecutorService consumes 100% CPU when corePoolSize = 0

Image
3 1 I've ran into an interesting issue in production. I've had the following ScheduledThreadPool allocation code: ScheduledExecutorService executorService = Executors.newScheduledThreadPool(Runtime.getRuntime().availableProcessors() - 1); The thread pool was processing some tasks from the queue periodically. And everything was working fine till the moment when the service was deployed on a single core environment. Apparently, the line above converted to: ScheduledExecutorService executorService = Executors.newScheduledThreadPool(0); Since then, the JVM process CPU utilization was constantly around 100%. The moment I've changed Runtime.getRuntime().availableProcessors() - 1 to constant 1 the issue have gone. It took sometime to find out the root cause, but still I don't know ...

The query requires an index. You can create it here: {link is broken}

Image
1 I'm querying against my "GroupConvos" collection where the documents all have a memberIds string array with Ids about members that belong to that group and doing the following query for GroupConvos gives me with a broken link self.db.collection(kGroupConvos) .order(by: kUpdatedAt, descending: true) .whereField("memberIds", arrayContains: self.currentUserId) .limit(to: 20) .getDocuments { [weak self] snapshot, error in if let error = error { print(error) } else { ... } The query requires an index. You can create it here: {link} Image: So I went into the console and created an index: And I keep getting that same error when I do my query. Any suggestions as to what to do here? ...