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

Fixes panic while having 2 structs having slices being compared #1

Closed
wants to merge 1 commit into from

Conversation

dolanor
Copy link

@dolanor dolanor commented May 6, 2016

Hi!

I'm using mongodm with a project using some protobuf, and I stumbled upon this panic:

2016/05/06 17:48:18 runtime error: comparing uncomparable type proto.Profilegoroutine 36 [running]:
runtime/debug.Stack(0x0, 0x0, 0x0)
    /usr/local/go/src/runtime/debug/stack.go:24 +0x80
github.com/micro/go-micro/server.(*rpcServer).accept.func1(0x7f0f670a8240, 0xc820196140)
    /home/dolanor/go/src/github.com/micro/go-micro/server/rpc_server.go:50 +0x53
panic(0xb6aa60, 0xc820486be0)
    /usr/local/go/src/runtime/panic.go:426 +0x4e9
github.com/zebresel-com/mongodm.(*DocumentBase).DefaultValidate(0xc82014c480, 0xc820129a68, 0x0, 0x0, 0x0)
    /home/dolanor/go/src/github.com/zebresel-com/mongodm/document_base.go:185 +0x3c2a
github.com/zebresel-com/mongodm.(*DocumentBase).Validate(0xc82014c480, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
    /home/dolanor/go/src/github.com/zebresel-com/mongodm/document_base.go:83 +0x32
github.com/zebresel-com/mongodm.(*DocumentBase).Save(0xc82014c480, 0x0, 0x0)
    /home/dolanor/go/src/github.com/zebresel-com/mongodm/document_base.go:410 +0x9c
github.com/org/api/user-srv/db.CreateProfile(0xc8200bc300, 0x0, 0x0)

From my investigation, it is the line I corrected that crashed because of comparing 2 slices.
I don't have more time to investigate, but this fixed my problem.

@moehlone
Copy link
Contributor

moehlone commented May 8, 2016

I will look into this next week :) thank you!

@moehlone
Copy link
Contributor

moehlone commented May 9, 2016

Could you attach the piece of your code which triggers the panic, so that I have an example to reproduce?

@moehlone moehlone self-assigned this May 9, 2016
@dolanor
Copy link
Author

dolanor commented Jun 7, 2016

Hello,

sorry for the delay but I've set up an example where it fails.
It is here : https://github.com/tuxago/test-mongodm/blob/master/test_mongodm.go

The 2 functions called from main are identical except for using imports from here or from my repo having the fixed proposed in this PR. Yours panic (it seems to be caused by slices in a struct) and mine handle it gracefully with the DeepEquals.

PS: I couldn't make "go test" run in your project because of the L function.

@moehlone
Copy link
Contributor

moehlone commented Jun 8, 2016

Thank you in advance - I will check this soon! And thank you for the hint with my tests.. Forgot to encapsulate this..

@lacion
Copy link

lacion commented Jul 29, 2016

any news on this @moehlone ?

@moehlone moehlone closed this in 53f9f65 Sep 5, 2016
@moehlone
Copy link
Contributor

moehlone commented Sep 5, 2016

I finally found some time yesterday to fix the tests and migrated your issue.
Thank you!

@moehlone moehlone added the bug label Jan 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants