Repository navigation
[Linux Desktop]Unhandled Exception: 'package:flutter/src/rendering/mouse_tracker.dart': Failed assertion: line 317 pos 18: 'event is! PointerRemovedEvent': is not true. #100659
Copy link
Copy link
Closed
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: desktopRunning on desktopRunning on desktopa: error messageError messages from the Flutter frameworkError messages from the Flutter frameworka: mouseIssues related to using a mouse or mouse supportIssues related to using a mouse or mouse supportfound in release: 2.10Found to occur in 2.10Found to occur in 2.10found in release: 2.13Found to occur in 2.13Found to occur in 2.13has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onplatform-linuxBuilding on or for Linux specificallyBuilding on or for Linux specifically
Description
Expected results:
I wrote a simple desktop app to exhibit flutter assertion failures in mouse_tracker.dart. These failures occur at startup of the app - not always, but on a high percentage of runs.
Actual results:
Sometimes starts with assertion failures, sometimes not.
The example uses the Google window_size plugin to constrain the app window size, then runs a trivial app consisting of a Listener widget wrapping a Container. I suspect that the problem is with the window_size plugin, since I haven't seen the issue when I comment out the lines of code using it
code sample.
import 'dart:async';
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:window_size/window_size.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
if (Platform.isLinux) {
setWindowMaxSize(const Size(640, 480));
setWindowMinSize(const Size(640, 480));
}
runApp(Listener(onPointerDown: _pointerEventListener,
child: Container()));
}
void _pointerEventListener(PointerEvent event) {
print('Pointer down at: ${event.position}');
}Logs
Launching test/mouse_tracker_bug_test.dart on Linux in debug mode...
Building Linux application...
Debug service listening on ws://127.0.0.1:45687/jLrRROscyPg=/ws
Syncing files to device Linux...
[ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: 'package:flutter/src/rendering/mouse_tracker.dart': Failed assertion: line 317 pos 18: 'event is! PointerRemovedEvent': is not true.
#0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:51:61)
#1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:40:5)
#2 MouseTracker.updateWithEvent.<anonymous closure>.<anonymous closure> (package:flutter/src/rendering/mouse_tracker.dart:317:18)
#3 MouseTracker._deviceUpdatePhase (package:flutter/src/rendering/mouse_tracker.dart:206:9)
#4 MouseTracker.updateWithEvent.<anonymous closure> (package:flutter/src/rendering/mouse_tracker.dart:312:7)
#5 MouseTracker._monitorMouseConnection (package:flutter/src/rendering/mouse_tracker.dart:190:9)
#6 MouseTracker.updateWithEvent (package:flutter/src/rendering/mouse_tracker.dart:311:5)
#7 RendererBinding.dispatchEvent (package:flutter/src/rendering/binding.dart:314:20)
#8 GestureBinding._handlePointerEventImmediately (package:flutter/src/gestures/binding.dart:374:7)
#9 GestureBinding.handlePointerEvent (package:flutter/src/gestures/binding.dart:338:5)
#10 GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:296:7)
#11 GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:279:7)
#12 _rootRunUnary (dart:async/zone.dart:1442:13)
#13 _CustomZone.runUnary (dart:async/zone.dart:1335:19)
#14 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1244:7)
#15 _invoke1 (dart:ui/hooks.dart:170:10)
#16 PlatformDispatcher._dispatchPointerDataPacket (dart:ui/platform_dispatcher.dart:331:7)
#17 _dispatchPointerDataPacket (dart:ui/hooks.dart:94:31)
======== Exception caught by scheduler library =====================================================
The following assertion was thrown during a scheduler callback:
'package:flutter/src/rendering/mouse_tracker.dart': Failed assertion: line 201 pos 12: '!_debugDuringDeviceUpdate': is not true.
Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
https://github.com/flutter/flutter/issues/new?template=2_bug.md
When the exception was thrown, this was the stack:
#2 MouseTracker._deviceUpdatePhase (package:flutter/src/rendering/mouse_tracker.dart:201:12)
#3 MouseTracker.updateAllDevices (package:flutter/src/rendering/mouse_tracker.dart:353:5)
#4 RendererBinding._scheduleMouseTrackerUpdate.<anonymous closure> (package:flutter/src/rendering/binding.dart:380:22)
#5 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1144:15)
#6 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1089:9)
#7 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:995:5)
#11 _invoke (dart:ui/hooks.dart:151:10)
#12 PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:308:5)
#13 _drawFrame (dart:ui/hooks.dart:115:31)
(elided 5 frames from class _AssertionError and dart:async)
====================================================================================================
Lost connection to device.
[✓] Flutter (Channel stable, 2.10.3, on Ubuntu 20.04.4 LTS 5.4.0-104-generic, locale
en_US.UTF-8)
• Flutter version 2.10.3 at /home/rhr/Tools/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 7e9793dee1 (3 weeks ago), 2022-03-02 11:23:12 -0600
• Engine revision bd539267b4
• Dart version 2.16.1
• DevTools version 2.9.2
[✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
• Android SDK at /home/rhr/Android/Sdk
• Platform android-32, build-tools 32.0.0
• Java binary at: /usr/lib/jvm/java-11-openjdk-amd64/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.14+9-Ubuntu-0ubuntu2.20.04)
• All Android licenses accepted.
[✓] Chrome - develop for the web
• Chrome at google-chrome
[✓] Linux toolchain - develop for Linux desktop
• clang version 9.0.1-12
• cmake version 3.16.3
• ninja version 1.10.0
• pkg-config version 0.29.1
[!] Android Studio (not installed)
• Android Studio not found; download from https://developer.android.com/studio/index.html
(or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed
instructions).
[✓] IntelliJ IDEA Community Edition (version 2021.2)
• IntelliJ at /home/rhr/Tools/idea-IC-212.4416.7
• Flutter plugin version 63.3.3
• Dart plugin version 212.5632
[✓] Connected device (2 available)
• Linux (desktop) • linux • linux-x64 • Ubuntu 20.04.4 LTS 5.4.0-104-generic
• Chrome (web) • chrome • web-javascript • Google Chrome 99.0.4844.74
[✓] HTTP Host Availability
• All required HTTP hosts are available
! Doctor found issues in 1 category.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: desktopRunning on desktopRunning on desktopa: error messageError messages from the Flutter frameworkError messages from the Flutter frameworka: mouseIssues related to using a mouse or mouse supportIssues related to using a mouse or mouse supportfound in release: 2.10Found to occur in 2.10Found to occur in 2.10found in release: 2.13Found to occur in 2.13Found to occur in 2.13has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onplatform-linuxBuilding on or for Linux specificallyBuilding on or for Linux specifically
Activity
maheshj01 commentedon Mar 24, 2022
Hi @cedarbob, thanks for filing the issue I was able to reproduce the issue. on the latest stable and the master channel. It looks like this happens if the pointer loses the focus from the window immediately on launch
Reproducible steps
pubspec.yamlThis issue doesn't seem related to the
window_sizeplugin, To reproduce the issue the cursor must be positioned such that when the app loads the cursor focuses the window and when the window resizes as per the code sample the cursor should loose the focus.The below video shows the above mentioned reproducible steps
Screencast.from.24-03-22.05.19.39.PM.IST.mp4
The logs look similar to this issue for mac #80867
logs
flutter doctor -v (Linux)
[-]Multiple Assertion Faillures in mouse_tracker.dart[/-][+][Linux Desktop]Unhandled Exception: 'package:flutter/src/rendering/mouse_tracker.dart': Failed assertion: line 317 pos 18: 'event is! PointerRemovedEvent': is not true.[/+]ThraaxSession commentedon May 1, 2022
Is there something new about this issue? I bothers me too. :(
jason-simmons commentedon May 4, 2022
I was seeing the
event is! PointerRemovedEventassertion failure after launching Flutter apps on a Linux desktop.Traced through this and noticed a race between startup of the Linux embedder and the Flutter framework. When the
FlViewsends the first pointer add event to the engine, the framework binding may not yet have installed theonPointerDataPacketcallback.If the add event does not reach the framework, then the first event seen by the framework is the remove event, which triggers the assertion.
It may make sense for these events to be buffered until the framework provides its pointer data handlers (see https://github.com/flutter/engine/blob/main/lib/ui/channel_buffers.dart)
github-actions commentedon May 18, 2022
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 -vand a minimal reproduction of the issue.