powersync.dart icon indicating copy to clipboard operation
powersync.dart copied to clipboard

Client already closed exception

Open gh-ranjanKiran opened this issue 10 months ago • 2 comments

Image

Hi, The above exception occurs sometimes during

  1. Hot restart
  2. Multiple times calling disconnectAndClear and reopening connection with new auth token.

We use the same base url for both our

  1. Normal API calls
  2. Connecting to powersync instance

What we have noticed and this is not reproducible is that, sometimes when above issue occurs, our normal API calls also stop working and we receive a response of this type for all API calls until users logs out of the app.

HttpException: Connection closed while receiving data

As we are using Dio library for our API calls, we get this exception type in dio DioExceptionType.unknown

gh-ranjanKiran avatar Mar 20 '25 09:03 gh-ranjanKiran

Hey @gh-ranjanKiran Can you please share package versions and other information related to your setup, please?

michaelbarnes avatar Mar 21 '25 15:03 michaelbarnes

Hey @gh-ranjanKiran Can you please share package versions and other information related to your setup, please?

Hi @michaelbarnes , we are using these versions

sqlite_async is used for some local only tables. This is also cleared once user logs out

sqlite_async: ^0.11.0
powersync: ^1.11.0
dio: ^5.4.3+1

This is my output for flutter doctor

[√] Flutter (Channel stable, 3.22.2, on Microsoft Windows [Version 10.0.22621.3296], locale en-IN)
    • Flutter version 3.22.2 on channel stable at 
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 761747bfc5 (10 months ago), 2024-06-05 22:15:13 +0200
    • Engine revision edd8546116
    • Dart version 3.4.3
    • DevTools version 2.34.3

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at 
    • Platform android-35, build-tools 34.0.0
    • ANDROID_HOME 
    • Java binary at:
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-10027231)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.8.5)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.8.34511.84
    • Windows 10 SDK version 10.0.22621.0

[√] Android Studio (version 2022.3)
    • Android Studio at C:\Program Files\Android\Android Studio1
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-10027231)

[!] Android Studio (version 2023.1)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    X Unable to determine bundled Java version.
    • Try updating or re-installing Android Studio.

[√] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.22621.3296]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 134.0.6998.118
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 134.0.3124.72

[√] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.

Also while going through the dio package issues found this somewhat relevant comment https://github.com/cfug/dio/issues/2170#issuecomment-2033666007

gh-ranjanKiran avatar Mar 22 '25 03:03 gh-ranjanKiran