Caddy: pb.proto warning

Created on 27 Jun 2020  路  16Comments  路  Source: caddyserver/caddy

I was upgrading to v2.1 and the build seemed to go fine.

When I attempted to print up the version to confirm I was shown this warning message:

2020/06/26 17:58:17 WARNING: proto: file "pb.proto" is already registered
A future release will panic on registration conflicts. See:
https://developers.google.com/protocol-buffers/docs/reference/go/faq#namespace-conflict

v2.1.0 h1:MC4d65RCVaEKy1iOFjsD51mybOwS8qdEVBi7ESDhUfE=

It seems to run fine but thought that may be of interest to the project.

bug

Most helpful comment

For what it's worth, I'm fixing this upstream at https://github.com/dgraph-io/badger/pull/1519, which should remove the warning when a Go binary includes both badger v1 and v2.

All 16 comments

According to dgraph-io/dgraph#5290, this is due to upgrading the github.com/golang/protobuf package and can be fixed by downgrading it. Needs further digging to understand the nuance of what's going on there. Nonetheless, the fix seems simple.

Thank you!

I'll keep it open. We need to resolve it by inspecting our dependency graph and pick appropriate packages version.

The error originates from github.com/dgraph-io/dgraph, which is in our dep graph due to github.com/smallstep/nosql.

$ go mod why github.com/dgraph-io/badger
# github.com/dgraph-io/badger
github.com/caddyserver/caddy/v2/modules/caddypki/acmeserver
github.com/smallstep/nosql
github.com/smallstep/nosql/badger/v1
github.com/dgraph-io/badger

c9049bdc24cf35a1c2a4871401428cd08daf1f7d causes the issue.

That's weird, those are just patch updates. There should be no breaking changes in those.

I think github.com/smallstep/nosql v0.3.1 is to blame.

Technically it's not a breaking change in isolation for that lib to update its protobuf dependency, but the problem is that we also depend on CEL which also uses protobuf, but a version from a different repo.

I think those weren't marked as conflicting dependencies by the go mod dependency solver so we have two different versions pulled in of protobuf now.

I'm just thinking out loud based on the evidence I think is apparent but I can't say for sure, I don't know how go mod does its dep resolution, just making guesses here.

I think #3526 is related.

Sorry, my investigative skills were subpar. It isn't coming from dgraph. dgraph experienced the same issue because they have their own pb.proto and depend on badger which also has pb.proto. We're seeing it from badger. I think this is because our go.sum has multiple versions of badger, which is transitive from github.com/smallstep/nosql, who also see the same in their go.sum.

https://github.com/caddyserver/caddy/blob/c9049bdc24cf35a1c2a4871401428cd08daf1f7d/go.sum#L168-L173

Downgrading github.com/smallstep/nosql to v0.3.0 resolves it, if this is a route we want to take. I checked the diff between v0.3.1 and v0.3.0, and there isn't anything noteworthy besides updating badger and accommodating for the API change of badger.

Perhaps golang/protobuf#1122 is loosely related

@Mohammed90 Thanks for the investigation. Downgrading nosql is fine for now.

I'm still trying to understand the crux of the origin of the problem. I won't have much time to dig into this particular issue for a while since I'm busy working on the website backend. Is this due to a combination of our own dependencies, or is the problem upstream in another dependency?

There's nothing for us to do in our codebase, neither in smallstep/nosql. It's just the mere dependency on badger. It's resolved in badger as of PR dgraph-io/badger#1293. So to resolve it from the root, smallstep/nosql should depend on a commit dgraph-io/badger@809725940698806f4e6e828ee936a11ac05b8e62 or any commit after it.

If someone can convince dgraph-io/badger to do a point release just for that, that'd be great for everyone.

Alright, cool. We'll make sure this gets out in a 2.1.1 release soon.

For what it's worth, I'm fixing this upstream at https://github.com/dgraph-io/badger/pull/1519, which should remove the warning when a Go binary includes both badger v1 and v2.

It's back! I tried to compile the new 2.3.0 code and am getting the same message.

It had gone away on the 2.2 branch.

@dijiwiz make sure to use the latest version of Go when building. And if that still doesn't work, please post your build logs and more detail.

Yeah it's not showing up for me.

I am using Go 1.5.6. I blew off my go.sum and module directory and did a go mod tidy and rebuilt. It works now.

Previously I had updated the go.mod version and ran a go mod tidy.

Thanks for the help and the program. Happy new year!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ericmdantas picture ericmdantas  路  3Comments

billop picture billop  路  3Comments

dafanasiev picture dafanasiev  路  3Comments

whs picture whs  路  3Comments

treviser picture treviser  路  3Comments