[
https://issues.apache.org/jira/browse/GOBBLIN-1432?focusedWorklogId=589370&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-589370
]
ASF GitHub Bot logged work on GOBBLIN-1432:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 26/Apr/21 18:08
Start Date: 26/Apr/21 18:08
Worklog Time Spent: 10m
Work Description: htran1 commented on a change in pull request #3270:
URL: https://github.com/apache/gobblin/pull/3270#discussion_r620526954
##########
File path:
gobblin-modules/gobblin-kafka-common/src/main/java/org/apache/gobblin/KafkaCommonUtil.java
##########
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.gobblin;
+
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+
+public class KafkaCommonUtil {
+ public static final long KAFKA_FLUSH_TIMEOUT_SECONDS = 15L;
+
+ public static void runWithTimeout(final Runnable runnable, long timeout,
TimeUnit timeUnit) throws Exception {
+ runWithTimeout(new Callable<Object>() {
Review comment:
Change Object to Void?
##########
File path:
gobblin-modules/gobblin-kafka-common/src/main/java/org/apache/gobblin/KafkaCommonUtil.java
##########
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.gobblin;
+
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+
+public class KafkaCommonUtil {
+ public static final long KAFKA_FLUSH_TIMEOUT_SECONDS = 15L;
+
+ public static void runWithTimeout(final Runnable runnable, long timeout,
TimeUnit timeUnit) throws Exception {
+ runWithTimeout(new Callable<Object>() {
+ @Override
+ public Object call() throws Exception {
+ runnable.run();
+ return null;
+ }
+ }, timeout, timeUnit);
+ }
+
+ public static <T> T runWithTimeout(Callable<T> callable, long timeout,
TimeUnit timeUnit) throws Exception {
+ final ExecutorService executor = Executors.newSingleThreadExecutor();
+ final Future<T> future = executor.submit(callable);
+ executor.shutdown(); // This does not cancel the already-scheduled task.
+ try {
+ return future.get(timeout, timeUnit);
+ }
+ catch (TimeoutException e) {
Review comment:
Put catch on the same line as the }.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 589370)
Time Spent: 0.5h (was: 20m)
> JVM hangs on flushing events after OOM
> --------------------------------------
>
> Key: GOBBLIN-1432
> URL: https://issues.apache.org/jira/browse/GOBBLIN-1432
> Project: Apache Gobblin
> Issue Type: Bug
> Components: gobblin-kafka, gobblin-metrics
> Reporter: Hanghang Liu
> Assignee: Shirshanka Das
> Priority: Major
> Time Spent: 0.5h
> Remaining Estimate: 0h
>
> A hang was observed for ingestion flows after an OOM.
> This appears to be due to the kafka pusher flush() call not returning.
> Hanging stack.
> {code:java}
> at
> org.apache.kafka.clients.producer.internals.FutureRecordMetadata.get(FutureRecordMetadata.java:29)
> at
> org.apache.gobblin.metrics.kafka.KafkaProducerPusher.flush(KafkaProducerPusher.java:125)
> at
> org.apache.gobblin.metrics.kafka.KafkaProducerPusher.close(KafkaProducerPusher.java:137)
> at com.google.common.io.Closer.close(Closer.java:214) at
> org.apache.gobblin.metrics.reporter.ConfiguredScheduledReporter.close(ConfiguredScheduledReporter.java:245)
> at com.google.common.io.Closer.close(Closer.java:214) at
> org.apache.gobblin.metrics.MetricContext.close(MetricContext.java:553)
> at
> org.apache.gobblin.metrics.RootMetricContext$1.run(RootMetricContext.java:194){code}
>
> Shutdown hook call
> {code:java}
> "DestroyJavaVM" #308 prio=5 os_prio=0 tid=0x00007fb55c01a800 nid=0x5d51 in
> Object.wait() [0x00007fb563f5b000] java.lang.Thread.State: WAITING (on
> object monitor) at java.lang.Object.wait(Native Method) -
> waiting on <0x00000000e036cf30> (a
> org.apache.gobblin.metrics.RootMetricContext$1) at
> java.lang.Thread.join(Thread.java:1252) - locked <0x00000000e036cf30>
> (a org.apache.gobblin.metrics.RootMetricContext$1) at
> java.lang.Thread.join(Thread.java:1326) at
> java.lang.ApplicationShutdownHooks.runHooks(ApplicationShutdownHooks.java:107)
> at
> java.lang.ApplicationShutdownHooks$1.run(ApplicationShutdownHooks.java:46){code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)