Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cherry release/3.4.x] cherry-picking important fixes to 34x #12403

Merged
merged 8 commits into from Mar 8, 2024

Commits on Mar 7, 2024

  1. chore(deps): bump resty.aws from 1.3.2 to 1.3.5 (#11613)

    - fix: lazily initialize structures to avoid c-boundary errors on require
      [87](Kong/lua-resty-aws#87)
    
    - fix: remove more module-level uses of config.global
      [83](Kong/lua-resty-aws#83)
    
    - fix: don't invoke region detection code on the module toplevel and advise against trying to.
      [81](Kong/lua-resty-aws#81)
    
    Signed-off-by: Aapo Talvensaari <aapo.talvensaari@gmail.com>
    bungle authored and windmgc committed Mar 7, 2024
    Configuration menu
    Copy the full SHA
    b9c9e45 View commit details
    Browse the repository at this point in the history
  2. fix(pdk): use deep copies of Route, Service, and Consumer objects whe…

    …n log serialize (#11566)
    
    In the function of `kong.log.serialize`, the lifecycle of
    three table `ctx.route`, `ctx.service` and `ctx.authenticated_consumer`
    is across request. Modifying the sub-items in the current request of
    the table will affect the next request, resulting in unexpected behavior
    in Kong.
    
    Fix FTI-5357
    
    ---------
    
    Signed-off-by: sabertobihwy <sabertobihwy@gmail.com>
    sabertobihwy authored and windmgc committed Mar 7, 2024
    Configuration menu
    Copy the full SHA
    4878605 View commit details
    Browse the repository at this point in the history
  3. fix(rate-limiting): counters accuracy with redis policy & sync_rate (#…

    …11859)
    
    * fix(rate-limiting): redis async updates
    
    When the periodic sync to redis feature is turned on, using the
    `sync_rate` configuration option, keys are incremented by steps of 2
    instead of 1 for requests that arrive after the `sync_rate` interval
    has expired.
    
    This happens because after each sync, the key is loaded again from redis
    and also incremented atomically (see: #10559)
    however the next call to `increment` also adds 1 to its value, so
    the key is incremented by 2 every time it's loaded from redis.
    
    This fix sets a negative delta for the key when
    `conf.sync_rate ~= SYNC_RATE_REALTIME` and the key was loaded from redis
    in order to invalidate the next call to `increment`.
    
    Includes a small code refactor
    samugi authored and windmgc committed Mar 7, 2024
    Configuration menu
    Copy the full SHA
    0e908c7 View commit details
    Browse the repository at this point in the history
  4. fix(plugin): RL instances sync to the same DB at same rate (#12003)

    All rate-limiting plugin instance syncs with the same plugin config, that is the very first config got hit by a request, and they all sync with the same rate. Even a config update won't change the DB to be synced.
    
    The timer will sync not just the same instance's counters but all counters in the same DB. This is a compromise given the emergency and we prefer simplicity over correctness for this behavior.
    
    Full changelog
    - The counter table is split with DB;
    - Timers are created when a request hits;
    - The sync_rate is guaranteed with limited running timers and timer delay
    - Cover the case in the integration test by "with_sync_rate"
    
    Fix KAG-2904
    
    Co-authored-by: samugi <samuele@konghq.com>
    2 people authored and windmgc committed Mar 7, 2024
    Configuration menu
    Copy the full SHA
    f9dc649 View commit details
    Browse the repository at this point in the history
  5. fix(db): pg store connection called without self

    ### Summary
    
    The PR #11480 introduced a bug that calls `store_connection`
    without passing `self`. This fixes that.
    
    Signed-off-by: Aapo Talvensaari <aapo.talvensaari@gmail.com>
    bungle authored and windmgc committed Mar 7, 2024
    Configuration menu
    Copy the full SHA
    3c004ab View commit details
    Browse the repository at this point in the history
  6. fix(db/declarative): fix TTL not working in DB-less and Hybrid mode (#…

    …11464)
    
    * fix(declarative): fix TTL not working in DB-less and Hybrid mode
    
    * Previously, in DB-less and Hybrid mode, the ttl/updated_at fields were
      not copied from the original entities to the flattened entities. As a
      result, the entities were loaded without the TTL field.
    * Additionally, for loading the TTL field, the "off" DB strategy
      (lmdb) did not properly filter expired items, nor returned right
      TTL value for DAO.
    
    FTI-4512
    
    * fix coding style
    * fix coding style: improved function name
    * added test case: hybrid mode for key-auth
    * fix test case warnings
    * fixed test case consumer domain
    * export ttl as absolute value
    * delete unused defination
    * move ttl-fixing logic into row_to_entity()
    * still use pg to caculate relative value
    * clean code
    * add changelog entry
    * fixed test cases
    * fixed test cases warning
    * fixed test failure
    * fix test case issue: ttl expiration
    * fix test case: unsed local variable
    * add an entry in CHANGELOG.md
    * fix changelog scope
    * remove release-related information in CHANGELOG.md
    * fix test case: sleep before attempting unnecessary requests
    * sleep before attempting unnecessary requests
    * decrease the ttl to expedite the case's execution
    * fix CHANGELOG typo
    * fix the tense problem of changelog entry
    * add export options for "page_*_for_export" sql statement
    * fix warning: setting non-standard global variable
    * fix error reporting: options is nil
    * fix an issue where the off strategy returned the expired entity
    * run ttl processing before schema:process_auto_fields()
    chobits authored and windmgc committed Mar 7, 2024
    Configuration menu
    Copy the full SHA
    f8e23b2 View commit details
    Browse the repository at this point in the history
  7. fix(cache): make acl entities group cache warmup (#11414)

    kong acl plugin will need to get all consumer groups by customer id (because consumer group and acl plugin config some complex connection), these entities can not be warmed up by Kong, The "warm up" mechanism mainly ensures that all entities are loaded into the cache and enables more precise SQL queries (based on cache key definitions) https://github.com/Kong/kong/blob/master/kong/plugins/acl/daos.lua#L8. However, for scenarios where it is necessary to iterate through all entities under a consumer ID, caching is not possible. https://github.com/Kong/kong/blob/master/kong/plugins/acl/groups.lua#L45
    
    So this PR tries a patch warmup mechanism to support acls entities config.
    
    FTI-5275
    oowl authored and windmgc committed Mar 7, 2024
    Configuration menu
    Copy the full SHA
    af322f9 View commit details
    Browse the repository at this point in the history
  8. fix(core): fix response status code is not real upstream status when …

    …using kong.response function (#11437)
    
    When kong uses kong_buffered_http and upstream timeout, the return status code needs to return 504 (which return by ngx.location.capture), not 502.
    
    FTI-5320
    oowl authored and windmgc committed Mar 7, 2024
    Configuration menu
    Copy the full SHA
    edf3ed6 View commit details
    Browse the repository at this point in the history