You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "Luke-hbk (via GitHub)" <gi...@apache.org> on 2023/06/15 07:22:51 UTC

[GitHub] [camel] Luke-hbk opened a new pull request, #10399: [CAMEL-19456] The invocation of the removeRoute() method is too slow …

Luke-hbk opened a new pull request, #10399:
URL: https://github.com/apache/camel/pull/10399

   …when using RAW().
   
   # Description
   
   Working on [that issue](https://issues.apache.org/jira/projects/CAMEL/issues/CAMEL-19456) about "The invocation of the removeRoute() method is too slow when using RAW()."
   
   # Target
   
   - [ ] I checked that the commit is targeting the correct branch (note that Camel 3 uses `camel-3.x`, whereas Camel 4 uses the `main` branch)
   
   # Tracking
   - [ ] If this is a large change, bug fix, or code improvement, I checked there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL-19456) filed for the change (usually before you start working on it).
   
   <!--
   # *Note*: trivial changes like, typos, minor documentation fixes and other small items do not require a JIRA issue. In this case your pull request should address just this issue, without pulling in other changes.
   -->
   
   # Apache Camel coding standards and style
   
   - [ ] I checked that each commit in the pull request has a meaningful subject line and body.
   
   <!--  
   If you're unsure, you can format the pull request title like `[CAMEL-XXX] Fixes bug in camel-file component`, where you replace `CAMEL-XXX` with the appropriate JIRA issue.
   -->
   
   - [ ] I formatted the code using `mvn -Pformat,fastinstall install && mvn -Psourcecheck`
   
   <!-- 
   You can run the aforementioned command in your module so that the build auto-formats your code and the source check verifies that is complies with our coding style. This will also be verified as part of the checks and your PR may be rejected if the checkstyle does not pass.
   
   You can learn more about the contribution guidelines at https://github.com/apache/camel/blob/main/CONTRIBUTING.md
   -->
   
   


-- 
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@camel.apache.org

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


[GitHub] [camel] orpiske commented on pull request #10399: [CAMEL-19456] The invocation of the removeRoute() method is too slow …

Posted by "orpiske (via GitHub)" <gi...@apache.org>.
orpiske commented on PR #10399:
URL: https://github.com/apache/camel/pull/10399#issuecomment-1598191290

   @Luke-hbk yes, I will take a look today.


-- 
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@camel.apache.org

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


[GitHub] [camel] oscerd commented on a diff in pull request #10399: [CAMEL-19456] The invocation of the removeRoute() method is too slow …

Posted by "oscerd (via GitHub)" <gi...@apache.org>.
oscerd commented on code in PR #10399:
URL: https://github.com/apache/camel/pull/10399#discussion_r1230556161


##########
core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/AbstractCamelContext.java:
##########
@@ -175,12 +175,7 @@
 import org.apache.camel.support.service.BaseService;
 import org.apache.camel.support.service.ServiceHelper;
 import org.apache.camel.support.startup.DefaultStartupStepRecorder;
-import org.apache.camel.util.IOHelper;
-import org.apache.camel.util.ObjectHelper;
-import org.apache.camel.util.StopWatch;
-import org.apache.camel.util.StringHelper;
-import org.apache.camel.util.TimeUtils;
-import org.apache.camel.util.URISupport;
+import org.apache.camel.util.*;

Review Comment:
   Please don't use * import



##########
core/camel-core/src/test/java/org/apache/camel/impl/engine/MyBean.java:
##########
@@ -0,0 +1,8 @@
+package org.apache.camel.impl.engine;

Review Comment:
   License is missing



##########
core/camel-util/src/main/java/org/apache/camel/util/UnsafeUriCharactersDecoder.java:
##########
@@ -0,0 +1,55 @@
+package org.apache.camel.util;

Review Comment:
   License is missing



-- 
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@camel.apache.org

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


[GitHub] [camel] github-actions[bot] commented on pull request #10399: [CAMEL-19456] The invocation of the removeRoute() method is too slow …

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #10399:
URL: https://github.com/apache/camel/pull/10399#issuecomment-1596011948

   ### Components test results:
   
   | Total | Tested | Failed :x: | Passed :white_check_mark: | 
   | --- | --- | --- |  --- |
   | 7 | 7 | 7 | 0 |


-- 
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@camel.apache.org

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


[GitHub] [camel] Luke-hbk commented on pull request #10399: [CAMEL-19456] The invocation of the removeRoute() method is too slow …

Posted by "Luke-hbk (via GitHub)" <gi...@apache.org>.
Luke-hbk commented on PR #10399:
URL: https://github.com/apache/camel/pull/10399#issuecomment-1594534471

   I am currently making some changes to the code for the necessary modifications. I will commit it again after the modifications are complete.


-- 
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@camel.apache.org

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


[GitHub] [camel] orpiske merged pull request #10399: [CAMEL-19456] The invocation of the removeRoute() method is too slow …

Posted by "orpiske (via GitHub)" <gi...@apache.org>.
orpiske merged PR #10399:
URL: https://github.com/apache/camel/pull/10399


-- 
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@camel.apache.org

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


[GitHub] [camel] github-actions[bot] commented on pull request #10399: [CAMEL-19456] The invocation of the removeRoute() method is too slow …

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #10399:
URL: https://github.com/apache/camel/pull/10399#issuecomment-1596016335

   ### Components test results:
   
   | Total | Tested | Failed :x: | Passed :white_check_mark: | 
   | --- | --- | --- |  --- |
   | 7 | 7 | 7 | 0 |


-- 
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@camel.apache.org

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


[GitHub] [camel] orpiske commented on pull request #10399: [CAMEL-19456] The invocation of the removeRoute() method is too slow …

Posted by "orpiske (via GitHub)" <gi...@apache.org>.
orpiske commented on PR #10399:
URL: https://github.com/apache/camel/pull/10399#issuecomment-1594543596

   > I apologize, but I am currently in the process of making some changes to the code. I will commit it again after the modifications are complete.
   
   No worries, we are happy to receive contributions! Looking forward to the updated one!


-- 
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@camel.apache.org

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


[GitHub] [camel] orpiske commented on pull request #10399: [CAMEL-19456] The invocation of the removeRoute() method is too slow …

Posted by "orpiske (via GitHub)" <gi...@apache.org>.
orpiske commented on PR #10399:
URL: https://github.com/apache/camel/pull/10399#issuecomment-1598262381

   @Luke-hbk It looks fine here. It seems like a flaky test - We still have a few as we are working on the final bits of Camel 4. 
   
   The PR should be ready to go (c/c @oscerd). 


-- 
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@camel.apache.org

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


[GitHub] [camel] Luke-hbk commented on pull request #10399: [CAMEL-19456] The invocation of the removeRoute() method is too slow …

Posted by "Luke-hbk (via GitHub)" <gi...@apache.org>.
Luke-hbk commented on PR #10399:
URL: https://github.com/apache/camel/pull/10399#issuecomment-1598127507

   Unfortunately, the tests keep failing, so I decided to check the main branch without making any modifications, and it turns out that an error occurs in camel-core.
   
   [ERROR] Failures: 
   [ERROR]   RecipientListWithSimpleExpressionTest.testRecipientList:66->ContextTestSupport.assertMockEndpointsSatisfied:357 mock://0 Received message count. Expected: <50> but was: <49>
   [ERROR]   RecipientListWithSimpleExpressionTest.testStatic:119->ContextTestSupport.assertMockEndpointsSatisfied:357 mock://8 Received message count. Expected: <50> but was: <48>
   [INFO] 
   [ERROR] Tests run: 6100, Failures: 2, Errors: 0, Skipped: 36
   
   
   [INFO] Camel :: Core ...................................... FAILURE [03:47 min]
   
   Can I assist you in resolving the test failures?
   
   


-- 
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@camel.apache.org

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


[GitHub] [camel] github-actions[bot] commented on pull request #10399: [CAMEL-19456] The invocation of the removeRoute() method is too slow …

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #10399:
URL: https://github.com/apache/camel/pull/10399#issuecomment-1597247401

   ### Components test results:
   
   | Total | Tested | Failed :x: | Passed :white_check_mark: | 
   | --- | --- | --- |  --- |
   | 7 | 7 | 7 | 0 |


-- 
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@camel.apache.org

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


[GitHub] [camel] github-actions[bot] commented on pull request #10399: [CAMEL-19456] The invocation of the removeRoute() method is too slow …

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #10399:
URL: https://github.com/apache/camel/pull/10399#issuecomment-1593289499

   ### Components test results:
   
   | Total | Tested | Failed :x: | Passed :white_check_mark: | 
   | --- | --- | --- |  --- |
   | 7 | 7 | 1 | 6 |


-- 
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@camel.apache.org

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


[GitHub] [camel] orpiske commented on a diff in pull request #10399: [CAMEL-19456] The invocation of the removeRoute() method is too slow …

Posted by "orpiske (via GitHub)" <gi...@apache.org>.
orpiske commented on code in PR #10399:
URL: https://github.com/apache/camel/pull/10399#discussion_r1233210653


##########
core/camel-util/src/main/java/org/apache/camel/util/URISupport.java:
##########
@@ -22,14 +22,7 @@
 import java.net.URLEncoder;
 import java.nio.charset.Charset;
 import java.nio.charset.StandardCharsets;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;

Review Comment:
   This will cause the checkstyle to fail. Star imports are ok for static imports, but not for the regular ones.



-- 
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@camel.apache.org

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


[GitHub] [camel] orpiske commented on pull request #10399: [CAMEL-19456] The invocation of the removeRoute() method is too slow …

Posted by "orpiske (via GitHub)" <gi...@apache.org>.
orpiske commented on PR #10399:
URL: https://github.com/apache/camel/pull/10399#issuecomment-1593345355

   Also, out of curiosity: do you have any numbers? A JMH test, maybe? 


-- 
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@camel.apache.org

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


[GitHub] [camel] orpiske commented on pull request #10399: [CAMEL-19456] The invocation of the removeRoute() method is too slow …

Posted by "orpiske (via GitHub)" <gi...@apache.org>.
orpiske commented on PR #10399:
URL: https://github.com/apache/camel/pull/10399#issuecomment-1598280944

   Thanks for your contribution @Luke-hbk 


-- 
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@camel.apache.org

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


[GitHub] [camel] orpiske commented on pull request #10399: [CAMEL-19456] The invocation of the removeRoute() method is too slow …

Posted by "orpiske (via GitHub)" <gi...@apache.org>.
orpiske commented on PR #10399:
URL: https://github.com/apache/camel/pull/10399#issuecomment-1598280264

   Let's get this one in. It would be good to have some tests for it on the CI. Merging ...


-- 
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@camel.apache.org

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


[GitHub] [camel] github-actions[bot] commented on pull request #10399: [CAMEL-19456] The invocation of the removeRoute() method is too slow …

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #10399:
URL: https://github.com/apache/camel/pull/10399#issuecomment-1592502060

   :star2: Thank you for your contribution to the Apache Camel project! :star2: 
   
   :camel: Maintainers, please note that first-time contributors *require manual approval* for the GitHub Actions to run.
   
   :warning: Please note that the changes on this PR may be **tested automatically** if they change components.
   
   :robot: Use the command `/component-test (camel-)component-name1 (camel-)component-name2..` to request a test from the test bot.
   
   If necessary Apache Camel Committers may access logs and test results in the job summaries!


-- 
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@camel.apache.org

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


[GitHub] [camel] github-actions[bot] commented on pull request #10399: [CAMEL-19456] The invocation of the removeRoute() method is too slow …

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #10399:
URL: https://github.com/apache/camel/pull/10399#issuecomment-1593289560

   ### Core test results:
   
   | Tested | Failed :x: | Passed :white_check_mark: | 
   | --- | --- |  --- |
   | 1 | 1 | 0 |


-- 
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@camel.apache.org

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


[GitHub] [camel] github-actions[bot] commented on pull request #10399: [CAMEL-19456] The invocation of the removeRoute() method is too slow …

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #10399:
URL: https://github.com/apache/camel/pull/10399#issuecomment-1596016341

   ### Core test results:
   
   | Tested | Failed :x: | Passed :white_check_mark: | 
   | --- | --- |  --- |
   | 1 | 1 | 0 |


-- 
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@camel.apache.org

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


[GitHub] [camel] github-actions[bot] commented on pull request #10399: [CAMEL-19456] The invocation of the removeRoute() method is too slow …

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #10399:
URL: https://github.com/apache/camel/pull/10399#issuecomment-1596011971

   ### Core test results:
   
   | Tested | Failed :x: | Passed :white_check_mark: | 
   | --- | --- |  --- |
   | 1 | 1 | 0 |


-- 
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@camel.apache.org

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


[GitHub] [camel] github-actions[bot] commented on pull request #10399: [CAMEL-19456] The invocation of the removeRoute() method is too slow …

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #10399:
URL: https://github.com/apache/camel/pull/10399#issuecomment-1597247448

   ### Core test results:
   
   | Tested | Failed :x: | Passed :white_check_mark: | 
   | --- | --- |  --- |
   | 1 | 1 | 0 |


-- 
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@camel.apache.org

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


[GitHub] [camel] orpiske commented on a diff in pull request #10399: [CAMEL-19456] The invocation of the removeRoute() method is too slow …

Posted by "orpiske (via GitHub)" <gi...@apache.org>.
orpiske commented on code in PR #10399:
URL: https://github.com/apache/camel/pull/10399#discussion_r1231235901


##########
core/camel-util/src/main/java/org/apache/camel/util/UnsafeUriCharactersDecoder.java:
##########
@@ -0,0 +1,71 @@
+/*
+ * 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.camel.util;
+
+
+import java.util.HashMap;
+import java.util.Map;
+
+public final class UnsafeUriCharactersDecoder {
+    private static final Map<String,String> unsafeStringsRfc1738;
+
+    static {
+        unsafeStringsRfc1738 = new HashMap<>();
+        unsafeStringsRfc1738.put("%22","\"");
+        unsafeStringsRfc1738.put("%3C","<");
+        unsafeStringsRfc1738.put("%3E",">");
+        unsafeStringsRfc1738.put("%7B","{");
+        unsafeStringsRfc1738.put("%7D","}");
+        unsafeStringsRfc1738.put("%7C","|");
+        unsafeStringsRfc1738.put("%5C","\\\\");
+        unsafeStringsRfc1738.put("%5E","^");
+        unsafeStringsRfc1738.put("%7E","~");
+        unsafeStringsRfc1738.put("%5B","[");
+        unsafeStringsRfc1738.put("%5D","]");
+        unsafeStringsRfc1738.put("%60","`");
+        unsafeStringsRfc1738.put("%20"," ");
+        unsafeStringsRfc1738.put("%23","#");
+    }
+
+    public static String decode(String uri){

Review Comment:
   Maybe add a bit more comments on this method? Ideally, a unit test case so that we/contributors/users know what to expect as in and out of this method?



##########
core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/AbstractCamelContext.java:
##########
@@ -710,21 +715,28 @@ public Collection<Endpoint> removeEndpoints(String uri) throws Exception {
             answer.add(oldEndpoint);
             stopServices(oldEndpoint);
         } else {
-            List<NormalizedUri> toRemove = new ArrayList<>();
-            for (Map.Entry<NormalizedUri, Endpoint> entry : endpoints.entrySet()) {
-                oldEndpoint = entry.getValue();
-                if (EndpointHelper.matchEndpoint(this, oldEndpoint.getEndpointUri(), uri)) {
-                    try {
-                        stopServices(oldEndpoint);
-                    } catch (Exception e) {
-                        LOG.warn("Error stopping endpoint {}. This exception will be ignored.", oldEndpoint, e);
+            String decodeUri = unsafeUriCharactersDecodeWithOutPercent(uri);
+            oldEndpoint = endpoints.remove(getEndpointKey(decodeUri));
+            if(oldEndpoint != null){
+                answer.add(oldEndpoint);
+                stopServices(oldEndpoint);
+            } else {
+                List<NormalizedUri> toRemove = new ArrayList<>();
+                for (Map.Entry<NormalizedUri, Endpoint> entry : endpoints.entrySet()) {
+                    oldEndpoint = entry.getValue();
+                    if (EndpointHelper.matchEndpoint(this, oldEndpoint.getEndpointUri(), uri)) {
+                        try {
+                            stopServices(oldEndpoint);
+                        } catch (Exception e) {
+                            LOG.warn("Error stopping endpoint " + oldEndpoint + ". This exception will be ignored.", e);

Review Comment:
   Just one minor thing. Log like we used to do before (i.e.; using log markers). Like this:
   ```
   LOG.warn("Error stopping endpoint {}. This exception will be ignored.", oldEndpoint, e);
   ```



-- 
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@camel.apache.org

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