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

TestSubscriptionsBasic flaky #149

Open
kjk opened this issue Mar 18, 2019 · 7 comments
Open

TestSubscriptionsBasic flaky #149

kjk opened this issue Mar 18, 2019 · 7 comments

Comments

@kjk
Copy link
Contributor

kjk commented Mar 18, 2019

https://ci.appveyor.com/project/ravendb/ravendb-go-client/builds/23144627/job/ge467894jiqskbqv?fullLog=true#L4358

Could be just networking issue with the machine.

--- FAIL: TestSubscriptionsBasic (5.84s)
    subscriptions_basic_test.go:286: 
        	Error Trace:	subscriptions_basic_test.go:286
        	            				asm_amd64.s:1333
        	Error:      	Not equal: 
        	            	expected: "Adam"
        	            	actual  : "James"
        	            	
        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -1 +1 @@
        	            	-Adam
        	            	+James
        	Test:       	TestSubscriptionsBasic
    subscriptions_basic_test.go:286: 
        	Error Trace:	subscriptions_basic_test.go:286
        	            				asm_amd64.s:1333
        	Error:      	Not equal: 
        	            	expected: "David"
        	            	actual  : "Adam"
        	            	
        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -1 +1 @@
        	            	-David
        	            	+Adam
        	Test:       	TestSubscriptionsBasic
=== RUN   TestSuggestionsLazy
@ayende
Copy link
Member

ayende commented Mar 18, 2019

Try logging all the previous values that you go there. It might have called this twice?
Or there was an error and it retired?

@kjk
Copy link
Contributor Author

kjk commented Mar 18, 2019

It looks like (sometimes) we don't get the first expected value, created before subscription.Run.

@ayende
Copy link
Member

ayende commented Mar 19, 2019

In here:
https://github.com/ravendb/ravendb-go-client/blob/master/tests/subscriptions_basic_test.go#L271

And:
https://github.com/ravendb/ravendb-go-client/blob/master/subscription_worker.go#L427

You are putting the batch into a channel, but it looks like this instance is being reused, so you are getting data races.
If this is a common setup in Go, this is probably a real pitfall and we need to make sure that we won't be re-using this instance.

@kjk
Copy link
Contributor Author

kjk commented Mar 19, 2019

For that reason the callback receives a copy of SubscriptionBatch: https://github.com/ravendb/ravendb-go-client/blob/master/subscription_worker.go#L444

@ayende
Copy link
Member

ayende commented Mar 19, 2019

But you are passing the Item instance, isn't that mutable?

@ayende
Copy link
Member

ayende commented Mar 19, 2019

Okay, make sense.

When you check the logs, see if you can also log what comes from the network. I think this is a Go client problem, not a server one

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

No branches or pull requests

2 participants