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

Org data expiration is ignored #2797

Closed
excieve opened this issue Jan 10, 2020 · 7 comments · Fixed by #2824
Closed

Org data expiration is ignored #2797

excieve opened this issue Jan 10, 2020 · 7 comments · Fixed by #2824

Comments

@excieve
Copy link
Member

excieve commented Jan 10, 2020

Branch/Environment/Version

  • Branch/Version: v2.9.0-2.9.2
  • Environment: Hybrid, potentially on-prem too

Describe the bug
Data expiry set on an organisation to a non-default value is ignored by the Hybrid gateways after upgrading the image to v2.9.2. Whatever the value, the analytics records end up with 7 days expiry. I've tested this on all 2.9.x images and they all experience this issue, the last image it's working with is v2.8.5 (there's no 2.8.6 hybrid image for some reason).

Reproduction steps
Steps to reproduce the behavior:

  1. Use a cloud organisation with hybrid enabled
  2. Set data expiry to e.g. 2592000 (30 days)
  3. Create an API or use an existing one
  4. Launch tykio/tyk-hybrid-docker:v2.9.2 image (preferably using the official start.sh script)
  5. Make sure it's running successfully and access the API locally
  6. Observe expireAt field on the analytics record

Actual behavior
The expireAt field is set in future at 7 days.

Expected behavior
The expireAt field should be set in future at 30 days.

Logs (debug mode or log file):
hybexp.log

Configuration (tyk config file):
The standard hybrid image config, not altered.

Additional context
See these logs lines:

time="Jan 10 16:44:08" level=debug msg="no cached entry found, returning 7 days"
time="Jan 10 16:44:08" level=debug msg="[STORE] Getting WAS: 5948f5e9f841a10001e254281390ec9540e84b778503a9dff2d7895e"
time="Jan 10 16:44:08" level=debug msg="Input key was: orgkey.5948f5e9f841a10001e254281390ec9540e84b778503a9dff2d7895e"
time="Jan 10 16:44:08" level=debug msg="[STORE] Getting: orgkey.5948f5e9f841a10001e254281390ec9540e84b778503a9dff2d7895e"
time="Jan 10 16:44:08" level=debug msg="Input key was: orgkey.5948f5e9f841a10001e254281390ec9540e84b778503a9dff2d7895e"
time="Jan 10 16:44:08" level=debug msg="Using cache for: orgkey.5948f5e9f841a10001e254281390ec9540e84b778503a9dff2d7895e"
time="Jan 10 16:44:08" level=debug msg="--> Found? false"
time="Jan 10 16:44:08" level=debug msg="Error trying to get value:Key not found"
time="Jan 10 16:44:08" level=debug msg="GetKey took 143.198065ms"
time="Jan 10 16:44:08" level=debug msg="Could not get session detail, key not found" err="key not found" inbound-key="****5428" prefix=auth-mgr

Also, this behaviour is potentially similar with on-prem, but haven't tested.

@excieve
Copy link
Member Author

excieve commented Jan 10, 2020

Found a related issue: #2370
But its commit seems to be missing in 2.9.2:
a290e40

@buger
Copy link
Member

buger commented Jan 10, 2020

@excieve if you open this commit link, it says it is included into 2.9.1

@excieve
Copy link
Member Author

excieve commented Jan 10, 2020

@buger Yes, but if you check whether this change is actually there in 2.9.2 it seems to be missing:
https://github.com/TykTechnologies/tyk/blob/v2.9.2/gateway/middleware.go#L240

Still, it might not be the cause of this particular issue as I'm seeing this on 2.9.1 as well.

@komalsukhani
Copy link
Contributor

@excieve Looks like enforce_org_quotas in tyk configuration file is set to false.

@excieve
Copy link
Member Author

excieve commented Jan 23, 2020

@komalsukhani I believe this particular feature depends on enforce_org_data_age option instead:
https://github.com/TykTechnologies/tyk/blob/v2.9.2/gateway/middleware.go#L225

This is set to true in the hybrid image conf file:
https://github.com/TykTechnologies/tyk-hybrid-docker/blob/master/tyk/tyk.conf#L51

@buger
Copy link
Member

buger commented Jan 26, 2020

@maciejwojciechowski note that it was failing only in hybrid mode.

tykbot bot pushed a commit that referenced this issue Jan 26, 2020
Fixes #2797 

(cherry picked from commit 2ebfe1d)
@ilijabojanovic
Copy link
Member

Verified on local mdcb setup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants