Skip to content

[flutter_tools] RPCError: resume: (-32000) Bad state: The client closed with pending request "resume". #139181

Description

@christopherfujino

Version: beta/3.17.0-0.0.pre
Command: flutter debug_adapter

RPCError: resume: (-32000) Bad state: The client closed with pending request "resume".
at new _OutstandingRequest(vm_service.dart:265)
at VmService._call.<anonymous closure>(vm_service.dart:1771)
at VmService._call(vm_service.dart:1783)
at VmService.resume(vm_service.dart:1484)
at IsolateManager._resume(isolate_manager.dart:347)
at IsolateManager.resumeThread(isolate_manager.dart:281)
at IsolateManager._handlePause(isolate_manager.dart:591)
at IsolateManager.handleEvent(isolate_manager.dart:203)
at <asynchronous gap>(async)
at DartDebugAdapter._configureExistingIsolates.<anonymous closure>(dart.dart:786)
at <asynchronous gap>(async)
at Future.wait.<anonymous closure>(future.dart:518)
at <asynchronous gap>(async)
at DartDebugAdapter._configureExistingIsolates(dart.dart:771)
at <asynchronous gap>(async)
at DartDebugAdapter._withErrorHandling(dart.dart:2631)
at <asynchronous gap>(async)
at DartDebugAdapter.connectDebugger(dart.dart:704)
at <asynchronous gap>(async)
at FlutterDebugAdapter._connectDebugger(flutter_adapter.dart:381)
at <asynchronous gap>(async)
at FlutterDebugAdapter._handleDebugPort(flutter_adapter.dart:462)
at <asynchronous gap>(async)

Activity

  1. matthewfx commented on Dec 8, 2023

    @matthewfx

    Recently, I've started to experience issues with hot reloading and restarting. It more often than not doesn't work. It freezes and I have to stop running my app in VS code and start running again. I'm getting the same error although my stack trace is different. It is super frustrating and slows my work down. I tried uninstalling Xcode and installing it again. I tried different Xcode versions but to no avail. I haven't tried uninstalling VS code or Flutter yet...

  2. christopherfujino commented on Dec 12, 2023

    @christopherfujino
    ContributorAuthor

    @DanTup WDYT about this one?

  3. added
    P2Important issues not at the top of the work list
    triaged-toolTriaged by Flutter Tool team
    on Dec 12, 2023
  4. DanTup commented on Dec 13, 2023

    @DanTup
    Contributor

    Hmm, this is odd... in the stack trace is _withErrorHandling and it seems like it intends to swallow exactly this kind of error:

    https://github.com/dart-lang/sdk/blob/321c113fa057e520c7a7ce56f0302166b04c5a89/pkg/dds/lib/src/dap/adapters/dart.dart#L2629-L2656

    It's not yet clear to me how we could throw this error that is an RPCError with the code -32000 🤔

  5. matthewfx commented on Dec 18, 2023

    @matthewfx

    It happens even more often when I have breakpoints set.

  6. DanTup commented on Dec 18, 2023

    @DanTup
    Contributor

    @matthewfx do you have any steps to repro? Can you provide a screenshot of where this error shows up?

  7. matthewfx commented on Dec 18, 2023

    @matthewfx

    @DanTup Unfortunately, there are no steps to reproduce the issue, as it occurs quite randomly. At times, I can perform hot reloads or restarts multiple times before the issue arises, while at other times it happens on the very first attempt after building a project. The problem seems to occur more frequently when I'm debugging and the app pauses at breakpoints. It also happens across different projects. However, I haven't yet had the time to reinstall Visual Studio Code. I'm hoping that might resolve the issue. Once I find the time to do so, I will inform you if this solution proves effective.

  8. christopherfujino commented on Jan 3, 2024

    @christopherfujino
    ContributorAuthor

    so our beta 3.18.0-0.2.pre has a crash rate almost 3x over our acceptable threshold, and most of the crashes are some form of this. For example:

    1

    RPCError: resume: (-32000) Bad state: The client closed with pending request "resume".
    at new _OutstandingRequest(vm_service.dart:265)
    at VmService._call.<anonymous closure>(vm_service.dart:1771)
    at VmService._call(vm_service.dart:1783)
    at VmService.resume(vm_service.dart:1484)
    at IsolateManager._resume(isolate_manager.dart:347)
    at IsolateManager.resumeThread(isolate_manager.dart:281)
    at IsolateManager._handlePause(isolate_manager.dart:581)
    at <asynchronous gap>(async)
    at IsolateManager.handleEvent(isolate_manager.dart:203)
    at <asynchronous gap>(async)
    at DartDebugAdapter.handleDebugEvent(dart.dart:2282)
    at <asynchronous gap>(async)
    at DartDebugAdapter._withErrorHandling(dart.dart:2631)
    at <asynchronous gap>(async)
    

    2

    RPCError: resume: (-32000) Bad state: The client closed with pending request "resume".
    at new _OutstandingRequest(vm_service.dart:265)
    at VmService._call.<anonymous closure>(vm_service.dart:1771)
    at VmService._call(vm_service.dart:1783)
    at VmService.resume(vm_service.dart:1484)
    at IsolateManager._resume(isolate_manager.dart:347)
    at IsolateManager.resumeThread(isolate_manager.dart:281)
    at DartDebugAdapter.continueRequest(dart.dart:809)
    at BaseDebugAdapter.handle(base_debug_adapter.dart:141)
    at BaseDebugAdapter.handleIncomingRequest(base_debug_adapter.dart:390)
    at BaseDebugAdapter._handleIncomingMessage(base_debug_adapter.dart:301)
    at ByteStreamServerChannel._readMessage(protocol_stream.dart:82)
    at ByteStreamServerChannel.listen.<anonymous closure>(protocol_stream.dart:53)
    at _rootRunUnary(zone.dart:1407)
    at _CustomZone.runUnary(zone.dart:1308)
    at _CustomZone.runUnaryGuarded(zone.dart:1217)
    at _BufferingStreamSubscription._sendData(stream_impl.dart:339)
    at _DelayedData.perform(stream_impl.dart:515)
    at _PendingEvents.handleNext(stream_impl.dart:620)
    at _PendingEvents.schedule.<anonymous closure>(stream_impl.dart:591)
    at _rootRun(zone.dart:1391)
    at _CustomZone.run(zone.dart:1301)
    at _CustomZone.runGuarded(zone.dart:1209)
    at _CustomZone.bindCallbackGuarded.<anonymous closure>(zone.dart:1249)
    at _rootRun(zone.dart:1399)
    at _CustomZone.run(zone.dart:1301)
    at _CustomZone.runGuarded(zone.dart:1209)
    at _CustomZone.bindCallbackGuarded.<anonymous closure>(zone.dart:1249)
    at _microtaskLoop(schedule_microtask.dart:40)
    at _startMicrotaskLoop(schedule_microtask.dart:49)
    at _runPendingImmediateCallback(isolate_patch.dart:118)
    at _RawReceivePort._handleMessage(isolate_patch.dart:185)
    

    3

    RPCError: resume: (-32000) Bad state: The client closed with pending request "resume".
    at new _OutstandingRequest(vm_service.dart:265)
    at VmService._call.<anonymous closure>(vm_service.dart:1771)
    at VmService._call(vm_service.dart:1783)
    at VmService.resume(vm_service.dart:1484)
    at IsolateManager._resume(isolate_manager.dart:347)
    at IsolateManager.resumeThread(isolate_manager.dart:281)
    at IsolateManager._handlePause(isolate_manager.dart:591)
    at IsolateManager.handleEvent(isolate_manager.dart:203)
    at <asynchronous gap>(async)
    at DartDebugAdapter._configureExistingIsolates.<anonymous closure>(dart.dart:786)
    at <asynchronous gap>(async)
    at Future.wait.<anonymous closure>(future.dart:518)
    at <asynchronous gap>(async)
    at DartDebugAdapter._configureExistingIsolates(dart.dart:771)
    at <asynchronous gap>(async)
    at DartDebugAdapter._withErrorHandling(dart.dart:2631)
    at <asynchronous gap>(async)
    at DartDebugAdapter.connectDebugger(dart.dart:704)
    at <asynchronous gap>(async)
    at FlutterDebugAdapter._connectDebugger(flutter_adapter.dart:381)
    at <asynchronous gap>(async)
    at FlutterDebugAdapter._handleDebugPort(flutter_adapter.dart:462)
    at <asynchronous gap>(async)
    
  9. christopherfujino commented on Jan 3, 2024

    @christopherfujino
    ContributorAuthor

    @DanTup could the bug be here, that we are not awaiting the future here (and in similar methods in this library), and thus the error is not being awaited in the try/catch of DartDebugAdapter._withErrorHandling?

  10. DanTup commented on Jan 3, 2024

    @DanTup
    Contributor

    @christopherfujino oof, good catch. Looks like this probably happened in dart-lang/sdk@35b560e. I'll get a fix open.

  11. christopherfujino commented on Jan 3, 2024

    @christopherfujino
    ContributorAuthor

    @christopherfujino oof, good catch. Looks like this probably happened in dart-lang/sdk@35b560e. I'll get a fix open.

    should we enable this in DDS? https://dart.dev/tools/linter-rules/unawaited_futures cc @bkonyi

  12. github-actions commented on Jan 18, 2024

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  13. locked as resolved and limited conversation to collaborators on Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listteam-toolOwned by Flutter Tool teamtriaged-toolTriaged by Flutter Tool team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions