firebase / firebase/firebase-tools

Firestore emulator freezes/fails when doing document join using block()

Open
#4,636 0 comments 0 reactions 0 assignees View on GitHub
type: bug
Dominant language
TypeScript
Stars
4.5k
Forks
1.3k
Avg merge
1d 12h
Merged PRs (30d)
84

Description

### Environment info
> firebase --version
10.2.1
Windows 10

### Test case

https://github.com/VitorBittencourt/transaction-error.git

### Steps to reproduce

Create at least 1 document by POSTing to each of the following:
localhost:8080/foo/save/123
localhost:8080/bar/save/123

Then for a working non-blocking version, GET the join of the documents at:
localhost:8080/bar/join/123

Then GET
localhost:8080/bar/blockjoin/123

### Expected behavior

Both blocking and non-blocking versions should return a collection like:
```
[
{
"localIdentifier": "123",
"fooCountList": [
2,
4,
3,
1,
0
],
"barCount": 1
},
{
"localIdentifier": "123",
"fooCountList": [
2,
4,
3,
1,
0
],
"barCount": 2
}
]
```

### Actual behavior

The non-blocking version, that doesn't rely on Flux.block(), works as expected.

The blocking version (I know it's not good code, but it is what I had at the time) **works fine against the real Firestore**, but when used on the emulator throws exceptions like

> 2022-Jun-09 15:50:34.467 [grpc-nio-worker-ELG-1-2] ERROR o.s.b.a.w.r.e.AbstractErrorWebExceptionHandler - [ee0dcac8-2] 500 Server Error for HTTP GET "/bar/blockjoin/123"
> java.lang.IllegalStateException: Timeout on blocking read for 5000000000 NANOSECONDS
> at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:123)
> Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException:
> Error has been observed at the following site(s):
> |_ checkpoint ⇢ Handler com.example.transactionerror.BarController#blockingJoin(String) [DispatcherHandler]
> |_ checkpoint ⇢ HTTP GET "/bar/blockjoin/123" [ExceptionHandlingWebHandler]
> Stack trace:
> at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:123)
> at reactor.core.publisher.Mono.block(Mono.java:1730)
> at com.example.transactionerror.BarController.lambda$blockingJoin$4(BarController.java:69)
> ...

Contributor guide

Open the contributing guide

Research direction

Clone the linked transaction-error reproduction and run it with Firebase CLI 10.2.1 on Windows 10. POST to /foo/save/123 and /bar/save/123, then compare GET /bar/join/123 with /bar/blockjoin/123; done means the blocking endpoint returns the expected collection without freezing or timing out.

Written by the indexing model from the issue text.

Assessment

Tech stack
firebase
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.