-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Out of memory error on comparing protobuf types #930
Comments
Note that due to this bug[0] in the `testify` library some unit tests started failing. See this issue[1] for more details. [0]: stretchr/testify#930 [1]: cilium/cilium#12772 Signed-off-by: Robin Hahling <robin.hahling@gw-computing.net>
Use `go-cmp` to rewrite assertion that started to fail after a cilium dep upgrade due to a `testify` bug[0]. More details in this issue[1]. This pulls in `github.com/google/go-cmp` as an explicit dependency. [0]: stretchr/testify#930 [1]: cilium/cilium#12772 Signed-off-by: Robin Hahling <robin.hahling@gw-computing.net>
Note that due to a bug in the `testify` library[0], comparison tests for proto generated structures are done using `go-cmp`. [0]: stretchr/testify#930 Signed-off-by: Robin Hahling <robin.hahling@gw-computing.net>
Note that due to a bug in the `testify` library[0], comparison tests for proto generated structures are done using `go-cmp`. [0]: stretchr/testify#930 Signed-off-by: Robin Hahling <robin.hahling@gw-computing.net>
Note that due to a bug in the `testify` library[0], comparison tests for proto generated structures are done using `go-cmp`. [0]: stretchr/testify#930 Signed-off-by: Robin Hahling <robin.hahling@gw-computing.net>
[ upstream commit d193b1f ] Note that due to a bug in the `testify` library[0], comparison tests for proto generated structures are done using `go-cmp`. [0]: stretchr/testify#930 Signed-off-by: Robin Hahling <robin.hahling@gw-computing.net>
[ upstream commit d193b1f ] Note that due to a bug in the `testify` library[0], comparison tests for proto generated structures are done using `go-cmp`. [0]: stretchr/testify#930 Signed-off-by: Robin Hahling <robin.hahling@gw-computing.net>
Note that due to this bug[0] in the `testify` library some unit tests started failing. See this issue[1] for more details. [0]: stretchr/testify#930 [1]: cilium/cilium#12772 Signed-off-by: Robin Hahling <robin.hahling@gw-computing.net>
Use `go-cmp` to rewrite assertion that started to fail after a cilium dep upgrade due to a `testify` bug[0]. More details in this issue[1]. This pulls in `github.com/google/go-cmp` as an explicit dependency. [0]: stretchr/testify#930 [1]: cilium/cilium#12772 Signed-off-by: Robin Hahling <robin.hahling@gw-computing.net>
Related: #758 |
"github.com/sanity-io/litter" does not appear to suffer from the same bug as spew: https://play.golang.org/p/_1Q8xVsfLdm Not sure how much effort, or if it is possible at all, to replace spew with this one. |
I think setting |
I don't think this is the same problem as davecgh/go-spew#66. davecgh/go-spew#66 is a recursion in type definition, and it does not produce output as it never gets the type's name because of the recursion in the type definition. However, with protobuf generated message, it does generate output if I use I waited for a few minutes and got a partial output of more than 6.6 million lines, and found a lot of duplications inside. |
If there is no easy way to fix the diff issue, can we have a new option or method, like Deep comparing the two structs are quite fast, but dumping is too slow. |
@fefe982 You could perhaps combine https://godoc.org/google.golang.org/protobuf/proto#Equal with If you need the diffs, the import (
"github.com/google/go-cmp/cmp"
"google.golang.org/protobuf/testing/protocmp"
)
// ...
if diff := cmp.Diff(x, y, protocmp.Transform()); diff != "" {
t.Errorf("Unexpected difference:\n%v", diff)
} |
Currently, attempt to compare protobuf-generated types (from *.protoc files) leads to hang or
fatal error: runtime: out of memory
Maybe, it can be solved by respecting pragma.DoNotCompare during executing assert.Equal and similar requests.
It happens at
File: ../../github.com/stretchr/testify/assert/assertions.go
1567: func diff(expected interface{}, actual interface{}) string ..
and then call for spewConfig.Sdump()
Related issue:
davecgh/go-spew#66
Also, setting spew.ConfigState.MaxDepth to reasonable value helps prevent hanging.
The text was updated successfully, but these errors were encountered: