Revolyssup opened a new pull request, #11844:
URL: https://github.com/apache/apisix/pull/11844

   ### Description
   
   <!-- Please include a summary of the change and which issue is fixed. -->
   <!-- Please also include relevant motivation and context. -->
   
   Fixes # (issue)
   Currently there is an intermittent bug. Below are the steps to reproduce:
   Reproduction steps
   1. Create a route and enable health check
   
   ```bash
   curl http://127.0.0.1:9180/apisix/admin/routes/1 -H 'X-API-KEY: 
wqGBivhkYbFXiMdcMEAOMZanCGnLSbWE' -X PUT -d '
   {
       "uri": "/*",
       "upstream": {
            "nodes": {
               "httpbin.org:80": 1,
               "mockbin.org:80": 1
           },
           "type": "roundrobin",
           "checks": {
               "active": {
                   "timeout": 5,
                   "type": "tcp",
                   "healthy": {
                       "interval": 2,
                       "successes": 1
                   },                
                   "unhealthy": {
                       "interval": 2,
                       "successes": 1
                   }
               }
           }
       }
   }'
   ```
   
   2. **access routes to trigger health checks**
   
   ```bash
   curl http://127.0.0.1:9080/get
   ```
   
   3. **When accessing the control api, 500 will be returned and the error in 
the problem description will be generated.**
   ### Checklist
   
   This error is intermittent and multiple tries might be needed to reproduce. 
   On debugging it was found that the cause of issue was 
http_router.user_routes table being polluted by a user request leaving 
unexpected data which while trying to parse, the error was generated.
   
   
   As you can see in the generated logs, user_route returned healthchecker data.
   ![Screenshot from 2024-12-19 
15-11-00](https://github.com/user-attachments/assets/bd22a192-4bdc-4993-9b07-d06189a8961c)
   ![Screenshot from 2024-12-19 
15-10-51](https://github.com/user-attachments/assets/4963f11a-bf23-42f8-b6c5-1ae1e784a6ea)
   
   
   ## Fix
   When deepcopying the user_routes, this error is fixed as the original 
returned table is not tampered.
   - [ ] I have explained the need for this PR and the problem it solves
   - [ ] I have explained the changes or the new features added to this PR
   - [ ] I have added tests corresponding to this change
   - [ ] I have updated the documentation to reflect this change
   - [ ] I have verified that this change is backward compatible (If not, 
please discuss on the [APISIX mailing 
list](https://github.com/apache/apisix/tree/master#community) first)
   
   <!--
   
   Note
   
   1. Mark the PR as draft until it's ready to be reviewed.
   2. Always add/update tests for any changes unless you have a good reason.
   3. Always update the documentation to reflect the changes made in the PR.
   4. Make a new commit to resolve conversations instead of `push -f`.
   5. To resolve merge conflicts, merge master instead of rebasing.
   6. Use "request review" to notify the reviewer after making changes.
   7. Only a reviewer can mark a conversation as resolved.
   
   -->
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to