firedart icon indicating copy to clipboard operation
firedart copied to clipboard

Unhandled exception: gRPC Error (14, Missing trailers)

Open guyluz11 opened this issue 5 years ago • 17 comments

In my software after random number of hours I got this error message

Unhandled exception:
gRPC Error (14, Missing trailers)

I am using firedart with hive

This is my implementation.

Am I implementing it wrong somehow ?

guyluz11 avatar Oct 20 '20 13:10 guyluz11

It's hard to know what the problem could be without more information. Is the error reproducible? Is there a stack trace?

cachapa avatar Oct 21 '20 08:10 cachapa

The error is reproducible and after some observation I found that the shortest time that it happened was 8 minutes and max was 24 minutes. If you would like me to post instructions to reproduce it in my project please say so as calling firedart does not happens automatically when starting the software.

I didn't get other stack trace other than the error that I posted, it could be that I implemented the Debugging part incorrectly.

guyluz11 avatar Oct 21 '20 14:10 guyluz11

By "reproducible" I meant, can you cause the issue to happen on demand? From your description it seems to happen randomly after an undetermined amount of time, which makes it very difficult to debug.

cachapa avatar Oct 21 '20 17:10 cachapa

This is happening simply by running the software and waiting but I have tested again number of times (this time with a stopwatch) and found out that it crash exactly after 10 minutes.

guyluz11 avatar Oct 21 '20 18:10 guyluz11

I need more information in order to even start debugging this issue. Waiting 10 minutes for each test is very time consuming, which unfortunately makes it a non-starter for me.

I'm afraid I won't be of much help here. Firedart is open-source so if you or anyone else wants to invest the time getting to the root of the problem I would be happy to accept a pull request.

cachapa avatar Oct 22 '20 08:10 cachapa

I think the error is coming from listening to changes.

Adding stack trace:

guyluz11 avatar Oct 25 '20 11:10 guyluz11

Those are screenshots of a debugging session, not stack traces.

cachapa avatar Oct 25 '20 11:10 cachapa

As this is inside async I have decided to get the stack trace using stack_trace package to get where it was called from.

I am pasting the same stack trace with two different runs. I am using Chain.capture.

Chain.capture stack trace (don't forget to scroll right):

Unhandled exception:
gRPC Error (14, Missing trailers)
dart:async/stream_controller.dart 634:44                                                                                                          _StreamController.addError
package:grpc/src/client/call.dart 207:16                                                                                                          ClientCall._responseError
package:grpc/src/client/call.dart 277:9                                                                                                           ClientCall._onResponseDone
package:stack_trace/src/stack_zone_specification.dart 206:15                                                                                      StackZoneSpecification._run
package:stack_trace/src/stack_zone_specification.dart 116:48                                                                                      StackZoneSpecification._registerCallback.<fn>
dart:async/zone.dart 1182:47                                                                                                                      _rootRun
dart:async/zone.dart 1093:19                                                                                                                      _CustomZone.run
dart:async/zone.dart 997:7                                                                                                                        _CustomZone.runGuarded
dart:async/stream_impl.dart 410:13                                                                                                                _BufferingStreamSubscription._sendDone.sendDone
dart:async/stream_impl.dart 420:15                                                                                                                _BufferingStreamSubscription._sendDone
dart:async/stream_impl.dart 305:7                                                                                                                 _BufferingStreamSubscription._close
dart:async/stream_transformers.dart 97:11                                                                                                         _SinkTransformerStreamSubscription._close
dart:async/stream_transformers.dart 23:11                                                                                                         _EventSinkWrapper.close
dart:async/stream_transformers.dart 255:12                                                                                                        _HandlerEventSink.close
dart:async/stream_transformers.dart 142:24                                                                                                        _SinkTransformerStreamSubscription._handleDone
package:stack_trace/src/stack_zone_specification.dart 206:15                                                                                      StackZoneSpecification._run
package:stack_trace/src/stack_zone_specification.dart 116:48                                                                                      StackZoneSpecification._registerCallback.<fn>
dart:async/zone.dart 1182:47                                                                                                                      _rootRun
dart:async/zone.dart 1093:19                                                                                                                      _CustomZone.run
dart:async/zone.dart 997:7                                                                                                                        _CustomZone.runGuarded
dart:async/stream_impl.dart 410:13                                                                                                                _BufferingStreamSubscription._sendDone.sendDone
dart:async/stream_impl.dart 420:15                                                                                                                _BufferingStreamSubscription._sendDone
dart:async/stream_impl.dart 305:7                                                                                                                 _BufferingStreamSubscription._close
dart:async/stream_transformers.dart 97:11                                                                                                         _SinkTransformerStreamSubscription._close
dart:async/stream_transformers.dart 23:11                                                                                                         _EventSinkWrapper.close
package:grpc/src/shared/streams.dart 141:10                                                                                                       _GrpcMessageConversionSink.close
dart:convert/chunked_conversion.dart 82:18                                                                                                        _ConverterStreamEventSink.close
dart:async/stream_transformers.dart 142:24                                                                                                        _SinkTransformerStreamSubscription._handleDone
package:stack_trace/src/stack_zone_specification.dart 206:15                                                                                      StackZoneSpecification._run
package:stack_trace/src/stack_zone_specification.dart 116:48                                                                                      StackZoneSpecification._registerCallback.<fn>
dart:async/zone.dart 1182:47                                                                                                                      _rootRun
dart:async/zone.dart 1093:19                                                                                                                      _CustomZone.run
dart:async/zone.dart 997:7                                                                                                                        _CustomZone.runGuarded
dart:async/stream_impl.dart 410:13                                                                                                                _BufferingStreamSubscription._sendDone.sendDone
dart:async/stream_impl.dart 420:15                                                                                                                _BufferingStreamSubscription._sendDone
dart:async/stream_impl.dart 630:14                                                                                                                _DelayedDone.perform
dart:async/stream_impl.dart 730:11                                                                                                                _StreamImplEvents.handleNext
dart:async/stream_impl.dart 687:7                                                                                                                 _PendingEvents.schedule.<fn>
package:stack_trace/src/stack_zone_specification.dart 206:15                                                                                      StackZoneSpecification._run
package:stack_trace/src/stack_zone_specification.dart 116:48                                                                                      StackZoneSpecification._registerCallback.<fn>
dart:async/zone.dart 1182:47                                                                                                                      _rootRun
dart:async/zone.dart 1093:19                                                                                                                      _CustomZone.run
dart:async/zone.dart 997:7                                                                                                                        _CustomZone.runGuarded
dart:async/zone.dart 1037:23                                                                                                                      _CustomZone.bindCallbackGuarded.<fn>
package:stack_trace/src/stack_zone_specification.dart 206:15                                                                                      StackZoneSpecification._run
package:stack_trace/src/stack_zone_specification.dart 116:48                                                                                      StackZoneSpecification._registerCallback.<fn>
dart:async/zone.dart 1190:13                                                                                                                      _rootRun
dart:async/zone.dart 1093:19                                                                                                                      _CustomZone.run
dart:async/zone.dart 997:7                                                                                                                        _CustomZone.runGuarded
dart:async/zone.dart 1037:23                                                                                                                      _CustomZone.bindCallbackGuarded.<fn>
dart:async/schedule_microtask.dart 41:21                                                                                                          _microtaskLoop
dart:async/schedule_microtask.dart 50:5                                                                                                           _startMicrotaskLoop
dart:isolate-patch/isolate_patch.dart 118:13                                                                                                      _runPendingImmediateCallback
dart:isolate-patch/timer_impl.dart 404:11                                                                                                         _Timer._runTimers
dart:isolate-patch/timer_impl.dart 428:5                                                                                                          _Timer._handleMessage
dart:isolate-patch/isolate_patch.dart 168:12                                                                                                      _RawReceivePortImpl._handleMessage
===== asynchronous gap ===========================
dart:async/zone.dart 1114:19                                                                                                                      _CustomZone.registerCallback
dart:async/stream_impl.dart 173:17                                                                                                                _BufferingStreamSubscription._registerDoneHandler
dart:async/stream_impl.dart 120:19                                                                                                                new _BufferingStreamSubscription.zoned
dart:async/stream_impl.dart 113:14                                                                                                                new _BufferingStreamSubscription
dart:async/stream_transformers.dart 50:9                                                                                                          new _SinkTransformerStreamSubscription
dart:async/stream_transformers.dart 185:9                                                                                                         _BoundSinkStream.listen
package:grpc/src/client/call.dart 192:56                                                                                                          ClientCall._onResponseListen
package:grpc/src/client/call.dart 178:5                                                                                                           ClientCall._sendRequest
package:grpc/src/client/call.dart 145:7                                                                                                           ClientCall.onConnectionReady
package:grpc/src/client/http2_connection.dart 191:10                                                                                              Http2ClientConnection._startCall
package:grpc/src/client/http2_connection.dart 167:9                                                                                               Http2ClientConnection.dispatchCall
dart:core-patch/growable_array.dart 313:8                                                                                                         List.forEach
package:grpc/src/client/http2_connection.dart 140:22                                                                                              Http2ClientConnection._connect.<fn>
package:stack_trace/src/stack_zone_specification.dart 126:26                                                                                      StackZoneSpecification._registerUnaryCallback.<fn>.<fn>
package:stack_trace/src/stack_zone_specification.dart 206:15                                                                                      StackZoneSpecification._run
package:stack_trace/src/stack_zone_specification.dart 126:14                                                                                      StackZoneSpecification._registerUnaryCallback.<fn>
dart:async/zone.dart 1198:47                                                                                                                      _rootRunUnary
dart:async/zone.dart 1100:19                                                                                                                      _CustomZone.runUnary
dart:async/future_impl.dart 143:18                                                                                                                _FutureListener.handleValue
dart:async/future_impl.dart 696:45                                                                                                                Future._propagateToListeners.handleValueCallback
dart:async/future_impl.dart 725:32                                                                                                                Future._propagateToListeners
dart:async/future_impl.dart 529:5                                                                                                                 Future._completeWithValue
dart:async-patch/async_patch.dart 40:15                                                                                                           _AsyncAwaitCompleter.complete
dart:async-patch/async_patch.dart 311:13                                                                                                          _completeOnAsyncReturn
package:grpc/src/client/http2_connection.dart                                                                                                     Http2ClientConnection.connectTransport
===== asynchronous gap ===========================
dart:async/zone.dart 1121:19                                                                                                                      _CustomZone.registerUnaryCallback
dart:async/future_impl.dart 280:23                                                                                                                Future.then
package:grpc/src/client/http2_connection.dart 127:24                                                                                              Http2ClientConnection._connect
package:grpc/src/client/http2_connection.dart 175:11                                                                                              Http2ClientConnection.dispatchCall
package:grpc/src/client/channel.dart 81:18                                                                                                        ClientChannelBase.createCall.<fn>
package:stack_trace/src/stack_zone_specification.dart 126:26                                                                                      StackZoneSpecification._registerUnaryCallback.<fn>.<fn>
package:stack_trace/src/stack_zone_specification.dart 206:15                                                                                      StackZoneSpecification._run
package:stack_trace/src/stack_zone_specification.dart 126:14                                                                                      StackZoneSpecification._registerUnaryCallback.<fn>
dart:async/zone.dart 1198:47                                                                                                                      _rootRunUnary
dart:async/zone.dart 1100:19                                                                                                                      _CustomZone.runUnary
dart:async/future_impl.dart 143:18                                                                                                                _FutureListener.handleValue
dart:async/future_impl.dart 696:45                                                                                                                Future._propagateToListeners.handleValueCallback
dart:async/future_impl.dart 725:32                                                                                                                Future._propagateToListeners
dart:async/future_impl.dart 529:5                                                                                                                 Future._completeWithValue
dart:async/future_impl.dart 567:7                                                                                                                 Future._asyncCompleteWithValue.<fn>
package:stack_trace/src/stack_zone_specification.dart 206:15                                                                                      StackZoneSpecification._run
package:stack_trace/src/stack_zone_specification.dart 116:48                                                                                      StackZoneSpecification._registerCallback.<fn>
dart:async/zone.dart 1190:13                                                                                                                      _rootRun
dart:async/zone.dart 1093:19                                                                                                                      _CustomZone.run
dart:async/zone.dart 997:7                                                                                                                        _CustomZone.runGuarded
dart:async/zone.dart 1037:23                                                                                                                      _CustomZone.bindCallbackGuarded.<fn>
dart:async/schedule_microtask.dart 41:21                                                                                                          _microtaskLoop
dart:async/schedule_microtask.dart 50:5                                                                                                           _startMicrotaskLoop
dart:isolate-patch/isolate_patch.dart 118:13                                                                                                      _runPendingImmediateCallback
dart:isolate-patch/isolate_patch.dart 169:5                                                                                                       _RawReceivePortImpl._handleMessage
===== asynchronous gap ===========================
dart:async/zone.dart 1121:19                                                                                                                      _CustomZone.registerUnaryCallback
dart:async/future_impl.dart 280:23                                                                                                                Future.then
package:grpc/src/client/channel.dart 79:21                                                                                                        ClientChannelBase.createCall
package:grpc/src/client/client.dart 33:21                                                                                                         Client.$createCall
package:firedart/generated/google/firestore/v1/firestore.pbgrpc.dart 184:18                                                                       FirestoreClient.listen
package:firedart/firestore/firestore_gateway.dart 172:10                                                                                          FirestoreGateway._initStream
package:firedart/firestore/firestore_gateway.dart 116:5                                                                                           FirestoreGateway.streamDocument
package:firedart/firestore/models.dart 135:43                                                                                                     DocumentReference.stream
package:SmartDeviceDart/features/smart_device/infrastructure/datasources/core_d/fire_store/cloud_fire_store_d.dart 75:18                          CloudFireStoreD.listenToChangeOfDataInPath
dart:async-patch/async_patch.dart 172:18                                                                                                          _AsyncStarStreamController.runBody
package:stack_trace/src/stack_zone_specification.dart 206:15                                                                                      StackZoneSpecification._run
package:stack_trace/src/stack_zone_specification.dart 116:48                                                                                      StackZoneSpecification._registerCallback.<fn>
dart:async/zone.dart 1182:47                                                                                                                      _rootRun
dart:async/zone.dart 1093:19                                                                                                                      _CustomZone.run
dart:async/zone.dart 997:7                                                                                                                        _CustomZone.runGuarded
dart:async/zone.dart 1037:23                                                                                                                      _CustomZone.bindCallbackGuarded.<fn>
package:stack_trace/src/stack_zone_specification.dart 206:15                                                                                      StackZoneSpecification._run
package:stack_trace/src/stack_zone_specification.dart 116:48                                                                                      StackZoneSpecification._registerCallback.<fn>
dart:async/zone.dart 1190:13                                                                                                                      _rootRun
dart:async/zone.dart 1093:19                                                                                                                      _CustomZone.run
dart:async/zone.dart 997:7                                                                                                                        _CustomZone.runGuarded
dart:async/zone.dart 1037:23                                                                                                                      _CustomZone.bindCallbackGuarded.<fn>
dart:async/schedule_microtask.dart 41:21                                                                                                          _microtaskLoop
dart:async/schedule_microtask.dart 50:5                                                                                                           _startMicrotaskLoop
dart:isolate-patch/isolate_patch.dart 118:13                                                                                                      _runPendingImmediateCallback
dart:isolate-patch/isolate_patch.dart 169:5                                                                                                       _RawReceivePortImpl._handleMessage
===== asynchronous gap ===========================
dart:async/zone.dart 1114:19                                                                                                                      _CustomZone.registerCallback
dart:async/zone.dart 1036:22                                                                                                                      _CustomZone.bindCallbackGuarded
dart:async/schedule_microtask.dart 150:47                                                                                                         scheduleMicrotask
dart:async-patch/async_patch.dart 180:5                                                                                                           _AsyncStarStreamController.scheduleGenerator
dart:async-patch/async_patch.dart 264:5                                                                                                           _AsyncStarStreamController.onListen
dart:async/stream_controller.dart 847:24                                                                                                          _runGuarded
dart:async/stream_controller.dart 726:7                                                                                                           _StreamController._subscribe.<fn>
dart:async/stream_impl.dart 435:13                                                                                                                _BufferingStreamSubscription._guardCallback
dart:async/stream_controller.dart 725:18                                                                                                          _StreamController._subscribe
dart:async/stream_controller.dart 860:19                                                                                                          _ControllerStream._createSubscription
dart:async/stream_impl.dart 493:9                                                                                                                 _StreamImpl.listen
dart:async/stream_controller.dart 927:34                                                                                                          new _AddStreamState
dart:async/stream_controller.dart 979:9                                                                                                           new _StreamControllerAddStreamState
dart:async/stream_controller.dart 600:9                                                                                                           _StreamController.addStream
dart:async-patch/async_patch.dart 216:37                                                                                                          _AsyncStarStreamController.addStream
package:SmartDeviceDart/features/smart_device/infrastructure/datasources/core_d/fire_store/remote_data_base_controller.dart 29:5                  RemoteDataBaseController.listenToChangeOfDataInPath
===== asynchronous gap ===========================
dart:async/zone.dart 1114:19                                                                                                                      _CustomZone.registerCallback
dart:async/zone.dart 1036:22                                                                                                                      _CustomZone.bindCallbackGuarded
dart:async/schedule_microtask.dart 150:47                                                                                                         scheduleMicrotask
dart:async-patch/async_patch.dart 180:5                                                                                                           _AsyncStarStreamController.scheduleGenerator
dart:async-patch/async_patch.dart 264:5                                                                                                           _AsyncStarStreamController.onListen
dart:async/stream_controller.dart 847:24                                                                                                          _runGuarded
dart:async/stream_controller.dart 726:7                                                                                                           _StreamController._subscribe.<fn>
dart:async/stream_impl.dart 435:13                                                                                                                _BufferingStreamSubscription._guardCallback
dart:async/stream_controller.dart 725:18                                                                                                          _StreamController._subscribe
dart:async/stream_controller.dart 860:19                                                                                                          _ControllerStream._createSubscription
dart:async/stream_impl.dart 493:9                                                                                                                 _StreamImpl.listen
dart:async/stream_controller.dart 927:34                                                                                                          new _AddStreamState
dart:async/stream_controller.dart 979:9                                                                                                           new _StreamControllerAddStreamState
dart:async/stream_controller.dart 600:9                                                                                                           _StreamController.addStream
dart:async-patch/async_patch.dart 216:37                                                                                                          _AsyncStarStreamController.addStream
package:SmartDeviceDart/features/smart_device/infrastructure/datasources/cloud_value_change_d/cloud_fire_store_listen_to_changes.dart 17:5        CloudFireStoreListenToChangesD.listenAndExecute
===== asynchronous gap ===========================
dart:async/zone.dart 1114:19                                                                                                                      _CustomZone.registerCallback
dart:async/zone.dart 1036:22                                                                                                                      _CustomZone.bindCallbackGuarded
dart:async/schedule_microtask.dart 150:47                                                                                                         scheduleMicrotask
dart:async-patch/async_patch.dart 180:5                                                                                                           _AsyncStarStreamController.scheduleGenerator
dart:async-patch/async_patch.dart 264:5                                                                                                           _AsyncStarStreamController.onListen
dart:async/stream_controller.dart 847:24                                                                                                          _runGuarded
dart:async/stream_controller.dart 726:7                                                                                                           _StreamController._subscribe.<fn>
dart:async/stream_impl.dart 435:13                                                                                                                _BufferingStreamSubscription._guardCallback
dart:async/stream_controller.dart 725:18                                                                                                          _StreamController._subscribe
dart:async/stream_controller.dart 860:19                                                                                                          _ControllerStream._createSubscription
dart:async/stream_impl.dart 493:9                                                                                                                 _StreamImpl.listen
dart:async/stream_controller.dart 927:34                                                                                                          new _AddStreamState
dart:async/stream_controller.dart 979:9                                                                                                           new _StreamControllerAddStreamState
dart:async/stream_controller.dart 600:9                                                                                                           _StreamController.addStream
dart:async-patch/async_patch.dart 216:37                                                                                                          _AsyncStarStreamController.addStream
package:SmartDeviceDart/features/smart_device/infrastructure/repositories/cloud_value_change_r/cloud_value_change_r.dart 18:5                     CloudManagerR.listenToDataBase
===== asynchronous gap ===========================
dart:async/zone.dart 1114:19                                                                                                                      _CustomZone.registerCallback
dart:async/zone.dart 1036:22                                                                                                                      _CustomZone.bindCallbackGuarded
dart:async/schedule_microtask.dart 150:47                                                                                                         scheduleMicrotask
dart:async-patch/async_patch.dart 180:5                                                                                                           _AsyncStarStreamController.scheduleGenerator
dart:async-patch/async_patch.dart 264:5                                                                                                           _AsyncStarStreamController.onListen
dart:async/stream_controller.dart 847:24                                                                                                          _runGuarded
dart:async/stream_controller.dart 726:7                                                                                                           _StreamController._subscribe.<fn>
dart:async/stream_impl.dart 435:13                                                                                                                _BufferingStreamSubscription._guardCallback
dart:async/stream_controller.dart 725:18                                                                                                          _StreamController._subscribe
dart:async/stream_controller.dart 860:19                                                                                                          _ControllerStream._createSubscription
dart:async/stream_impl.dart 493:9                                                                                                                 _StreamImpl.listen
dart:async/stream_controller.dart 927:34                                                                                                          new _AddStreamState
dart:async/stream_controller.dart 979:9                                                                                                           new _StreamControllerAddStreamState
dart:async/stream_controller.dart 600:9                                                                                                           _StreamController.addStream
dart:async-patch/async_patch.dart 216:37                                                                                                          _AsyncStarStreamController.addStream
package:SmartDeviceDart/features/smart_device/domain/entities/cloud_value_change_e/cloud_value_change_e.dart 21:5                                 CloudValueChangeE.listenToDataBase
===== asynchronous gap ===========================
dart:async/zone.dart 1114:19                                                                                                                      _CustomZone.registerCallback
dart:async/zone.dart 1036:22                                                                                                                      _CustomZone.bindCallbackGuarded
dart:async/schedule_microtask.dart 150:47                                                                                                         scheduleMicrotask
dart:async-patch/async_patch.dart 180:5                                                                                                           _AsyncStarStreamController.scheduleGenerator
dart:async-patch/async_patch.dart 264:5                                                                                                           _AsyncStarStreamController.onListen
dart:async/stream_controller.dart 847:24                                                                                                          _runGuarded
dart:async/stream_controller.dart 726:7                                                                                                           _StreamController._subscribe.<fn>
dart:async/stream_impl.dart 435:13                                                                                                                _BufferingStreamSubscription._guardCallback
dart:async/stream_controller.dart 725:18                                                                                                          _StreamController._subscribe
dart:async/stream_controller.dart 860:19                                                                                                          _ControllerStream._createSubscription
dart:async/stream_impl.dart 493:9                                                                                                                 _StreamImpl.listen
package:SmartDeviceDart/features/smart_device/application/usecases/cloud_value_change_u/cloud_value_change_u.dart 29:48                           CloudValueChangeU.listenToDataBase
package:SmartDeviceDart/features/smart_device/application/usecases/smart_server_u/smart_server_u.dart 45:12                                       SmartServerU.startListenToDb
package:SmartDeviceDart/features/smart_device/application/usecases/smart_server_u/smart_server_u.dart 30:5                                        SmartServerU.startListen
package:SmartDeviceDart/features/smart_device/application/usecases/smart_server_u/smart_server_u.dart 23:17                                       SmartServerU.waitForConnection
package:SmartDeviceDart/features/smart_device/application/usecases/core_u/smart_device_manager_u.dart 37:25                                       SmartDeviceManagerU.SmartDeviceMainAsync
package:stack_trace/src/stack_zone_specification.dart 126:26                                                                                      StackZoneSpecification._registerUnaryCallback.<fn>.<fn>
package:stack_trace/src/stack_zone_specification.dart 206:15                                                                                      StackZoneSpecification._run
package:stack_trace/src/stack_zone_specification.dart 126:14                                                                                      StackZoneSpecification._registerUnaryCallback.<fn>
dart:async/zone.dart 1198:47                                                                                                                      _rootRunUnary
dart:async/zone.dart 1100:19                                                                                                                      _CustomZone.runUnary
dart:async/future_impl.dart 143:18                                                                                                                _FutureListener.handleValue
dart:async/future_impl.dart 696:45                                                                                                                Future._propagateToListeners.handleValueCallback
dart:async/future_impl.dart 725:32                                                                                                                Future._propagateToListeners
dart:async/future_impl.dart 529:5                                                                                                                 Future._completeWithValue
dart:async-patch/async_patch.dart 40:15                                                                                                           _AsyncAwaitCompleter.complete
dart:async-patch/async_patch.dart 311:13                                                                                                          _completeOnAsyncReturn
package:SmartDeviceDart/core/helper_methods.dart                                                                                                  getIps
package:stack_trace/src/stack_zone_specification.dart 126:26                                                                                      StackZoneSpecification._registerUnaryCallback.<fn>.<fn>
package:stack_trace/src/stack_zone_specification.dart 206:15                                                                                      StackZoneSpecification._run
package:stack_trace/src/stack_zone_specification.dart 126:14                                                                                      StackZoneSpecification._registerUnaryCallback.<fn>
dart:async/zone.dart 1198:47                                                                                                                      _rootRunUnary
dart:async/zone.dart 1100:19                                                                                                                      _CustomZone.runUnary
dart:async/future_impl.dart 143:18                                                                                                                _FutureListener.handleValue
dart:async/future_impl.dart 696:45                                                                                                                Future._propagateToListeners.handleValueCallback
dart:async/future_impl.dart 725:32                                                                                                                Future._propagateToListeners
dart:async/future_impl.dart 529:5                                                                                                                 Future._completeWithValue
dart:async/future_impl.dart 567:7                                                                                                                 Future._asyncCompleteWithValue.<fn>
package:stack_trace/src/stack_zone_specification.dart 206:15                                                                                      StackZoneSpecification._run
package:stack_trace/src/stack_zone_specification.dart 116:48                                                                                      StackZoneSpecification._registerCallback.<fn>
dart:async/zone.dart 1190:13                                                                                                                      _rootRun
dart:async/zone.dart 1093:19                                                                                                                      _CustomZone.run
dart:async/zone.dart 997:7                                                                                                                        _CustomZone.runGuarded
dart:async/zone.dart 1037:23                                                                                                                      _CustomZone.bindCallbackGuarded.<fn>
dart:async/schedule_microtask.dart 41:21                                                                                                          _microtaskLoop
dart:async/schedule_microtask.dart 50:5                                                                                                           _startMicrotaskLoop
dart:isolate-patch/isolate_patch.dart 118:13                                                                                                      _runPendingImmediateCallback
dart:isolate-patch/isolate_patch.dart 169:5                                                                                                       _RawReceivePortImpl._handleMessage
===== asynchronous gap ===========================
dart:async/zone.dart 1121:19                                                                                                                      _CustomZone.registerUnaryCallback
dart:async-patch/async_patch.dart 83:23                                                                                                           _asyncThenWrapperHelper
package:SmartDeviceDart/features/smart_device/application/usecases/core_u/smart_device_manager_u.dart 18:5                                        new SmartDeviceManagerU
bin/main.dart 22:5                                                                                                                                main.<fn>
package:stack_trace/src/chain.dart 102:24                                                                                                         Chain.capture.<fn>
dart:async/zone.dart 1190:13                                                                                                                      _rootRun
dart:async/zone.dart 1093:19                                                                                                                      _CustomZone.run
dart:async/zone.dart 1630:10                                                                                                                      _runZoned
dart:async/zone.dart 1550:10                                                                                                                      runZoned
package:stack_trace/src/chain.dart 100:12                                                                                                         Chain.capture
bin/main.dart 21:9                                                                                                                                main
dart:async/zone.dart 1450:54                                                                                                                      _RootZone.runUnary
dart:async/future_impl.dart 143:18                                                                                                                _FutureListener.handleValue
dart:async/future_impl.dart 696:45                                                                                                                Future._propagateToListeners.handleValueCallback
dart:async/future_impl.dart 725:32                                                                                                                Future._propagateToListeners
dart:async/future_impl.dart 529:5                                                                                                                 Future._completeWithValue
dart:async-patch/async_patch.dart 40:15                                                                                                           _AsyncAwaitCompleter.complete
dart:async-patch/async_patch.dart 311:13                                                                                                          _completeOnAsyncReturn
package:SmartDeviceDart/features/smart_device/infrastructure/datasources/core_d/manage_physical_components/device_pin_manager.dart                DevicePinListManager.setPhysicalDeviceTypeByHostName
dart:async/zone.dart 1450:54                                                                                                                      _RootZone.runUnary
dart:async/future_impl.dart 143:18                                                                                                                _FutureListener.handleValue
dart:async/future_impl.dart 696:45                                                                                                                Future._propagateToListeners.handleValueCallback
dart:async/future_impl.dart 725:32                                                                                                                Future._propagateToListeners
dart:async/future_impl.dart 529:5                                                                                                                 Future._completeWithValue
dart:async-patch/async_patch.dart 40:15                                                                                                           _AsyncAwaitCompleter.complete
dart:async-patch/async_patch.dart 311:13                                                                                                          _completeOnAsyncReturn
package:SmartDeviceDart/features/smart_device/infrastructure/datasources/system_commands_d/bash_commands_d/bash_commands_for_raspberry_pi_d.dart  BashCommandsForRaspberryPi.getRaspberryPiDeviceVersion
dart:async/zone.dart 1450:54                                                                                                                      _RootZone.runUnary
dart:async/future_impl.dart 143:18                                                                                                                _FutureListener.handleValue
dart:async/future_impl.dart 696:45                                                                                                                Future._propagateToListeners.handleValueCallback
dart:async/future_impl.dart 725:32                                                                                                                Future._propagateToListeners
dart:async/future_impl.dart 529:5                                                                                                                 Future._completeWithValue
dart:async/future.dart 414:23                                                                                                                     Future.wait.<fn>
dart:async/zone.dart 1450:54                                                                                                                      _RootZone.runUnary
dart:async/future_impl.dart 143:18                                                                                                                _FutureListener.handleValue
dart:async/future_impl.dart 696:45                                                                                                                Future._propagateToListeners.handleValueCallback
dart:async/future_impl.dart 725:32                                                                                                                Future._propagateToListeners
dart:async/future_impl.dart 529:5                                                                                                                 Future._completeWithValue
dart:async/future_impl.dart 567:7                                                                                                                 Future._asyncCompleteWithValue.<fn>
dart:async/schedule_microtask.dart 41:21                                                                                                          _microtaskLoop
dart:async/schedule_microtask.dart 50:5                                                                                                           _startMicrotaskLoop
dart:isolate-patch/isolate_patch.dart 118:13                                                                                                      _runPendingImmediateCallback
dart:isolate-patch/isolate_patch.dart 169:5                                                                                                       _RawReceivePortImpl._handleMessage

Process finished with exit code 255

As I suspected, the last line in my programm that was execute in this error is listening to the stream:

      final DocumentReference ref = Firestore.instance.document(dataPath);

      //  Subscribe to changes to that document
      yield* ref.stream;

guyluz11 avatar Oct 25 '20 21:10 guyluz11

It seems the issue is happening in the stream itself, or otherwise in the GRPC code.

Since you mentioned that it's happening after exactly 10 minutes, you might be reaching some sort of timeout in the socket connection. You might try keeping the connection alive by automatically creating activity in the socket, say every minute.

Another option would be to regenerate the data structures using the latest protobuffs and updating the GRPC libraries. There might have been bugfixes released since the last time this was done. Unfortunately I don't currently have the time to do it myself, but instructions are on the project's README.

cachapa avatar Oct 26 '20 06:10 cachapa

I found out that the 10 minutes was just for the runs that I did in that day, yesterday when I run it it was somewhere between 30m to 3h changing between runs.

You might try keeping the connection alive by automatically creating activity in the socket, say every minute.

Activity in the socket did not extended the time of crash (tested in the day that all the crashes where after 10 minutes). Opening and closing the stream is option but I think in the long run it will cost money as opening streams for free have limit and I am aiming for 500+ devices.

There might have been bugfixes released since the last time this was done.

I have created pull request updating both the dependencies versions that firedart use, and regenerated the new RPC stubs. The number of tests that crash before and after are the same.

I will try to test it with my app, I am guessing that cloning it inside my software and calling the files instead of adding firedart dependency is correct way to test it. If you can think of other way to test it before you marge it please tell me.

guyluz11 avatar Oct 26 '20 11:10 guyluz11

Sorry about the broken tests. They use my credentials which aren't available on pull requests for security reasons. I'll run the tests locally to make sure they're passing before merging.

You can add your local firedart clone as a dependency in pubspec.yaml, is that what you're doing? https://dart.dev/tools/pub/dependencies#path-packages

cachapa avatar Oct 26 '20 12:10 cachapa

I just pushed 0.8.3 to pub.dev. Hopefully that fixes the issue

cachapa avatar Oct 26 '20 12:10 cachapa

I wasn't aware of Path packages so thank you.

Tested with 0.8.3 and it did not solved the issue :(

guyluz11 avatar Oct 26 '20 19:10 guyluz11

Quick question, what "Cloud Firestore location" did you choose. Bottom right corner in the picture.

guyluz11 avatar Nov 01 '20 18:11 guyluz11

The location doesn't really matter, it's only relevant if you're worried about latency to a specific location, i.e. if you're using other Google services you'd want them to all be in the same or similar locations to lower latency.

I usually use something in Europe because it's where I live.

cachapa avatar Nov 02 '20 13:11 cachapa

The error got twiked a little bit, I guess this is because of the new grpc version

Unhandled exception:
gRPC Error (code: 14, codeName: UNAVAILABLE, message: Missing trailers, details: null)

I think of opening an issue, should I open it to googleapis, protobuf or to grpc-dart

guyluz11 avatar Dec 17 '20 22:12 guyluz11

I suspect if you open an issue they will ask you questions that you will not be in a good position to answer.

From another issue we learned that Firebase actually requires an updated token even after the stream is opened. Firedart currently doesn't do this, and I suspect the fix for that would be to use Google's official auth package rather than the REST-based approach we have now.

I think this is why your stream is breaking after a while, and given that we're doing things "incorrectly" there, I'm pretty sure those projects would request that you do try it with the google_auth package first.

Unfortunately doing that would require a major rewrite to the entire project, which I currently do not have the time to do. My advice to you would be to use a different package, or not use the real-time stream part of the package.

cachapa avatar Dec 18 '20 10:12 cachapa

Closed by #130

cachapa avatar Feb 22 '24 12:02 cachapa