Skip to content
Browse files

catch throwables in a few more places

unfortunate but since the on out of memory error jvm flag does not
trigger on these, we need to do something about them sometimes.
this handling is only marginally better but i'll take it for now.
given that it is actually off-heap and not some donkus that isn't
killing-ing on on-heap memory errors, it isn't as impossible to
run a bit of logic.
  • Loading branch information...
1 parent dc86e10 commit 2e4c7fac760944dffc3cfd19b06f09306e5c23af @tea-dragon tea-dragon committed
View
12 hydra-data/src/main/java/com/addthis/hydra/data/query/QueryOpProcessor.java
@@ -32,6 +32,7 @@
import com.addthis.bundle.core.Bundle;
import com.addthis.bundle.table.DataTable;
import com.addthis.bundle.table.DataTableFactory;
+import com.addthis.hydra.data.util.BundleUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -256,7 +257,11 @@ public void sendComplete() {
}
} catch (Exception e) {
log.debug("Exception while processing sendComplete on op processor");
- sourceError(DataChannelError.promote(e));
+ sourceError(BundleUtils.promoteHackForThrowables(e));
+ } catch (Throwable e) {
+ // hopefully an "out of off heap/direct memory" error
+ log.error("Error while processing sendComplete on op processor");
+ sourceError(BundleUtils.promoteHackForThrowables(e));
}
}
@@ -267,8 +272,9 @@ public void close() {
while (currentOp != null) {
try {
currentOp.close();
- } catch (Exception ex) {
- log.error("unexpected exception while closing query op", ex);
+ } catch (Throwable ex) {
+ // hopefully an "out of off heap/direct memory" error if not an exception
+ log.error("unexpected exception or error while closing query op", ex);
}
currentOp = currentOp.getNext();
}
View
28 hydra-data/src/main/java/com/addthis/hydra/data/util/BundleUtils.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed 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 com.addthis.hydra.data.util;
+
+import com.addthis.bundle.channel.DataChannelError;
+
+public final class BundleUtils {
+ private BundleUtils() {}
+
+ public static DataChannelError promoteHackForThrowables(Throwable cause) {
+ if (cause instanceof DataChannelError) {
+ return (DataChannelError) cause;
+ } else {
+ return new DataChannelError(cause);
+ }
+ }
+}
View
12 hydra-main/src/main/java/com/addthis/hydra/query/aggregate/MeshSourceAggregator.java
@@ -20,11 +20,11 @@
import com.addthis.basis.util.JitterClock;
-import com.addthis.bundle.channel.DataChannelError;
import com.addthis.bundle.channel.DataChannelOutput;
import com.addthis.codec.json.CodecJSON;
import com.addthis.hydra.data.query.Query;
import com.addthis.hydra.query.MeshQueryMaster;
+import com.addthis.hydra.data.util.BundleUtils;
import com.addthis.meshy.ChannelMaster;
import org.slf4j.Logger;
@@ -164,21 +164,13 @@ public void operationComplete(ChannelFuture future) throws Exception {
consumer.sendComplete();
} else {
stopSources(future.cause().getMessage());
- consumer.sourceError(promoteHackForThrowables(future.cause()));
+ consumer.sourceError(BundleUtils.promoteHackForThrowables(future.cause()));
if (!future.isCancelled()) {
meshQueryMaster.handleError(query);
}
}
}
- private static DataChannelError promoteHackForThrowables(Throwable cause) {
- if (cause instanceof DataChannelError) {
- return (DataChannelError) cause;
- } else {
- return new DataChannelError(cause);
- }
- }
-
private void safelyRemoveSelfFromPipeline(ChannelFuture future) {
try {
future.channel().pipeline().remove(this);

0 comments on commit 2e4c7fa

Please sign in to comment.
Something went wrong with that request. Please try again.