traefik: v2.8.2 go panic
Welcome!
- Yes, I’ve searched similar issues on GitHub and didn’t find any.
- Yes, I’ve searched similar issues on the Traefik community forum and didn’t find any.
What did you do?
Watchtower upgraded to 2.8.2, I’m sourcing latest
. Upgrade should have gone smoothly as usual.
What did you see instead?
Go panic, can post full stack trace if necessary, its very large and hard to bound.
What version of Traefik are you using?
Version: 2.8.2
Codename: vacherin
Go version: go1.19
Built: 2022-08-11T14:55:50Z
OS/Arch: linux/amd64
What is your environment & configuration?
Docker provider, cannot provide config (company/org). 2.8.1 works as expected.
If applicable, please paste the log output in DEBUG level
time="2022-08-11T17:16:16-03:00" level=error msg="Error in Go routine: runtime error: slice bounds out of range [2:1]"
traefik-traefik-1 | time="2022-08-11T17:16:16-03:00" level=error msg="Stack: goroutine 29 [running]:\nruntime/debug.Stack()\n\truntime/debug/stack.go:24 +0x65\ngithub.com/traefik/traefik/v2/pkg/safe.defaultRecoverGoroutine({0x36a75c0?, 0xc0007e40c0})\n\tgithub.com/traefik/traefik/v2/pkg/safe/routine.go:66 +0xa5\ngithub.com/traefik/traefik/v2/pkg/safe.GoWithRecover.func1.1()\n\tgithub.com/traefik/traefik/v2/pkg/safe/routine.go:56 +0x36\npanic({0x36a75c0, 0xc0007e40c0})\n\truntime/panic.go:884 +0x212\ngithub.com/traefik/paerser/parser.filler.setSlice({{0x19?, {0x3989c0e?, 0x0?}}}, {0x2ff49c0?, 0xc0004c91f8?, 0x355146f?}, 0xc0004d86c0)\n\tgithub.com/traefik/paerser@v0.1.6/parser/element_fill.go:157 +0xaa5\ngithub.com/traefik/paerser/pa
lots more, typical go stack trace. I can’t reproduce this frequently, I need to get this server back to production.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 17
- Comments: 96 (29 by maintainers)
Links to this issue
Commits related to this issue
- modules: qbittorrent-nox: fix syntax error traefik/traefik/issues/9249 — committed to 1sixth/flakes by 1sixth 2 years ago
If this sort of instability is to be expected perhaps there should be a stable tag to accompany tested versions? I’d prefer not to have to manually pin to each minor version to prevent unrecovered panics in production.
Because of the amount of discussion on this topic, I will try to summarize it (again).
In v2.8.2, the parser of dynamic configuration files can detect malformed configuration. The parser will detect when a string is used instead of an array.
example:
To detect the problems, you can use JSON schema validation https://www.schemastore.org/json/. The schema validation can be integrated into your IDE/text editor.
In v2.8.3, we changed the behavior to allow invalid configurations (this is not a revert or a rollback but an extended behavior). We will remove this (the support of invalid configurations) in a future release (v2.9 or later). So we recommend validating your configuration with the JSON schema of Traefik and fixing the invalid configurations.
Because of the amount of discussion on this topic, I will try to summarize it.
In v2.8.2, the parser of dynamic configuration files can detect malformed configuration. The parser will detect when a string is used instead of an array.
example:
To detect the problems, you can use JSON schema validation https://www.schemastore.org/json/.
The schema validation can be integrated into your IDE/text editor.
If you need help, you can come to the forum: https://community.traefik.io/
I will create a path that will return an error instead of panic.
But your configuration needs to be changed
The previous behavior (<2.8.2) was a bug, so it’s not a breaking change, now we just detect invalid configuration.
The schemastore extension is related to json files, you need the vscode-yaml extension to validate yaml files using schemastore.
This is the plugin:
In order to enable a specific JSON schema, the quickest way is through modeline, so in dynamic config file, put this as the first line:
For the static config you would use this:
I put your dynamic config in my VSCode with the vscode-yaml extension, and it highlighted all the errors, also the crowdsec one (it should be
forwardAuth
, with the uppercasedA
) that wasn’t mentioned:I documented the problem into the migration guide: https://doc.traefik.io/traefik/migration/v2/#v283
We will add a link to this page inside the release note of v2.8.3
I missed the point of the series of errors, sorry and thank you very much
Thanks a lot for the hint. I installed the vscode-yaml extension that also supports SchemaStore repo.
It immediately found the issue in my big dynamic config file:
problem (string)
fix (array/list)
Now v2.8.2 starts correctly.
You didn’t read the whole thread: in 2.8.2 the errors have become blocking, in 2.8.3 they reverted this. Read this post and the following replies of the devs.
There are no unidentified issues.
@ldez @VladyslavVolkov it’s working great: with the updated schemas, I found another error I had in the dynamic config:
contentsecuritypolicy
vscontentSecurityPolicy
.Great job gentlemen, and again: thanks a lot. 😃
@VladyslavVolkov @ldez I was thinking: would it be possible to create a simple webpage with two sections (static and dynamic) where the users could paste their configs and they would be validated using YAML Language Server, that supports schemastore?
I tried to look for an online YAML validator with schemastore support, but couldn’t find one. I think it would really help traefik users.
Thanks Ludovic. I’ll wait for the merge then test again.
I updated to scheme to be strict for all properties. https://github.com/SchemaStore/schemastore/pull/2419
I’m currently working on it.
@alexdelprete I see what you mean - found that additionalProperties are not forbidden on http router object.
Could you check please if my assumption correct? You should point yaml config to this schema url
https://raw.githubusercontent.com/VladyslavVolkov/schemastore/traefik-schema-update/src/schemas/json/traefik-v2-file-provider.json
which is not in schemastore yet.@ldez @alexdelprete thanks guys for commenting that, I’ve updated both schemas (static/dynamic) in PR mentioned above - let me know if additional changes required.
I did not think that you are a validation system but every tool I used for YAML-Validation said it was all perfectly valid… I still do not fully understand why this is so different but I did correct the errors you pointed out and now it works again, so thank you very much 👍
I’m not a validation system 😄
homebridge.yml
unraid.yml
Use the JSON schema validation from schemastore,
entrypoints
must beentryPoints
.To get more help, please go to the forum: https://community.traefik.io/
The main problem is the indentation of the section
http
.You have problems with
entryPoints
andmiddlewares
.Use the JSON schema validation from schemastore
To get more help, please go to the forum: https://community.traefik.io/
Ok, now I get it (I think): it was the right solution but on the timing there were different opinions. 😃
Wow, that fixed it. Thanks! Wasn’t underlined from the schemastore plugin though. Hm. Anyways, thanks again. I wasn’t able to spot that.
invalid configurations:
valid configurations:
If you read @ldez post here, he explained why:
no, that’s the static. and the error was clear in the log: the websecure definition.
Thanks, I planned to add a port and forgot to change it back, but I don’t know why 2.7.3 can run, sorry
I’ve been back through all the official docs and I can’t seem to find an instance of the config I originally used. Perhaps I made the assumption that if it was a single value, a string instead of a list would be fine. Now I know better!
@ldez I honestly couldn’t tell you. It’s been… years, since I created that config file. And given the time I’m also going to sleep, now that everything is working again. I hope @MattKobayashi will help you out 😅
Thank you for the super quick response though. Didn’t expect that to get resolved so fast 😄
You can use JSON schema validation.
https://www.schemastore.org/json/
how do we identify where the problem in the config is exactly? my dynamic config is pretty big…and there’s no indication of the lines that create the problem.