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

Impossible to set value into Redis, invalid expire time in 'set' command #85

Closed
daflyinbed opened this issue Jun 10, 2024 · 7 comments · Fixed by #99
Closed

Impossible to set value into Redis, invalid expire time in 'set' command #85

daflyinbed opened this issue Jun 10, 2024 · 7 comments · Fixed by #99

Comments

@daflyinbed
Copy link

caddy 2.8.4
cache-handler v0.13.0

DBG | ts=1718029982.576744 logger=http.handlers.cache msg=Response cache-control &{MustRevalidate:false NoCache:map[] NoCachePresent:false NoStore:false NoTransform:false Public:true Private:map[] PrivatePresent:false ProxyRevalidate:false MaxAge:2592000 SMaxAge:2592000 Immutable:false StaleIfError:-1 StaleWhileRevalidate:-1 Extensions:[]} 
DBG | ts=1718029982.5769842 logger=http.handlers.cache msg=Store the response for GET-http-test.prts.wiki-/load.php?lang=zh-cn&modules=jquery&skin=vector&version=3ozn9{-VARY-}Accept-Encoding:gzip with duration 719h59m59.423201069s 
DBG | ts=1718029982.5798037 logger=http.handlers.cache msg=Stored the key GET-http-test.prts.wiki-/load.php?lang=zh-cn&modules=jquery&skin=vector&version=3ozn9{-VARY-}Accept-Encoding:gzip in the REDIS provider 
DBG | ts=1718029982.5802252 logger=http.handlers.cache msg=Store the tag  
ERR | ts=1718029982.5804055 logger=http.handlers.cache msg=Impossible to set value into Redis, invalid expire time in 'set' command 
DBG | ts=1718029982.5805147 logger=http.handlers.cache msg=Store the tag  
ERR | ts=1718029982.580624 logger=http.handlers.cache msg=Impossible to set value into Redis, invalid expire time in 'set' command 
DBG | ts=1718029982.5807114 logger=http.handlers.cache msg=Store the tag  
ERR | ts=1718029982.5808413 logger=http.handlers.cache msg=Impossible to set value into Redis, invalid expire time in 'set' command 
@darkweak
Copy link
Collaborator

Hey @daflyinbed maybe that's related to darkweak/souin#523 (on the development repository).

@girlbossceo
Copy link

Seeing this too. Seems like the linked PR got merged, is bumping the dependency enough to fix this?

@Forza-tng
Copy link

I tried xcaddy build --with github.com/caddyserver/cache-handler@master which gave me build go: added github.com/caddyserver/cache-handler v0.13.1-0.20240726111616-9b5553f04987

2024/08/07 23:01:58 [INFO] absolute output file path: /opt/caddy/src/caddy
2024/08/07 23:01:58 [INFO] Temporary folder: /tmp/buildenv_2024-08-07-2301.1985171641
2024/08/07 23:01:58 [INFO] Writing main module: /tmp/buildenv_2024-08-07-2301.1985171641/main.go
package main
import (
        caddycmd "github.com/caddyserver/caddy/v2/cmd"
        // plug in Caddy modules here
        _ "github.com/caddyserver/caddy/v2/modules/standard"
        _ "github.com/caddyserver/transform-encoder"
        _ "github.com/dunglas/caddy-cbrotli"
        _ "github.com/WeidiDeng/caddy-cloudflare-ip"
        _ "github.com/caddyserver/cache-handler"
)
func main() {
        caddycmd.Main()
}
2024/08/07 23:01:58 [INFO] Initializing Go module
2024/08/07 23:01:58 [INFO] exec (timeout=0s): /usr/bin/go mod init caddy
go: creating new go.mod: module caddy
go: to add module requirements and sums:
        go mod tidy
2024/08/07 23:01:58 [INFO] Pinning versions
2024/08/07 23:01:58 [INFO] exec (timeout=0s): /usr/bin/go get -d -v github.com/caddyserver/caddy/v2
go: added github.com/beorn7/perks v1.0.1
go: added github.com/caddyserver/caddy/v2 v2.8.4
go: added github.com/caddyserver/certmagic v0.21.3
go: added github.com/caddyserver/zerossl v0.1.3
go: added github.com/cespare/xxhash/v2 v2.2.0
go: added github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572
go: added github.com/google/pprof v0.0.0-20231212022811-ec68065c825e
go: added github.com/google/uuid v1.6.0
go: added github.com/klauspost/cpuid/v2 v2.2.7
go: added github.com/libdns/libdns v0.2.2
go: added github.com/mholt/acmez/v2 v2.0.1
go: added github.com/miekg/dns v1.1.59
go: added github.com/onsi/ginkgo/v2 v2.13.2
go: added github.com/prometheus/client_golang v1.19.1
go: added github.com/prometheus/client_model v0.5.0
go: added github.com/prometheus/common v0.48.0
go: added github.com/prometheus/procfs v0.12.0
go: added github.com/quic-go/qpack v0.4.0
go: added github.com/quic-go/quic-go v0.44.0
go: added github.com/zeebo/blake3 v0.2.3
go: added go.uber.org/mock v0.4.0
go: added go.uber.org/multierr v1.11.0
go: added go.uber.org/zap v1.27.0
go: added go.uber.org/zap/exp v0.2.0
go: added golang.org/x/crypto v0.23.0
go: added golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842
go: added golang.org/x/mod v0.17.0
go: added golang.org/x/net v0.25.0
go: added golang.org/x/sync v0.7.0
go: added golang.org/x/sys v0.20.0
go: added golang.org/x/term v0.20.0
go: added golang.org/x/text v0.15.0
go: added golang.org/x/time v0.5.0
go: added golang.org/x/tools v0.21.0
go: added google.golang.org/protobuf v1.34.1
2024/08/07 23:01:59 [INFO] exec (timeout=0s): /usr/bin/go get -d -v github.com/caddyserver/transform-encoder github.com/caddyserver/caddy/v2
go: added github.com/buger/jsonparser v1.1.1
go: added github.com/caddyserver/transform-encoder v0.0.0-20240312163748-f627fc4f7633
2024/08/07 23:02:03 [INFO] exec (timeout=0s): /usr/bin/go get -d -v github.com/dunglas/caddy-cbrotli github.com/caddyserver/caddy/v2
go: added github.com/dunglas/caddy-cbrotli v1.0.0
go: added github.com/google/brotli/go/cbrotli v0.0.0-20240116120200-adbc354d23af
2024/08/07 23:02:04 [INFO] exec (timeout=0s): /usr/bin/go get -d -v github.com/WeidiDeng/caddy-cloudflare-ip github.com/caddyserver/caddy/v2
go: added github.com/WeidiDeng/caddy-cloudflare-ip v0.0.0-20231130002422-f53b62aa13cb
2024/08/07 23:02:04 [INFO] exec (timeout=0s): /usr/bin/go get -d -v github.com/caddyserver/cache-handler@master github.com/caddyserver/caddy/v2
go: accepting indirect upgrade from github.com/dgraph-io/ristretto@v0.1.0 to v0.1.1
go: accepting indirect upgrade from github.com/imdario/mergo@v0.3.12 to v0.3.13
go: added github.com/RoaringBitmap/roaring v1.2.3
go: added github.com/antlabs/stl v0.0.1
go: added github.com/antlabs/timer v0.0.11
go: upgraded github.com/armon/go-metrics v0.4.0 => v0.4.1
go: added github.com/bits-and-blooms/bitset v1.5.0
go: added github.com/buraksezer/consistent v0.10.0
go: added github.com/buraksezer/olric v0.5.4
go: added github.com/bwmarrin/snowflake v0.3.0
go: added github.com/caddyserver/cache-handler v0.13.1-0.20240726111616-9b5553f04987
go: upgraded github.com/coreos/go-semver v0.3.0 => v0.3.1
go: upgraded github.com/coreos/go-systemd/v22 v22.3.2 => v22.5.0
go: added github.com/darkweak/go-esi v0.0.5
go: added github.com/darkweak/souin v1.6.49
go: added github.com/dgraph-io/badger/v3 v3.2103.5
go: upgraded github.com/dgraph-io/ristretto v0.1.0 => v0.1.1
go: added github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f
go: added github.com/dolthub/maphash v0.1.0
go: added github.com/dolthub/swiss v0.2.1
go: added github.com/gammazero/deque v0.2.1
go: added github.com/go-redis/redis/v8 v8.11.5
go: added github.com/gofrs/flock v0.8.1
go: added github.com/google/flatbuffers v23.1.21+incompatible
go: added github.com/hashicorp/go-msgpack v0.5.5
go: upgraded github.com/hashicorp/golang-lru v0.5.4 => v0.5.5-0.20200511160909-eb529947af53
go: added github.com/hashicorp/logutils v1.0.0
go: added github.com/hashicorp/memberlist v0.5.0
go: upgraded github.com/imdario/mergo v0.3.12 => v0.3.13
go: added github.com/maypok86/otter v1.1.1
go: added github.com/mschoch/smat v0.2.0
go: added github.com/nutsdb/nutsdb v0.14.3
go: added github.com/pierrec/lz4/v4 v4.1.21
go: added github.com/pquerna/cachecontrol v0.2.0
go: added github.com/redis/rueidis v1.0.31
go: added github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529
go: added github.com/tidwall/btree v1.6.0
go: added github.com/tidwall/match v1.1.1
go: added github.com/tidwall/redcon v1.6.2
go: added github.com/vmihailenco/msgpack/v5 v5.3.5
go: added github.com/vmihailenco/tagparser/v2 v2.0.0
go: added github.com/xujiajun/mmap-go v1.0.1
go: added github.com/xujiajun/utils v0.0.0-20220904132955-5f7c5b914235
go: upgraded go.etcd.io/etcd/api/v3 v3.5.0 => v3.5.12
go: upgraded go.etcd.io/etcd/client/pkg/v3 v3.5.0 => v3.5.12
go: upgraded go.etcd.io/etcd/client/v3 v3.5.0 => v3.5.12
2024/08/07 23:02:07 [INFO] exec (timeout=0s): /usr/bin/go get -d -v
2024/08/07 23:02:08 [INFO] Build environment ready
2024/08/07 23:02:08 [INFO] Building Caddy
2024/08/07 23:02:08 [INFO] exec (timeout=0s): /usr/bin/go mod tidy -e
2024/08/07 23:02:08 [INFO] exec (timeout=0s): /usr/bin/go build -o /opt/caddy/src/caddy -ldflags -w -s -trimpath -tags nobadger
2024/08/07 23:02:08 [INFO] Build complete: ./caddy
2024/08/07 23:02:08 [INFO] Cleaning up temporary folder: /tmp/buildenv_2024-08-07-2301.1985171641
././caddy version
v2.8.4 h1:q3pe0wpBj1OcHFZ3n/1nl4V4bxBrYoSoab7rL9BMYNk=
copy from `caddy' [elf64-littleaarch64] to `stCfhiPO' [elf64-littleaarch64]

But the issue maybe is we need a bumped souin dependency?

@danielloader
Copy link

danielloader commented Aug 12, 2024

I swapped out my cache ttl from ttl 28d to ttl 2419200s and it's worked for what it's worth.

Also ttl 31536000s # 1 year worked.

Edit: Also - darkweak/souin#524 - even though this PR is merged, there's been no releases to promote it out to a build since (latest is in May 30th and this was June 28th).

@mohammed90
Copy link
Member

I swapped out my cache ttl from ttl 28d to ttl 2419200s and it's worked for what it's worth.

Souin uses the time.Duration type from Go standard library. This type does not understand the d suffix for day. The caddy.Duration type is the one that understands d suffix for days.

@darkweak, it's your call whether to adopt this and whether it fits the architecture of Souin.

@darkweak
Copy link
Collaborator

Hey there,

@girlbossceo you can just use the following --with to build your caddy instance instead of using the cache-handler while waiting for the next release on the cache-handler repository.

--with github.com/darkweak/storages/redis/caddy \
--with github.com/darkweak/souin/plugins/caddy@8afe9436a62d51f1d403a0896be83db535ccc49c \
--with github.com/darkweak/souin@8afe9436a62d51f1d403a0896be83db535ccc49c

@mohammed90 There is a ticket on top of my todolist to support that. 😄

@bgeneto
Copy link

bgeneto commented Aug 30, 2024

Hey there,

@girlbossceo you can just use the following --with to build your caddy instance instead of using the cache-handler while waiting for the next release on the cache-handler repository.

--with github.com/darkweak/storages/redis/caddy \
--with github.com/darkweak/souin/plugins/caddy@8afe9436a62d51f1d403a0896be83db535ccc49c \
--with github.com/darkweak/souin@8afe9436a62d51f1d403a0896be83db535ccc49c

@mohammed90 There is a ticket on top of my todolist to support that. 😄

The following revisions worked for me, not the above ones:

--with github.com/darkweak/storages/redis/caddy \
--with github.com/darkweak/souin/plugins/caddy@58116b0d43a42edada442016a80fa6ee6372da5e \
--with github.com/darkweak/souin@bf786a225d829845ab3ee11e6c6fe807ad6b31dd

But, unfortunately Souin reports that Redis is not used although configured properly in Caddyfile:

{"level":"warn","ts":1725048230.850813,"logger":"http.handlers.cache","msg":"You're running Souin with the default storage that is not optimized and for development purpose. We recommend to use at least one of the storages from https://github.com/darkweak/storages"}

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

Successfully merging a pull request may close this issue.

7 participants