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

VM, package:vm_service_client and/or package:coverage fail to find source line/column #34841

Closed
yjbanov opened this issue Oct 18, 2018 · 23 comments
Assignees
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. P2 A bug or feature request we're likely to work on
Milestone

Comments

@yjbanov
Copy link

yjbanov commented Oct 18, 2018

This is happening on Flutter commit flutter/flutter@3fbd140.

When we run tests with coverage, one of the tests fails with the following:

/b/build/slave/Linux/build/flutter/packages/flutter/test/widgets/binding_test.dart
Bad state: Couldn't find line and column for token 3230 in file:///b/build/slave/Linux/build/flutter/packages/flutter/lib/src/widgets/binding.dart.
#0      VMScript._lineAndColumn (package:vm_service_client/src/script.dart:243:5)
dart-lang/coverage#1      _ScriptLocation._ensureLineAndColumn (package:vm_service_client/src/script.dart:314:26)
dart-lang/coverage#2      _ScriptLocation.line (package:vm_service_client/src/script.dart:295:5)
dart-lang/coverage#3      _getCoverageJson (package:coverage/src/collect.dart:103:46)
<asynchronous suspension>
dart-lang/coverage#4      _getAllCoverage (package:coverage/src/collect.dart:51:26)
<asynchronous suspension>
dart-lang/coverage#5      collect (package:coverage/src/collect.dart:35:18)
<asynchronous suspension>
dart-lang/coverage#6      CoverageCollector.collectCoverage (package:flutter_tools/src/test/coverage_collector.dart:55:45)
<asynchronous suspension>
dart-lang/coverage#7      CoverageCollector.handleFinishedTest (package:flutter_tools/src/test/coverage_collector.dart:27:11)
<asynchronous suspension>
dart-lang/coverage#8      _FlutterPlatform._startTest (package:flutter_tools/src/test/flutter_platform.dart:649:30)
<asynchronous suspension>
dart-lang/coverage#9      _FlutterPlatform.loadChannel (package:flutter_tools/src/test/flutter_platform.dart:408:36)
dart-lang/coverage#10     PlatformPlugin.load (package:test/src/runner/plugin/platform.dart:65:19)
<asynchronous suspension>
dart-lang/coverage#11     Loader.loadFile.<anonymous closure> (package:test/src/runner/loader.dart:245:36)
<asynchronous suspension>
dart-lang/coverage#12     new LoadSuite.<anonymous closure>.<anonymous closure> (package:test/src/runner/load_suite.dart:92:31)
<asynchronous suspension>
dart-lang/coverage#13     invoke (package:test/src/utils.dart:241:5)
dart-lang/coverage#14     new LoadSuite.<anonymous closure> (package:test/src/runner/load_suite.dart:91:7)
dart-lang/coverage#15     Invoker._onRun.<anonymous closure>.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:test/src/backend/invoker.dart:403:25)
<asynchronous suspension>
dart-lang/coverage#16     new Future.<anonymous closure> (dart:async/future.dart:176:37)
dart-lang/coverage#17     StackZoneSpecification._run (package:stack_trace/src/stack_zone_specification.dart:209:15)
dart-lang/coverage#18     StackZoneSpecification._registerCallback.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:119:48)
dart-lang/coverage#19     _rootRun (dart:async/zone.dart:1120:38)
dart-lang/coverage#20     _CustomZone.run (dart:async/zone.dart:1021:19)
dart-lang/coverage#21     _CustomZone.runGuarded (dart:async/zone.dart:923:7)
dart-lang/coverage#22     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:963:23)
dart-lang/coverage#23     StackZoneSpecification._run (package:stack_trace/src/stack_zone_specification.dart:209:15)
dart-lang/coverage#24     StackZoneSpecification._registerCallback.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:119:48)
dart-lang/coverage#25     _rootRun (dart:async/zone.dart:1124:13)
dart-lang/coverage#26     _CustomZone.run (dart:async/zone.dart:1021:19)
dart-lang/coverage#27     _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:947:23)
dart-lang/coverage#28     Timer._createTimer.<anonymous closure> (dart:async/runtime/libtimer_patch.dart:21:15)
dart-lang/coverage#29     _Timer._runTimers (dart:isolate/runtime/libtimer_impl.dart:382:19)
dart-lang/coverage#30     _Timer._handleMessage (dart:isolate/runtime/libtimer_impl.dart:416:5)
dart-lang/coverage#31     _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)

Full log file.

/cc @JekCharlsonYu @a-siva @cbracken

@yjbanov yjbanov added the P1 A high priority bug; for example, a single project is unusable or has many test failures label Oct 18, 2018
@yjbanov yjbanov added this to the Dart2.1 milestone Oct 18, 2018
yjbanov added a commit to yjbanov/flutter that referenced this issue Oct 18, 2018
@cbracken
Copy link
Member

cbracken commented Oct 18, 2018

Potentially relevant issue from when something similar came up last time: dart-lang/tools#437

I'd banged up dart-archive/coverage#216 at the time, but I didn't land it; I suspect because perhaps it didn't solve the issue.

@yjbanov
Copy link
Author

yjbanov commented Oct 18, 2018

Some more info: the vm_service_client is looking for token 3230 but seems to be receiving the following tokenPosTable from the VM:

  245, 8164, 3, 8165, 4
  246, 8181, 8, 8194, 21
  247, 8209, 11
  248, 8230, 5
  249, 8252, 5, 8263, 16, 8282, 35
  250, 8312, 8, 8319, 15, 8337, 33
  251, 8365, 8, 8372, 15, 8405, 48
  252, 8460, 20, 8471, 31, 8492, 52
  253, 8541, 20, 8548, 27, 8566, 45
  254, 8591, 3
  261, 8870, 3, 8896, 29, 8905, 38, 8908, 41, 8917, 50
  262, 8943, 25
  264, 8957, 3, 8958, 4
  265, 8974, 8, 8995, 29
  266, 9010, 11
  268, 9051, 16, 9065, 30, 9072, 37
  269, 9112, 5, 9117, 10
  270, 9140, 7
  272, 9220, 19
  273, 9235, 11
  274, 9261, 11, 9268, 18
  275, 9293, 10
  278, 9311, 7
  280, 9397, 17, 9400, 20
  281, 9411, 9, 9441, 39, 9472, 70
  282, 9490, 17, 9496, 23
  283, 9515, 11, 9530, 26, 9561, 57, 9564, 60
  284, 9583, 13
  285, 9633, 22, 9666, 55
  286, 9683, 11, 9690, 18
  287, 9716, 10
  291, 9745, 12
  292, 9756, 7
  294, 9836, 17, 9839, 20, 9842, 23, 9872, 53, 9897, 78
  295, 9915, 17, 9921, 23
  296, 9940, 11, 9955, 26, 9980, 51, 9983, 54
  297, 10002, 13
  298, 10052, 22, 10079, 49
  299, 10096, 11, 10103, 18
  300, 10129, 10
  304, 10221, 7
  306, 10304, 17, 10316, 29, 10341, 54
  307, 10359, 17, 10365, 23, 10378, 36
  308, 10390, 11, 10394, 15, 10420, 41, 10423, 44
  309, 10442, 13, 10470, 41
  310, 10486, 10
  313, 10527, 30, 10536, 39, 10558, 61
  315, 10592, 7
  316, 10610, 6, 10612, 8
  317, 10617, 3
  319, 10622, 3, 10635, 16, 10648, 29
  320, 10657, 5, 10661, 9, 10679, 27
  321, 10696, 7, 10707, 18, 10718, 29
  322, 10744, 7, 10751, 14
  324, 10773, 5
  325, 10804, 3
  329, 10924, 3, 10939, 18, 10950, 29, 10953, 32, 10964, 43
  330, 10985, 20, 10999, 34
  338, 11250, 3, 11267, 20, 11280, 33, 11283, 36, 11295, 48, 11307, 60
  340, 11347, 38, 11384, 75
  359, 12291, 3, 12296, 8, 12307, 19, 12331, 43, 12344, 56, 12355, 67, 12359, 71, 12368, 80
  369, 12714, 3, 12719, 8, 12733, 22, 12757, 46, 12770, 59, 12781, 70, 12788, 77, 12797, 86
  371, 12802, 3, 12803, 4
  372, 12819, 8, 12839, 28
  373, 12854, 11
  374, 12882, 5, 12910, 33, 12922, 45
  375, 12940, 7, 12949, 16
  376, 12971, 3
  378, 12976, 3, 12977, 4
  379, 12993, 8, 13021, 36
  380, 13036, 11
  381, 13072, 5, 13100, 33, 13112, 45
  382, 13130, 7, 13139, 16
  383, 13169, 3
  385, 13174, 3, 13175, 4
  386, 13191, 8, 13225, 42
  387, 13240, 11
  388, 13282, 5, 13310, 33, 13322, 45
  389, 13340, 7, 13349, 16
  390, 13385, 3
  397, 13552, 3, 13553, 4
  398, 13566, 4
  399, 13587, 8, 13606, 27
  400, 13615, 5, 13640, 30, 13647, 37
  401, 13658, 3
  409, 13937, 3, 13938, 4
  410, 13951, 4
  411, 13972, 8, 13993, 29, 14001, 37
  412, 14015, 5, 14043, 33, 14055, 45
  413, 14073, 7, 14082, 16, 14098, 32
  414, 14109, 3
  422, 14466, 3, 14467, 4
  423, 14480, 4
  424, 14501, 8, 14537, 44
  425, 14546, 5, 14574, 33, 14586, 45
  426, 14604, 7, 14613, 16
  427, 14649, 3
  443, 15314, 3, 15315, 4
  444, 15340, 16, 15354, 30, 15363, 39
  445, 15369, 5, 15397, 33, 15406, 42, 15443, 79
  446, 15464, 7, 15468, 11, 15474, 17, 15483, 26
  447, 15506, 9
  449, 15540, 21
  450, 15549, 3
  462, 16024, 3, 16025, 4
  463, 16038, 4
  464, 16067, 16, 16082, 31, 16090, 39, 16103, 52
  465, 16109, 5, 16137, 33, 16146, 42, 16183, 79
  466, 16204, 7, 16208, 11, 16214, 17, 16223, 26, 16236, 39
  467, 16252, 9
  469, 16268, 3
  471, 16273, 3, 16289, 19, 16316, 46, 16328, 58
  472, 16346, 5, 16354, 13, 16365, 24
  473, 16386, 12
  474, 16406, 9, 16413, 16
  475, 16442, 12
  476, 16463, 9, 16470, 16, 16486, 32, 16497, 43
  478, 16519, 5
  479, 16553, 3
  481, 16558, 3, 16559, 4
  482, 16575, 8, 16605, 38, 16624, 57
  483, 16643, 11, 16674, 42
  484, 16686, 5, 16714, 33, 16726, 45
  485, 16744, 7, 16753, 16, 16780, 43
  486, 16790, 3
  496, 17098, 3, 17103, 8, 17123, 28
  497, 17132, 5, 17160, 33, 17172, 45
  498, 17190, 7, 17199, 16
  499, 17226, 3
  501, 17231, 3, 17244, 16, 17264, 36, 17272, 44, 17293, 65
  502, 17326, 32, 17334, 40, 17336, 42
  503, 17368, 18, 17373, 23, 17375, 25, 17382, 32
  504, 17396, 5, 17404, 13
  505, 17423, 12
  506, 17449, 9
  507, 17481, 9
  509, 17498, 5
  510, 17508, 3
  512, 17518, 8
  513, 17556, 7
  514, 17591, 3, 17600, 12, 17618, 30, 17621, 33, 17649, 61, 17653, 65
  523, 17958, 3, 17967, 12, 17995, 40, 17998, 43, 17999, 44, 18022, 67
  531, 18342, 3, 18347, 8, 18368, 29
  532, 18384, 12, 18412, 40, 18416, 44
  533, 18423, 5, 18451, 33
  534, 18459, 3
  545, 18865, 3, 18870, 8, 18891, 29
  546, 18907, 12, 18935, 40, 18939, 44
  547, 18946, 5, 18974, 33
  548, 18982, 3
  550, 18987, 3, 18992, 8, 19013, 29
  553, 19140, 12
  554, 19151, 7, 19155, 11
  555, 19193, 9, 19199, 15
  573, 20285, 7
  574, 20303, 6, 20305, 8
  575, 20312, 5
  576, 20336, 3
  584, 20576, 4
  585, 20593, 8
  651, 23826, 3, 23827, 4
  652, 23843, 8, 23852, 17
  653, 23868, 12, 23869, 13, 23895, 39
  654, 23909, 12
  655, 23920, 7
  656, 23961, 7
  657, 23979, 6, 23981, 8
  659, 24000, 7, 24004, 11, 24022, 29
  660, 24039, 9, 24050, 20, 24061, 31
  661, 24093, 13
  662, 24112, 7, 24123, 18
  664, 24168, 14
  665, 24181, 9
  666, 24225, 9
  667, 24245, 8, 24247, 10
  671, 24421, 5, 24425, 9, 24452, 36
  672, 24498, 26
  673, 24557, 7, 24616, 66
  674, 24627, 7
  676, 24668, 3
  682, 24885, 3, 24897, 15, 24915, 33, 24918, 36, 24936, 54
  683, 24948, 11
  691, 25208, 3, 25213, 8, 25229, 24, 25237, 32
  692, 25255, 5, 25276, 26
  693, 25333, 18
  695, 25397, 14
  696, 25414, 7, 25433, 26, 25445, 38
  697, 25467, 3
  699, 25472, 3, 25473, 4
  700, 25497, 16, 25514, 33
  701, 25523, 5
  702, 25552, 5, 25556, 9, 25574, 27
  703, 25589, 7, 25600, 18, 25611, 29
  704, 25635, 5, 25648, 18, 25668, 38, 25673, 43, 25679, 49
  705, 25694, 7
  706, 25724, 6
  707, 25729, 3

@yjbanov
Copy link
Author

yjbanov commented Oct 18, 2018

That table is for this file: https://github.com/flutter/flutter/blob/master/packages/flutter/lib/src/widgets/binding.dart

Notice that the first line coincides with a mixin declaration, so it might be mixin-related. @kmillikin

yjbanov added a commit to flutter/flutter that referenced this issue Oct 18, 2018
@mraleph
Copy link
Member

mraleph commented Oct 18, 2018

/cc @jensjoha

@a-siva
Copy link
Contributor

a-siva commented Oct 18, 2018

Similar errors were reported from the Flutter buildbot when an attempt was made to roll Dart version ac6d4f7e653deba11d4836768376537893a9e9d6 into Flutter (this roll was reverted because of this).

Please see link for details.

Here is an extract from that buildbot output file

2:28 +325 -2: /b/build/slave/Linux/build/flutter/packages/flutter/test/cupertino/nav_bar_transition_test.dart: Bottom large title moves to top back label                                             
02:31 +325 -2: /b/build/slave/Linux/build/flutter/packages/flutter/test/cupertino/nav_bar_transition_test.dart: Bottom large title moves to top back label                                             
02:33 +326 -2: /b/build/slave/Linux/build/flutter/packages/flutter/test/cupertino/nav_bar_transition_test.dart: Bottom large title moves to top back label                                             
unhandled error during test:
/b/build/slave/Linux/build/flutter/packages/flutter/test/cupertino/dialog_test.dart
Bad state: Couldn't find line and column for token 135177 in org-dartlang-sdk:///flutter/lib/ui/painting.dart.
#0      VMScript._lineAndColumn (package:vm_service_client/src/script.dart:243:5)
dart-lang/coverage#1      _ScriptLocation._ensureLineAndColumn (package:vm_service_client/src/script.dart:314:26)
dart-lang/coverage#2      _ScriptLocation.line (package:vm_service_client/src/script.dart:295:5)
dart-lang/coverage#3      _getCoverageJson (package:coverage/src/collect.dart:103:46)
<asynchronous suspension>
dart-lang/coverage#4      _getAllCoverage (package:coverage/src/collect.dart:51:26)
<asynchronous suspension>
dart-lang/coverage#5      collect (package:coverage/src/collect.dart:35:18)
<asynchronous suspension>
dart-lang/coverage#6      CoverageCollector.collectCoverage (package:flutter_tools/src/test/coverage_collector.dart:55:45)
<asynchronous suspension>
dart-lang/coverage#7      CoverageCollector.handleFinishedTest (package:flutter_tools/src/test/coverage_collector.dart:27:11)
<asynchronous suspension>
dart-lang/coverage#8      _FlutterPlatform._startTest (package:flutter_tools/src/test/flutter_platform.dart:649:30)
<asynchronous suspension>
dart-lang/coverage#9      _FlutterPlatform.loadChannel (package:flutter_tools/src/test/flutter_platform.dart:408:36)
dart-lang/coverage#10     PlatformPlugin.load (package:test/src/runner/plugin/platform.dart:65:19)
<asynchronous suspension>
dart-lang/coverage#11     Loader.loadFile.<anonymous closure> (package:test/src/runner/loader.dart:245:36)
<asynchronous suspension>
dart-lang/coverage#12     new LoadSuite.<anonymous closure>.<anonymous closure> (package:test/src/runner/load_suite.dart:92:31)
<asynchronous suspension>
dart-lang/coverage#13     invoke (package:test/src/utils.dart:241:5)
dart-lang/coverage#14     new LoadSuite.<anonymous closure> (package:test/src/runner/load_suite.dart:91:7)
dart-lang/coverage#15     Invoker._onRun.<anonymous closure>.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:test/src/backend/invoker.dart:403:25)
<asynchronous suspension>
dart-lang/coverage#16     new Future.<anonymous closure> (dart:async/future.dart:176:37)
dart-lang/coverage#17     StackZoneSpecification._run (package:stack_trace/src/stack_zone_specification.dart:209:15)
dart-lang/coverage#18     StackZoneSpecification._registerCallback.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:119:48)
dart-lang/coverage#19     _rootRun (dart:async/zone.dart:1120:38)
dart-lang/coverage#20     _CustomZone.run (dart:async/zone.dart:1021:19)
dart-lang/coverage#21     _CustomZone.runGuarded (dart:async/zone.dart:923:7)
dart-lang/coverage#22     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:963:23)
dart-lang/coverage#23     StackZoneSpecification._run (package:stack_trace/src/stack_zone_specification.dart:209:15)
dart-lang/coverage#24     StackZoneSpecification._registerCallback.<anonymous closure> (package:stack_trace/src/stack_zone_specification.dart:119:48)
dart-lang/coverage#25     _rootRun (dart:async/zone.dart:1124:13)
dart-lang/coverage#26     _CustomZone.run (dart:async/zone.dart:1021:19)
dart-lang/coverage#27     _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:947:23)
dart-lang/coverage#28     Timer._createTimer.<anonymous closure> (dart:async/runtime/libtimer_patch.dart:21:15)
dart-lang/coverage#29     _Timer._runTimers (dart:isolate/runtime/libtimer_impl.dart:382:19)
dart-lang/coverage#30     _Timer._handleMessage (dart:isolate/runtime/libtimer_impl.dart:416:5)

I am trying to reproduce this failure with a local engine build in order to bisect the Dart changes but unfortunately I can't get it to fail with a local engine build.

Please note this error was happening even before Yegor's change.

a-siva referenced this issue in flutter/flutter Oct 18, 2018
aed6b8c Roll Dart to ac6d4f7e653deba11d4836768376537893a9e9d6. (#6549)
3ba6270 Roll src/third_party/skia 921ec976556c..4b7b2ceb4ad9 (14 commits) (#6550)
@a-siva a-siva added the area-front-end Use area-front-end for front end / CFE / kernel format related issues. label Oct 18, 2018
@aartbik
Copy link
Contributor

aartbik commented Oct 18, 2018

@aartbik for dart roll

@a-siva
Copy link
Contributor

a-siva commented Oct 18, 2018

I dumped the tokenPosition array in vm_service_client and it shows -

_tokenPositions table for file:///usr/local/google/home/asiva/workspace/flutter-roll/flutter/packages/flutter/lib/src/widgets/binding.dart is of length = 197 and contents are 
 8164 => [ 245, 3 ] 
 8165 => [ 245, 4 ] 
 8181 => [ 246, 8 ] 
 8194 => [ 246, 21 ] 
 8209 => [ 247, 11 ] 
 8230 => [ 248, 5 ] 
 8252 => [ 249, 5 ] 
 8263 => [ 249, 16 ] 
 8282 => [ 249, 35 ] 
 8312 => [ 250, 8 ] 
 8319 => [ 250, 15 ] 
 8337 => [ 250, 33 ] 
 8365 => [ 251, 8 ] 
 8372 => [ 251, 15 ] 
 8405 => [ 251, 48 ] 
 8460 => [ 252, 20 ] 
 8471 => [ 252, 31 ] 
 8492 => [ 252, 52 ] 
 8541 => [ 253, 20 ] 
 8548 => [ 253, 27 ] 
 8566 => [ 253, 45 ] 
 8591 => [ 254, 3 ] 
 8870 => [ 261, 3 ] 
 8896 => [ 261, 29 ] 
 8905 => [ 261, 38 ] 
 8908 => [ 261, 41 ] 
 8917 => [ 261, 50 ] 
 8943 => [ 262, 25 ] 
 8957 => [ 264, 3 ] 
 8958 => [ 264, 4 ] 
 8974 => [ 265, 8 ] 
 8995 => [ 265, 29 ] 
 9010 => [ 266, 11 ] 
 9051 => [ 268, 16 ] 
 9065 => [ 268, 30 ] 
 9072 => [ 268, 37 ] 
 9112 => [ 269, 5 ] 
 9117 => [ 269, 10 ] 
 9140 => [ 270, 7 ] 
 9220 => [ 272, 19 ] 
 9235 => [ 273, 11 ] 
 9261 => [ 274, 11 ] 
 9268 => [ 274, 18 ] 
 9293 => [ 275, 10 ] 
 9311 => [ 278, 7 ] 
 9397 => [ 280, 17 ] 
 9400 => [ 280, 20 ] 
 9411 => [ 281, 9 ] 
 9441 => [ 281, 39 ] 
 9472 => [ 281, 70 ] 
 9490 => [ 282, 17 ] 
 9496 => [ 282, 23 ] 
 9515 => [ 283, 11 ] 
 9530 => [ 283, 26 ] 
 9561 => [ 283, 57 ] 
 9564 => [ 283, 60 ] 
 9583 => [ 284, 13 ] 
 9633 => [ 285, 22 ] 
 9666 => [ 285, 55 ] 
 9683 => [ 286, 11 ] 
 9690 => [ 286, 18 ] 
 9716 => [ 287, 10 ] 
 9745 => [ 291, 12 ] 
 9756 => [ 292, 7 ] 
 9836 => [ 294, 17 ] 
 9839 => [ 294, 20 ] 
 9842 => [ 294, 23 ] 
 9872 => [ 294, 53 ] 
 9897 => [ 294, 78 ] 
 9915 => [ 295, 17 ] 
 9921 => [ 295, 23 ] 
 9940 => [ 296, 11 ] 
 9955 => [ 296, 26 ] 
 9980 => [ 296, 51 ] 
 9983 => [ 296, 54 ] 
 10002 => [ 297, 13 ] 
 10052 => [ 298, 22 ] 
 10079 => [ 298, 49 ] 
 10096 => [ 299, 11 ] 
 10103 => [ 299, 18 ] 
 10129 => [ 300, 10 ] 
 10221 => [ 304, 7 ] 
 10304 => [ 306, 17 ] 
 10316 => [ 306, 29 ] 
 10341 => [ 306, 54 ] 
 10359 => [ 307, 17 ] 
 10365 => [ 307, 23 ] 
 10378 => [ 307, 36 ] 
 10390 => [ 308, 11 ] 
 10394 => [ 308, 15 ] 
 10420 => [ 308, 41 ] 
 10423 => [ 308, 44 ] 
 10442 => [ 309, 13 ] 
 10470 => [ 309, 41 ] 
 10486 => [ 310, 10 ] 
 10527 => [ 313, 30 ] 
 10536 => [ 313, 39 ] 
 10558 => [ 313, 61 ] 
 10592 => [ 315, 7 ] 
 10610 => [ 316, 6 ] 
 10612 => [ 316, 8 ] 
 10617 => [ 317, 3 ] 
 10622 => [ 319, 3 ] 
 10635 => [ 319, 16 ] 
 10648 => [ 319, 29 ] 
 10657 => [ 320, 5 ] 
 10661 => [ 320, 9 ] 
 10679 => [ 320, 27 ] 
 10696 => [ 321, 7 ] 
 10707 => [ 321, 18 ] 
 10718 => [ 321, 29 ] 
 10744 => [ 322, 7 ] 
 10751 => [ 322, 14 ] 
 10773 => [ 324, 5 ] 
 10804 => [ 325, 3 ] 
 10924 => [ 329, 3 ] 
 10939 => [ 329, 18 ] 
 10950 => [ 329, 29 ] 
 10953 => [ 329, 32 ] 
 10964 => [ 329, 43 ] 
 10985 => [ 330, 20 ] 
 10999 => [ 330, 34 ] 
 11250 => [ 338, 3 ] 
 11267 => [ 338, 20 ] 
 11280 => [ 338, 33 ] 
 11283 => [ 338, 36 ] 
 11295 => [ 338, 48 ] 
 11307 => [ 338, 60 ] 
 11347 => [ 340, 38 ] 
 11384 => [ 340, 75 ] 
 12291 => [ 359, 3 ] 
 12296 => [ 359, 8 ] 
 12307 => [ 359, 19 ] 
 12331 => [ 359, 43 ] 
 12344 => [ 359, 56 ] 
 12355 => [ 359, 67 ] 
 12359 => [ 359, 71 ] 
 12368 => [ 359, 80 ] 
 12714 => [ 369, 3 ] 
 12719 => [ 369, 8 ] 
 12733 => [ 369, 22 ] 
 12757 => [ 369, 46 ] 
 12770 => [ 369, 59 ] 
 12781 => [ 369, 70 ] 
 12788 => [ 369, 77 ] 
 12797 => [ 369, 86 ] 
 12802 => [ 371, 3 ] 
 12803 => [ 371, 4 ] 
 12819 => [ 372, 8 ] 
 12839 => [ 372, 28 ] 
 12854 => [ 373, 11 ] 
 12882 => [ 374, 5 ] 
 12910 => [ 374, 33 ] 
 12922 => [ 374, 45 ] 
 12940 => [ 375, 7 ] 
 12949 => [ 375, 16 ] 
 12971 => [ 376, 3 ] 
 12976 => [ 378, 3 ] 
 12977 => [ 378, 4 ] 
 12993 => [ 379, 8 ] 
 13021 => [ 379, 36 ] 
 13036 => [ 380, 11 ] 
 13072 => [ 381, 5 ] 
 13100 => [ 381, 33 ] 
 13112 => [ 381, 45 ] 
 13130 => [ 382, 7 ] 
 13139 => [ 382, 16 ] 
 13169 => [ 383, 3 ] 
 13174 => [ 385, 3 ] 
 13175 => [ 385, 4 ] 
 13191 => [ 386, 8 ] 
 13225 => [ 386, 42 ] 
 13240 => [ 387, 11 ] 
 13282 => [ 388, 5 ] 
 13310 => [ 388, 33 ] 
 13322 => [ 388, 45 ] 
 13340 => [ 389, 7 ] 
 13349 => [ 389, 16 ] 
 13385 => [ 390, 3 ] 
 13552 => [ 397, 3 ] 
 13553 => [ 397, 4 ] 
 13566 => [ 398, 4 ] 
 13587 => [ 399, 8 ] 
 13606 => [ 399, 27 ] 
 13615 => [ 400, 5 ] 
 13640 => [ 400, 30 ] 
 13647 => [ 400, 37 ] 
 13658 => [ 401, 3 ] 
 13937 => [ 409, 3 ] 
 13938 => [ 409, 4 ] 
 13951 => [ 410, 4 ] 
 13972 => [ 411, 8 ] 
 13993 => [ 411, 29 ] 
 14001 => [ 411, 37 ] 
 14015 => [ 412, 5 ] 
 14043 => [ 412, 33 ] 
 14055 => [ 412, 45 ] 
 14073 => [ 413, 7 ] 
 14082 => [ 413, 16 ] 
 14098 => [ 413, 32 ] 
 14109 => [ 414, 3 ] 
 14466 => [ 422, 3 ] 
 14467 => [ 422, 4 ] 
 14480 => [ 423, 4 ] 
 14501 => [ 424, 8 ] 
 14537 => [ 424, 44 ] 
 14546 => [ 425, 5 ] 
 14574 => [ 425, 33 ] 
 14586 => [ 425, 45 ] 
 14604 => [ 426, 7 ] 
 14613 => [ 426, 16 ] 
 14649 => [ 427, 3 ] 
 15314 => [ 443, 3 ] 
 15315 => [ 443, 4 ] 
 15340 => [ 444, 16 ] 
 15354 => [ 444, 30 ] 
 15363 => [ 444, 39 ] 
 15369 => [ 445, 5 ] 
 15397 => [ 445, 33 ] 
 15406 => [ 445, 42 ] 
 15443 => [ 445, 79 ] 
 15464 => [ 446, 7 ] 
 15468 => [ 446, 11 ] 
 15474 => [ 446, 17 ] 
 15483 => [ 446, 26 ] 
 15506 => [ 447, 9 ] 
 15540 => [ 449, 21 ] 
 15549 => [ 450, 3 ] 
 16024 => [ 462, 3 ] 
 16025 => [ 462, 4 ] 
 16038 => [ 463, 4 ] 
 16067 => [ 464, 16 ] 
 16082 => [ 464, 31 ] 
 16090 => [ 464, 39 ] 
 16103 => [ 464, 52 ] 
 16109 => [ 465, 5 ] 
 16137 => [ 465, 33 ] 
 16146 => [ 465, 42 ] 
 16183 => [ 465, 79 ] 
 16204 => [ 466, 7 ] 
 16208 => [ 466, 11 ] 
 16214 => [ 466, 17 ] 
 16223 => [ 466, 26 ] 
 16236 => [ 466, 39 ] 
 16252 => [ 467, 9 ] 
 16268 => [ 469, 3 ] 
 16273 => [ 471, 3 ] 
 16289 => [ 471, 19 ] 
 16316 => [ 471, 46 ] 
 16328 => [ 471, 58 ] 
 16346 => [ 472, 5 ] 
 16354 => [ 472, 13 ] 
 16365 => [ 472, 24 ] 
 16386 => [ 473, 12 ] 
 16406 => [ 474, 9 ] 
 16413 => [ 474, 16 ] 
 16442 => [ 475, 12 ] 
 16463 => [ 476, 9 ] 
 16470 => [ 476, 16 ] 
 16486 => [ 476, 32 ] 
 16497 => [ 476, 43 ] 
 16519 => [ 478, 5 ] 
 16553 => [ 479, 3 ] 
 16558 => [ 481, 3 ] 
 16559 => [ 481, 4 ] 
 16575 => [ 482, 8 ] 
 16605 => [ 482, 38 ] 
 16624 => [ 482, 57 ] 
 16643 => [ 483, 11 ] 
 16674 => [ 483, 42 ] 
 16686 => [ 484, 5 ] 
 16714 => [ 484, 33 ] 
 16726 => [ 484, 45 ] 
 16744 => [ 485, 7 ] 
 16753 => [ 485, 16 ] 
 16780 => [ 485, 43 ] 
 16790 => [ 486, 3 ] 
 17098 => [ 496, 3 ] 
 17103 => [ 496, 8 ] 
 17123 => [ 496, 28 ] 
 17132 => [ 497, 5 ] 
 17160 => [ 497, 33 ] 
 17172 => [ 497, 45 ] 
 17190 => [ 498, 7 ] 
 17199 => [ 498, 16 ] 
 17226 => [ 499, 3 ] 
 17231 => [ 501, 3 ] 
 17244 => [ 501, 16 ] 
 17264 => [ 501, 36 ] 
 17272 => [ 501, 44 ] 
 17293 => [ 501, 65 ] 
 17326 => [ 502, 32 ] 
 17334 => [ 502, 40 ] 
 17336 => [ 502, 42 ] 
 17368 => [ 503, 18 ] 
 17373 => [ 503, 23 ] 
 17375 => [ 503, 25 ] 
 17382 => [ 503, 32 ] 
 17396 => [ 504, 5 ] 
 17404 => [ 504, 13 ] 
 17423 => [ 505, 12 ] 
 17449 => [ 506, 9 ] 
 17481 => [ 507, 9 ] 
 17498 => [ 509, 5 ] 
 17508 => [ 510, 3 ] 
 17518 => [ 512, 8 ] 
 17556 => [ 513, 7 ] 
 17591 => [ 514, 3 ] 
 17600 => [ 514, 12 ] 
 17618 => [ 514, 30 ] 
 17621 => [ 514, 33 ] 
 17649 => [ 514, 61 ] 
 17653 => [ 514, 65 ] 
 17958 => [ 523, 3 ] 
 17967 => [ 523, 12 ] 
 17995 => [ 523, 40 ] 
 17998 => [ 523, 43 ] 
 17999 => [ 523, 44 ] 
 18022 => [ 523, 67 ] 
 18342 => [ 531, 3 ] 
 18347 => [ 531, 8 ] 
 18368 => [ 531, 29 ] 
 18384 => [ 532, 12 ] 
 18412 => [ 532, 40 ] 
 18416 => [ 532, 44 ] 
 18423 => [ 533, 5 ] 
 18451 => [ 533, 33 ] 
 18459 => [ 534, 3 ] 
 18865 => [ 545, 3 ] 
 18870 => [ 545, 8 ] 
 18891 => [ 545, 29 ] 
 18907 => [ 546, 12 ] 
 18935 => [ 546, 40 ] 
 18939 => [ 546, 44 ] 
 18946 => [ 547, 5 ] 
 18974 => [ 547, 33 ] 
 18982 => [ 548, 3 ] 
 18987 => [ 550, 3 ] 
 18992 => [ 550, 8 ] 
 19013 => [ 550, 29 ] 
 19140 => [ 553, 12 ] 
 19151 => [ 554, 7 ] 
 19155 => [ 554, 11 ] 
 19193 => [ 555, 9 ] 
 19199 => [ 555, 15 ] 
 20285 => [ 573, 7 ] 
 20303 => [ 574, 6 ] 
 20305 => [ 574, 8 ] 
 20312 => [ 575, 5 ] 
 20336 => [ 576, 3 ] 
 20576 => [ 584, 4 ] 
 20593 => [ 585, 8 ] 
 23826 => [ 651, 3 ] 
 23827 => [ 651, 4 ] 
 23843 => [ 652, 8 ] 
 23852 => [ 652, 17 ] 
 23868 => [ 653, 12 ] 
 23869 => [ 653, 13 ] 
 23895 => [ 653, 39 ] 
 23909 => [ 654, 12 ] 
 23920 => [ 655, 7 ] 
 23961 => [ 656, 7 ] 
 23979 => [ 657, 6 ] 
 23981 => [ 657, 8 ] 
 24000 => [ 659, 7 ] 
 24004 => [ 659, 11 ] 
 24022 => [ 659, 29 ] 
 24039 => [ 660, 9 ] 
 24050 => [ 660, 20 ] 
 24061 => [ 660, 31 ] 
 24093 => [ 661, 13 ] 
 24112 => [ 662, 7 ] 
 24123 => [ 662, 18 ] 
 24168 => [ 664, 14 ] 
 24181 => [ 665, 9 ] 
 24225 => [ 666, 9 ] 
 24245 => [ 667, 8 ] 
 24247 => [ 667, 10 ] 
 24421 => [ 671, 5 ] 
 24425 => [ 671, 9 ] 
 24452 => [ 671, 36 ] 
 24498 => [ 672, 26 ] 
 24557 => [ 673, 7 ] 
 24616 => [ 673, 66 ] 
 24627 => [ 674, 7 ] 
 24668 => [ 676, 3 ] 
 24885 => [ 682, 3 ] 
 24897 => [ 682, 15 ] 
 24915 => [ 682, 33 ] 
 24918 => [ 682, 36 ] 
 24936 => [ 682, 54 ] 
 24948 => [ 683, 11 ] 
 25208 => [ 691, 3 ] 
 25213 => [ 691, 8 ] 
 25229 => [ 691, 24 ] 
 25237 => [ 691, 32 ] 
 25255 => [ 692, 5 ] 
 25276 => [ 692, 26 ] 
 25333 => [ 693, 18 ] 
 25397 => [ 695, 14 ] 
 25414 => [ 696, 7 ] 
 25433 => [ 696, 26 ] 
 25445 => [ 696, 38 ] 
 25467 => [ 697, 3 ] 
 25472 => [ 699, 3 ] 
 25473 => [ 699, 4 ] 
 25497 => [ 700, 16 ] 
 25514 => [ 700, 33 ] 
 25523 => [ 701, 5 ] 
 25552 => [ 702, 5 ] 
 25556 => [ 702, 9 ] 
 25574 => [ 702, 27 ] 
 25589 => [ 703, 7 ] 
 25600 => [ 703, 18 ] 
 25611 => [ 703, 29 ] 
 25635 => [ 704, 5 ] 
 25648 => [ 704, 18 ] 
 25668 => [ 704, 38 ] 
 25673 => [ 704, 43 ] 
 25679 => [ 704, 49 ] 
 25694 => [ 705, 7 ] 
 25724 => [ 706, 6 ] 
 25729 => [ 707, 3 ] 

Clearly position 3230 is missing.

@yjbanov
Copy link
Author

yjbanov commented Oct 18, 2018

Should someone be assigned to work on this asap? This is a TODAY issue in Flutter flutter/flutter#23225.

@a-siva
Copy link
Contributor

a-siva commented Oct 19, 2018

Disabling this new option 'unsafePackageSerialization' fixes the problem. I am going to upload a CL that flips this to false.
This flag was added here flutter/flutter@4bd6ad7#diff-39538134dff328da5360691916bf0f06

@a-siva
Copy link
Contributor

a-siva commented Oct 19, 2018

flutter/pull/23280 has been created for this.

@jensjoha
Copy link
Contributor

Here's what's happening:

When unsafe package serialization is enabled, the VM is given a concatenated dill file.

In this case, 3 scripts are created in the VM for the same absolute file.
One for the actual library, and 2 - I guess - for two separate mixin uses.
The reason we get 3 different ones instead of just 1, is because each live in a separate component inside the concatenated dill file.

One of them gets the url set as the import-url, the two others are kept as is, so we now have:

  • package:flutter/src/widgets/binding.dart (this script is attached to the library where the entire thing is compiled)
  • file:///[...]/flutter/packages/flutter/lib/src/widgets/binding.dart (this script is attached to a class and/or number of methods because of a mixin usage) (mixin WidgetsBinding, lines 244-708))
  • file:///[...]/flutter/packages/flutter/lib/src/widgets/binding.dart (this script is attached to a class and/or number of methods because of a mixin usage) (abstract class WidgetsBindingObserver, lines 78-241)

When asking for the SourceReport, the VM assumes that if two scripts urls are the same, the scripts are the same too (in the above that is not the case --- this cannot be assumed when supporting concatenated dill files) and reuses an existing (wrong) one, i.e. giving responsibility for both scripts to one of the scripts.
When asking that script for which token positions it has, it reports the ones it is responsible for --- it doesn't know about the other script(s).

The data given from the VM is something like:

URI: package:flutter/src/widgets/binding.dart
ID: libraries/@616399801/scripts/package%3Aflutter%2Fsrc%2Fwidgets%2Fbinding.dart/1668b94849e
[78, 2484, 1]
[94, 3230, 3, 3243, 16, 3254, 27, 3257, 30, 3260, 33, 3285, 58]
[...]
[945, 34099, 3]

URI: file:///[...]/flutter/packages/flutter/lib/src/widgets/binding.dart
ID: objects/26
[245, 8164, 3, 8165, 4]
[246, 8181, 8, 8194, 21]
[...]
[707, 25729, 3]

Note how there are only two outputs.

Solution: Don't think Scripts are the same based on their url. Not in the VM, and not in any application of the service protocol.

With my CL (https://dart-review.googlesource.com/80821) applied the answer from the VM is now:

URI: package:flutter/src/widgets/binding.dart
ID: libraries/@616399801/scripts/package%3Aflutter%2Fsrc%2Fwidgets%2Fbinding.dart/1668befc930
[78, 2484, 1]
[94, 3230, 3, 3243, 16, 3254, 27, 3257, 30, 3260, 33, 3285, 58]
[...]
[945, 34099, 3]

URI: file:///[...]/flutter/packages/flutter/lib/src/widgets/binding.dart
ID: objects/56
[245, 8164, 3, 8165, 4]
[246, 8181, 8, 8194, 21]
[...]
[707, 25729, 3]

URI: file:///[...]/flutter/packages/flutter/lib/src/widgets/binding.dart
ID: objects/57
[94, 3230, 3, 3243, 16, 3254, 27, 3257, 30, 3260, 33, 3285, 58]
[...]
[240, 7948, 3, 7953, 8, 7983, 38, 7987, 42]

We now have 3 outputs.

Patching in dart-archive/coverage#216 (thanks @cbracken) in [...]/.pub-cache/hosted/pub.dartlang.org/coverage-0.12.2/lib/src/collect.dart and running flutter with my patched VM everything seems to work (19:44 +3172 ~23: All tests passed!).

So while disabling unsafe package serialization does work that's hardly a good solution, and it more masks the problem than fixes it.

@jensjoha
Copy link
Contributor

Oh, and also, probably one doesn't have to do a lot of hot-reloading before the assumption about one script per url goes out the window...

a-siva added a commit to flutter/flutter that referenced this issue Oct 19, 2018
… is turned on (#23280)

* Disable unsafePackageSerialization as it causes issues when coverage is
used (see dart-lang/sdk#34841)

* Restore Coverage.
@dgrove
Copy link
Contributor

dgrove commented Oct 19, 2018

Is this still targeted for 2.1?

@cbracken
Copy link
Member

cbracken commented Oct 19, 2018

I've now landed dart-archive/coverage#216 in the coverage package and released as v0.12.3, which was rolled into Flutter in flutter/flutter#23304. Once the VM rolls to the framework, I'll remove the unsafePackageSerialization workaround.

@a-siva a-siva modified the milestones: Dart2.1, Dart2.2 Oct 23, 2018
@a-siva a-siva added P2 A bug or feature request we're likely to work on and removed P1 A high priority bug; for example, a single project is unusable or has many test failures labels Oct 23, 2018
@a-siva
Copy link
Contributor

a-siva commented Oct 23, 2018

Flutter is unblocked with unsafePackageSerialization being turned off, moving milestore to 2.2 and dropping priority to P2

dart-bot pushed a commit that referenced this issue Oct 29, 2018
When using a concatenated dill file, several scripts with the same URL
can exist. They are not the same though, and should not be treated as
such.

Bug: #34841
Change-Id: Icd46357ffcf72ed35251b2a2793e1f83c02c4a8e
Reviewed-on: https://dart-review.googlesource.com/c/80821
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
dart-bot pushed a commit that referenced this issue Nov 2, 2018
When using a concatenated dill file, several scripts with the same URL
can exist. They are not the same though, and should not be treated as
such.

Bug: #34841
Change-Id: Icd46357ffcf72ed35251b2a2793e1f83c02c4a8e
Reviewed-on: https://dart-review.googlesource.com/c/80821
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
@zoechi
Copy link
Contributor

zoechi commented Jan 18, 2019

I'm still seeing this

[✓] Flutter (Channel dev, v1.1.9, on Mac OS X 10.14.1 18B75, locale en-AT)

like explained in flutter/flutter#20811

@mraleph
Copy link
Member

mraleph commented Jan 18, 2019

/cc @kmillikin fyi

@jensjoha
Copy link
Contributor

With the reproduction from the flutter issue link - further boiled down to this:
t1.dart:

// this is a somewhat long line that pushes offsets and bytes
// this is a somewhat long line that pushes offsets and bytes
// this is a somewhat long line that pushes offsets and bytes
// this is a somewhat long line that pushes offsets and bytes
// this is a somewhat long line that pushes offsets and bytes
// this is a somewhat long line that pushes offsets and bytes
// this is a somewhat long line that pushes offsets and bytes
// this is a somewhat long line that pushes offsets and bytes
// this is a somewhat long line that pushes offsets and bytes
// this is a somewhat long line that pushes offsets and bytes

import "t2.dart";

class Bar extends Object with Foo { }

main() {
  Bar bar = new Bar();
  print(bar.foo);
}

t2.dart:

class Foo {
  final String foo = () {
    return StackTrace.current.toString().split("\n")[0];
  }();
}

(which has the added benefit of showing something wrong when running)

this is what's happening:

  • The mixin causes fasta to create an artificial class, abstract class _Bar&Object&Foo extends core::Object implements t2::Foo
  • This class has the field (foo in this case, firstNameValidation in the example from the flutter link) copied in. This field comes from a different file and is correctly marked as such in the dill file (t2.dart in this example, whereas the artificial class is created in the library created by t1.dart).
  • The VM basically initializes fields by copying the initializer-code into the constructor and assigning the result of it to the field. The constructor is marked as coming from t1.dart in this example. From the VMs perspective, the fields initializer code (originally from t2.dart) now comes from t1.dart instead.
  • The output of the program is thus wrong because the VM translates the offsets relative to the wrong file (#0 new _Bar&Object&Foo.<anonymous closure> ([...]/t1.dart:1:61)).
  • When doing coverage on it we get the error (Bad state: Couldn't find line and column for token 33 in [...]/t1.dart.) (the error makes sense --- token 33 is somewhere in the comment on the first line in t1.dart --- had it looked for it in t2.dart instead (as the VM should have instructed it) it would have found something that made sense.

One solution is to mark the constructor as coming from t2.dart (in this example) - but I don't know if that's the way to go. Maybe @peter-ahe-google has an opinion about that?

@jensjoha
Copy link
Contributor

I'm landing a test that demonstrates the problem (https://dart-review.googlesource.com/c/sdk/+/91660), but the frontend team doesn't find that this is a frontend issue - it's a VM issue, and it should be fixed in the VM. Unassigning and changing area-label.

@jensjoha jensjoha removed their assignment Jan 31, 2019
@jensjoha jensjoha added area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. and removed area-front-end Use area-front-end for front end / CFE / kernel format related issues. labels Jan 31, 2019
@a-siva a-siva modified the milestones: Dart2.2, Dart2.3 Mar 11, 2019
@a-siva
Copy link
Contributor

a-siva commented Mar 21, 2019

Deleted incorrect comment.

@a-siva a-siva closed this as completed Mar 21, 2019
@zichangg
Copy link
Contributor

This issue still exists. The mixin class has not been fixed.

@zichangg zichangg reopened this Mar 21, 2019
@dgrove
Copy link
Contributor

dgrove commented Mar 21, 2019

I don't believe this is required for 2.3 . If not, can you please move from milestone?

@dgrove dgrove modified the milestones: Dart2.3, Dart 2.4 Mar 26, 2019
@dgrove
Copy link
Contributor

dgrove commented Mar 26, 2019

This is not blocking 2.3 - removing from milestone.

dart-bot pushed a commit that referenced this issue May 20, 2019
…wrong script

When a mixin class is created, there might be anonymous closures copied over to the other script.
Previously the script of closure function is the script of its parent function, which is not true in that case.
The solution is to create a patch class as the owner if parent function has a different script object. Return script of owner when query for script of closure function.

Bug: #34841
Change-Id: I53065cbf13f2d0dc8da320993fd3cd425e5c9714
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102226
Commit-Queue: Zichang Guo <zichangguo@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. P2 A bug or feature request we're likely to work on
Projects
None yet
Development

No branches or pull requests

9 participants