You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by GitBox <gi...@apache.org> on 2022/06/06 12:08:27 UTC

[GitHub] [incubator-inlong] pocozh opened a new pull request, #4536: [INLONG-4535][Agent] Support configurable automatic exit function when OOM happens

pocozh opened a new pull request, #4536:
URL: https://github.com/apache/incubator-inlong/pull/4536

   ### Prepare a Pull Request
   *(Change the title refer to the following example)*
   
   - [INLONG-4535][Agent] Support configurable automatic exit function when OOM happens
   
   *(The following *XYZ* should be replaced by the actual [GitHub Issue](https://github.com/apache/incubator-inlong/issues) number)*
   
   - Fixes #4535 
   
   ### Modifications
   
   - If "agent.enable.oom.exit" parameter is set as "true" in agent.properties, agent will automatically exit when OutOfMemoryError happens. 
   
   ### Verifying this change
   
   *(Please pick either of the following options)*
   
   - [ ] This change is a trivial rework/code cleanup without any test coverage.
   
   - [ ] This change is already covered by existing tests, such as:
     *(please describe tests)*
   
   - [ ] This change added tests and can be verified as follows:
   
     *(example:)*
     - *Added integration tests for end-to-end deployment with large payloads (10MB)*
     - *Extended integration test for recovery after broker failure*
   
   ### Documentation
   
     - Does this pull request introduce a new feature? (yes / no)
     - If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)
     - If a feature is not applicable for documentation, explain why?
     - If a feature is not documented yet in this PR, please create a follow-up issue for adding the documentation
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-inlong] pocozh commented on a diff in pull request #4536: [INLONG-4535][Agent] Support configurable automatic exit function when OOM happens

Posted by GitBox <gi...@apache.org>.
pocozh commented on code in PR #4536:
URL: https://github.com/apache/incubator-inlong/pull/4536#discussion_r894427183


##########
inlong-agent/agent-common/src/main/java/org/apache/inlong/agent/utils/ThreadUtils.java:
##########
@@ -0,0 +1,54 @@
+/*
+ * 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.inlong.agent.utils;
+
+import org.apache.commons.lang.exception.ExceptionUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * ThreadUtils, used for handle specified throwable, such as oom, etc.
+ */
+public class ThreadUtils {
+
+    private static final Logger logger = LoggerFactory.getLogger(ThreadUtils.class);

Review Comment:
   > Is it better to capitalize constants?
   
   done



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-inlong] pocozh commented on a diff in pull request #4536: [INLONG-4535][Agent] Support configurable automatic exit function when OOM happens

Posted by GitBox <gi...@apache.org>.
pocozh commented on code in PR #4536:
URL: https://github.com/apache/incubator-inlong/pull/4536#discussion_r894431683


##########
inlong-agent/agent-core/src/main/java/org/apache/inlong/agent/core/HeartbeatManager.java:
##########
@@ -138,8 +139,9 @@ private Runnable heartBeatReportThread() {
                     int heartbeatInterval = conf.getInt(AGENT_HEARTBEAT_INTERVAL,
                             DEFAULT_AGENT_HEARTBEAT_INTERVAL);
                     TimeUnit.SECONDS.sleep(heartbeatInterval);
-                } catch (Exception ex) {
+                } catch (Throwable ex) {
                     LOGGER.error("error caught", ex);

Review Comment:
   > There is also log processing in the threadThrowableHandler method. Can the log output in the catch later be placed in it?
   
   There may be  some other error messages, such as 'LOGGER.error("error while init sender for group id", ex)'.  Moving it  into threadThrowableHandler method does not reflect some key information.



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-inlong] pocozh commented on pull request #4536: [INLONG-4535][Agent] Support configurable automatic exit function when OOM happens

Posted by GitBox <gi...@apache.org>.
pocozh commented on PR #4536:
URL: https://github.com/apache/incubator-inlong/pull/4536#issuecomment-1152269277

   > please add some ut for the oom detection and exit
   
   done


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-inlong] pocozh commented on a diff in pull request #4536: [INLONG-4535][Agent] Support configurable automatic exit function when OOM happens

Posted by GitBox <gi...@apache.org>.
pocozh commented on code in PR #4536:
URL: https://github.com/apache/incubator-inlong/pull/4536#discussion_r894426987


##########
inlong-agent/agent-common/src/main/java/org/apache/inlong/agent/utils/ThreadUtils.java:
##########
@@ -0,0 +1,54 @@
+/*
+ * 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.inlong.agent.utils;
+
+import org.apache.commons.lang.exception.ExceptionUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * ThreadUtils, used for handle specified throwable, such as oom, etc.
+ */
+public class ThreadUtils {
+
+    private static final Logger logger = LoggerFactory.getLogger(ThreadUtils.class);

Review Comment:
   done



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-inlong] Greedyu commented on a diff in pull request #4536: [INLONG-4535][Agent] Support configurable automatic exit function when OOM happens

Posted by GitBox <gi...@apache.org>.
Greedyu commented on code in PR #4536:
URL: https://github.com/apache/incubator-inlong/pull/4536#discussion_r891022858


##########
inlong-agent/agent-common/src/main/java/org/apache/inlong/agent/utils/ThreadUtils.java:
##########
@@ -0,0 +1,54 @@
+/*
+ * 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.inlong.agent.utils;
+
+import org.apache.commons.lang.exception.ExceptionUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * ThreadUtils, used for handle specified throwable, such as oom, etc.
+ */
+public class ThreadUtils {
+
+    private static final Logger logger = LoggerFactory.getLogger(ThreadUtils.class);

Review Comment:
   Is it better to capitalize constants?



##########
inlong-agent/agent-common/src/main/java/org/apache/inlong/agent/utils/ThreadUtils.java:
##########
@@ -0,0 +1,54 @@
+/*
+ * 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.inlong.agent.utils;
+
+import org.apache.commons.lang.exception.ExceptionUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * ThreadUtils, used for handle specified throwable, such as oom, etc.
+ */
+public class ThreadUtils {

Review Comment:
   The function of this class seems to handle exceptions, why is it called ThreadUtils.



##########
inlong-agent/agent-core/src/main/java/org/apache/inlong/agent/core/HeartbeatManager.java:
##########
@@ -138,8 +139,9 @@ private Runnable heartBeatReportThread() {
                     int heartbeatInterval = conf.getInt(AGENT_HEARTBEAT_INTERVAL,
                             DEFAULT_AGENT_HEARTBEAT_INTERVAL);
                     TimeUnit.SECONDS.sleep(heartbeatInterval);
-                } catch (Exception ex) {
+                } catch (Throwable ex) {
                     LOGGER.error("error caught", ex);

Review Comment:
   There is also log processing in the threadThrowableHandler method. Can the log output in the catch later be placed in it?



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-inlong] dockerzhang merged pull request #4536: [INLONG-4535][Agent] Support configurable automatic exit function when OOM happens

Posted by GitBox <gi...@apache.org>.
dockerzhang merged PR #4536:
URL: https://github.com/apache/incubator-inlong/pull/4536


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-inlong] zk1510 commented on a diff in pull request #4536: [INLONG-4535][Agent] Support configurable automatic exit function when OOM happens

Posted by GitBox <gi...@apache.org>.
zk1510 commented on code in PR #4536:
URL: https://github.com/apache/incubator-inlong/pull/4536#discussion_r891032034


##########
inlong-agent/conf/agent.properties:
##########
@@ -53,6 +53,7 @@ thread.pool.await.time=30
 agent.local.ip=127.0.0.1
 agent.local.uuid=
 agent.local.uuid.open=false
+agent.enable.oom.exit=false

Review Comment:
   maybe default true?



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-inlong] pocozh commented on a diff in pull request #4536: [INLONG-4535][Agent] Support configurable automatic exit function when OOM happens

Posted by GitBox <gi...@apache.org>.
pocozh commented on code in PR #4536:
URL: https://github.com/apache/incubator-inlong/pull/4536#discussion_r894427835


##########
inlong-agent/agent-common/src/main/java/org/apache/inlong/agent/utils/ThreadUtils.java:
##########
@@ -0,0 +1,54 @@
+/*
+ * 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.inlong.agent.utils;
+
+import org.apache.commons.lang.exception.ExceptionUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * ThreadUtils, used for handle specified throwable, such as oom, etc.
+ */
+public class ThreadUtils {

Review Comment:
   > The function of this class seems to handle exceptions, why is it called ThreadUtils.
   
   Because it is used for catching OOM and exiting thread



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-inlong] pocozh commented on a diff in pull request #4536: [INLONG-4535][Agent] Support configurable automatic exit function when OOM happens

Posted by GitBox <gi...@apache.org>.
pocozh commented on code in PR #4536:
URL: https://github.com/apache/incubator-inlong/pull/4536#discussion_r894434775


##########
inlong-agent/conf/agent.properties:
##########
@@ -53,6 +53,7 @@ thread.pool.await.time=30
 agent.local.ip=127.0.0.1
 agent.local.uuid=
 agent.local.uuid.open=false
+agent.enable.oom.exit=false

Review Comment:
   > maybe default true?
   
   At present, there is no relevant detection tool. It is better to temporarily set it as false, otherwise users will not perceive it if the agent exits.



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org