Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DAP throws error when debugging with neovim in Flutter 3.16.0 because threadIds are too large #54087

Closed
sidlatau opened this issue Nov 18, 2023 · 7 comments
Labels
area-pkg Used for miscellaneous pkg/ packages not associated with specific area- teams. pkg-dds For issues related to the Dart Development Service

Comments

@sidlatau
Copy link

sidlatau commented Nov 18, 2023

Debugging stopped working after upgrading to Flutter 3.16.0
I am using neovim and https://github.com/mfussenegger/nvim-dap/ DAP adapter.

After some investigation I found that the issue is with thread ids - they are very big numbers, that does not fit to int.

Looks like this is known issue: #53086, there is a revert commit that fixes it: eda6963

Would it be possible to include this fix to the next Flutter hotfix release?

More details:

There is an issue for this in nvim-flutter/flutter-tools.nvim#309

Request:

{
 reason = "breakpoint",
 threadId = 4.9230778108782e+15
}
{
   body = {
     error = {
       format = "{message}\n{stack}",
       id = 1,
       variables = {
         message = "type 'double' is not a subtype of type 'int' in type cast",
         stack = "#0      new StackTraceArguments.fromMap (package:dap/src/protocol_generated.dart:5650:36)\n#1      StackTraceArguments.fromJson (package:dap/src/protocol_generated.dart:5635:27)\n#2      BaseDebugAdapter.handle (package:dds/src/dap/base_debug_adapter.dart:118:21)\n#3      BaseDebugAdapter.handleIncomingRequest (package:dds/src/dap/base_debug_adapter.dart:419:7)\n#4      BaseDebugAdapter._handleIncomingMessage (package:dds/src/dap/base_debug_adapter.dart:295:7)\n#5      ByteStreamServerChannel._readMessage (package:dds/src/dap/protocol_stream.dart:82:18)\n#6      ByteStreamServerChannel.listen.<anonymous closure> (package:dds/src/dap/protocol_stream.dart:53:24)\n#7      _rootRunUnary (dart:async/zone.dart:1407:47)\n#8      _CustomZone.runUnary (dart:async/zone.dart:1308:19)\n#9      _CustomZone.runUnaryGuarded (dart:async/zone.dart:1217:7)\n#10     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339:11)\n#11     _DelayedData.perform (dart:async/stream_impl.dart:515:14)\n#12     _PendingEvents.handleNext (dart:async/stream_impl.dart:620:11)\n#13     _PendingEvents.schedule.<anonymous closure> (dart:async/stream_impl.dart:591:7)\n#14     _rootRun (dart:async/zone.dart:1391:47)\n#15     _CustomZone.run (dart:async/zone.dart:1301:19)\n#16     _CustomZone.runGuarded (dart:async/zone.dart:1209:7)\n#17     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1249:23)\n#18     _rootRun (dart:async/zone.dart:1399:13)\n#19     _CustomZone.run (dart:async/zone.dart:1301:19)\n#20     _CustomZone.runGuarded (dart:async/zone.dart:1209:7)\n#21     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1249:23)\n#22     _microtaskLoop (dart:async/schedule_microtask.dart:40:21)\n#23     _startMicrotaskLoop (dart:async/schedule_microtask.dart:49:5)\n#24     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13)\n#25     _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:185:5)\n"
       }
     }
   },
   message = "type 'double' is not a subtype of type 'int' in type cast"
 }
 flutter doctor -v
[✓] Flutter (Channel stable, 3.16.0, on macOS 14.0 23A344 darwin-arm64, locale en-LT)
    • Flutter version 3.16.0 on channel stable at /Users/ts/fvm/versions/3.16.0
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision db7ef5bf9f (2 days ago), 2023-11-15 11:25:44 -0800
    • Engine revision 74d16627b9
    • Dart version 3.2.0
    • DevTools version 2.28.2
@DanTup
Copy link
Collaborator

DanTup commented Nov 19, 2023

@christopherfujino @bkonyi looks like we unfortunately ended up with the Flutter stable getting a DDS release between the break and revert for this (looks like DDS 2.9.5 was never released, so Flutter was still on 2.9.4 until a later DDS release).

Hotfixing this would require a DDS 2.9.4 hotfix with the revert, then a Flutter hotfix to include that. I don't know how complicated that is or whether this will meet the bar. I think the issue only affects neovim users, but I don't know how many there are (@christopherfujino do you have any stats on flutter debug_adapter invocations that are neovim and/or not VS Code?).

@mraleph mraleph added area-pkg Used for miscellaneous pkg/ packages not associated with specific area- teams. pkg-dds For issues related to the Dart Development Service labels Nov 20, 2023
@bkonyi
Copy link
Contributor

bkonyi commented Nov 20, 2023

Ah shoot, I didn't realize 2.9.5 hadn't been published. I checked out eda6963 and retrospectively published 2.9.5, so it should be a safe cherrypick into Flutter 3.16 if we decide to go for it.

@DanTup DanTup changed the title DAP throws error when debugging in Flutter 3.16.0 DAP throws error when debugging with neovim in Flutter 3.16.0 because threadIds are too large Nov 20, 2023
@DanTup
Copy link
Collaborator

DanTup commented Nov 20, 2023

@bkonyi yeah, I forgot to ping for it too. I think I had assumed there would be other fixes and a release and lost track.

I discussed with Jacob and he thinks this is worth cherry-picking. @christopherfujino this doesn't need a Dart SDK release, just updating the package from Pub. I recall the process for that was not so trivial - is it documented somewhere?

(btw I've opened flutter/flutter#138736 to see if we can come up with a way to keep these things better in-sync around the time of releases)

@christopherfujino
Copy link
Member

CP request here

@DanTup
Copy link
Collaborator

DanTup commented Dec 6, 2023

The fix shipped in Flutter 3.16.3 (see flutter/flutter#139177 (comment)). @sidlatau please let me know if you're still seeing issues after upgrading.

@DanTup DanTup closed this as completed Dec 6, 2023
@sidlatau
Copy link
Author

sidlatau commented Dec 6, 2023

The fix shipped in Flutter 3.16.3 (see flutter/flutter#139177 (comment)). @sidlatau please let me know if you're still seeing issues after upgrading.

Debugging works now, thanks for the fix!

@DanTup
Copy link
Collaborator

DanTup commented Dec 6, 2023

Excellent, thanks for confirming :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-pkg Used for miscellaneous pkg/ packages not associated with specific area- teams. pkg-dds For issues related to the Dart Development Service
Projects
None yet
Development

No branches or pull requests

5 participants