Repository navigation
Description
Describe the bug
We experience randomly that the stream is losing it's row filter witch causes all events to be returned.
What seams to be related is a exception that we get pretty much at the same time our app starts to behave strange.
I included the stack trace to the "Additional context" section.
To Reproduce
I was not able to reproduce this issue in development but we seen it today in production when a user opened the app up from the background.
Expected behavior
Stream only returns the filtered rows changes.
Screenshots
If applicable, add screenshots to help explain your problem.
Version (please complete the following information):
├── supabase_flutter 1.10.14
│ ├── supabase 1.11.1
│ │ ├── functions_client 1.3.2
│ │ ├── gotrue 1.11.2
│ │ ├── postgrest 1.5.0
│ │ ├── realtime_client 1.2.1
│ │ ├── storage_client 1.5.1
Additional context
data:text/text;charset=utf-8,
{}
When the exception was thrown, this was the stack:
0 SupabaseStreamBuilder._addException (package:supabase/src/supabase_stream_builder.dart:442:0)
1 SupabaseStreamBuilder._getStreamData.<fn> (package:supabase/src/supabase_stream_builder.dart:348:0)
2 RealtimeChannel.subscribe.<fn> (package:realtime_client/src/realtime_channel.dart:202:0)
3 RealtimeChannel.onError.<fn> (package:realtime_client/src/realtime_channel.dart:331:0)
4 RealtimeChannel.trigger (package:realtime_client/src/realtime_channel.dart:569:0)
5 RealtimeClient.onConnMessage.<fn>.<fn> (package:realtime_client/src/realtime_client.dart:316:0)
6 Iterable.forEach (dart:core/iterable.dart:347:0)
7 RealtimeClient.onConnMessage.<fn> (package:realtime_client/src/realtime_client.dart:316:0)
8 new RealtimeClient.<fn> (package:realtime_client/src/realtime_client.dart:116:0)
9 RealtimeClient.onConnMessage (package:realtime_client/src/realtime_client.dart:299:0)
10 RealtimeClient.connect.<fn> (package:realtime_client/src/realtime_client.dart:146:0)
11 _rootRunUnary (dart:async/zone.dart:1407:0)
12 _CustomZone.runUnary (dart:async/zone.dart:1308:0)
13 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1217:0)
14 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339:0)
15 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:0)
16 _ForwardingStreamSubscription._add (dart:async/stream_pipe.dart:123:0)
17 _HandleErrorStream._handleData (dart:async/stream_pipe.dart:253:0)
18 _ForwardingStreamSubscription._handleData (dart:async/stream_pipe.dart:153:0)
19 _rootRunUnary (dart:async/zone.dart:1407:0)
20 _CustomZone.runUnary (dart:async/zone.dart:1308:0)
21 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1217:0)
22 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339:0)
23 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:0)
24 _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:784:0)
25 _StreamController._add (dart:async/stream_controller.dart:658:0)
26 _rootRunUnary (dart:async/zone.dart:1407:0)
27 _CustomZone.runUnary (dart:async/zone.dart:1308:0)
28 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1217:0)
29 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339:0)
30 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:0)
31 _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:784:0)
32 _StreamController._add (dart:async/stream_controller.dart:658:0)
33 _StreamController.add (dart:async/stream_controller.dart:606:0)
34 new _WebSocketImpl._fromSocket.<fn> (dart:_http/websocket_impl.dart:1144:0)
35 _rootRunUnary (dart:async/zone.dart:1407:0)
36 _CustomZone.runUnary (dart:async/zone.dart:1308:0)
37 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1217:0)
38 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339:0)
39 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:0)
40 _SinkTransformerStreamSubscription._add (dart:async/stream_transformers.dart:63:0)
41 _EventSinkWrapper.add (dart:async/stream_transformers.dart:13:0)
42 _WebSocketProtocolTransformer._messageFrameEnd (dart:_http/websocket_impl.dart:332:0)
43 _WebSocketProtocolTransformer.add (dart:_http/websocket_impl.dart:226:0)
44 _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:111:0)
45 _rootRunUnary (dart:async/zone.dart:1407:0)
46 _CustomZone.runUnary (dart:async/zone.dart:1308:0)
47 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1217:0)
48 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339:0)
49 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:0)
50 _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:784:0)
51 _StreamController._add (dart:async/stream_controller.dart:658:0)
52 _StreamController.add (dart:async/stream_controller.dart:606:0)
53 _Socket._onData (dart:io-patch/socket_patch.dart:2445:0)
54 _rootRunUnary (dart:async/zone.dart:1407:0)
55 _CustomZone.runUnary (dart:async/zone.dart:1308:0)
56 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1217:0)
57 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339:0)
58 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:0)
59 _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:784:0)
60 _StreamController._add (dart:async/stream_controller.dart:658:0)
61 _StreamController.add (dart:async/stream_controller.dart:606:0)
62 _RawSecureSocket._sendReadEvent (dart:io/secure_socket.dart:1114:0)
63 _rootRun (dart:async/zone.dart:1391:0)
64 _CustomZone.run (dart:async/zone.dart:1301:0)
65 _CustomZone.runGuarded (dart:async/zone.dart:1209:0)
66 _CustomZone.bindCallbackGuarded.<fn> (dart:async/zone.dart:1249:0)
67 _rootRun (dart:async/zone.dart:1399:0)
68 _CustomZone.run (dart:async/zone.dart:1301:0)
69 _CustomZone.bindCallback.<fn> (dart:async/zone.dart:1233:0)
70 Timer._createTimer.<fn> (dart:async-patch/timer_patch.dart:18:0)
71 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:398:0)
72 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:429:0)
73 _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:189:0)
Activity
[-]Stream loses randomly it's filter[/-][+]Stream loses randomly it's row filter[/+]dshukertjr commentedon Aug 25, 2023
Hi @KirioXX
Would you be able to add the code you are using on client side to listen to realtime streams, and the table definition of the table you are listening to?
Also regarding
How are you observing that all rows are being returned here? Do you have logs that shows rows that doesn't meet the filtering criteria being returned from the stream?
KirioXX commentedon Aug 25, 2023
Hi @dshukertjr,
Thanks for the quick response.
This is the code that we use to stream job changes:
and the table defenition:
and yes we have instabug bug reports that include the application logs.
In those logs we can see that at some point the app starts to update randomly with in a couple seconds what sends the navigation of the rails. What I can't see is the stream configuration and if the filter is still included.
dshukertjr commentedon Aug 25, 2023
Thanks for this @KirioXX
Could it be the
inside
onErrorthat is causing the blinking behavior? Or does the UI suggest thatJobCubitStreamStatus.erroris not being shown?Also, did this only happen after upgrading to a newer version of supabase_flutter, or is this page itself new and didn't exist before upgrading to a newer version of supabase_flutter?
KirioXX commentedon Aug 25, 2023
The streamStatus is just a marker we set in the state for logging purposes, somehow I can't see the state at the moment in the logs.
The flickering is actually coming from the navigation that tries to keep up with the quick state updates.
We have not experienced this behaviour on the old supabase versions, but I can't tell you when it started since we haven had active users for quite some time. The screen and the cubit exists for quite some time.
KirioXX commentedon Aug 25, 2023
What I just noticed it could be that we never experienced this bug because we used to refresh the stream on every user interaction to get around the 15 minute timeout.
encima commentedon Sep 5, 2023
@KirioXX this is a fairly complex one to reproduce and help debug. If you have a minimal, reproducible example, this would help a lot.
Have you tried setting
distincton the stream subscription or checking if multiple events are firing when they shouldn't be?dshukertjr commentedon Jan 22, 2024
I'm going to close this issue as it is hard to conclude that the filter set on the
.stream()method is dropped by the SDK. If anyone is experiencing something similar, feel free to comment and we can reopen this issue.