-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
firestore: Deadlock when using emulator and parallel read in the transaction #2604
Comments
Thanks for filing the issue. I don't see where in your code or environment you are enabling the emulator-- could you clarify on this? @BenWhitehead do we support this functionality through the emulator? |
Hello @tritone, I added the info :) |
Sounds good-- just wanted to confirm that you are also using |
Yes, I also added that for clarification. As I said, commenting |
Great; thanks very much for the quick response. I'll make sure this use case is supported and we can look into filing a bug in the emulator if the problem is there. |
Do you have any news about that @tritone? I'm asking, because I'm writing an article about testing repositories which includes Firestore, MySQL, and in-memory implementation. Unfortunately, in Firestore implementation I need to explicitly skip some tests because they are failing because of that bug :( |
I didn't see any obvious reason that this shouldn't be supported in the emulator. @BenWhitehead is taking a look-- he's going to see if he can repro using the Java client as well. We will keep you posted. |
I've spent some time attempting to create a repro in Java. Some mixed news I'm afraid. I was able to create what appeared to be a hang when attempting to have multiple transactions modify the same document at the same time, however, the hang resulted in a transaction timeout and each of the failed transactions were retried and then succeed. The noticeable hang I was able to observe in my testing was ~30 seconds while the transaction was timing out. A few more questions to try and help narrow things down:
|
hello @BenWhitehead :) ad 1I increased timeout to 60s on the client level, and it's correct - it's timeouts after 30s
ad 2When I'm setting 60s timeout on the client level
With smaller 1s timeout on the consumer level, it actually also return an error. But what is interesting it's after the client is already dead (I assume that it's not handling the situation when the client connection is closed?)
ad 3It's interesting, but on the first run the error is different. But anyway, the problem is the same (deadlock and error after client or server timeout, in that case it's on the client side):
UPDATE:
|
Thanks for the additional info @roblaszczak. This sounds like it is something that will need some deeper investigation into the internals for the Go Firestore client to determine the best way to address the issue. There is an integration tests in the Java Firestore client that specifically tests this type of scenario and ensure that after the contention, there is a re-attempt. We probably need to ensure that something similar is added to the test suite here. |
95% certain this is related to firebase/firebase-tools#2452 |
Any progress on this issue? |
Follow for updates at firebase/firebase-tools#2452 |
Linked issue has now been closed, see firebase/firebase-tools#4400 |
Client
Firestore
Environment
Emulator running in the way described here: https://firebase.google.com/docs/rules/emulator-setup
Go Environment
Code
e.g.
Expected behavior
No deadlock in
RunTransaction
.Actual behavior
After running the code,
RunTransaction
is blocked until the context is canceled because of timeout.When we will get rid of
_, _ = transaction.Get(docRef)
everything is working fine.Additional context
I'm not sure that it's not just a problem with the newest version of the emulator or client - we have this issue for a couple of months.
It's also hard to say if it's the emulator problem or Go client. Anyway, I tried to find any similar issues in other clients and I didn't found anything useful.
If you think that it may be useful, I can also create issue for the emulator and link it here :)
The text was updated successfully, but these errors were encountered: