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

Dart 1.17 segfaults with async/await #26668

Closed
dustinlessard-wf opened this issue Jun 9, 2016 · 11 comments
Closed

Dart 1.17 segfaults with async/await #26668

dustinlessard-wf opened this issue Jun 9, 2016 · 11 comments
Assignees
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) vm-regression

Comments

@dustinlessard-wf
Copy link

dustinlessard-wf commented Jun 9, 2016

When using Dart 1.17 with test: "^0.12.0", unit-tests that were otherwise passing on Dart 1.15 are now being skipped.

I apologize if this isn't an issue in Dart itself and would be more than happy to move this to the test repo if appropriate.

Here's some example code that produces the issue:

@TestOn('browser')
import 'dart:async';
import 'package:test/test.dart';

main() {
  group('Unit testing : Verify', () {
    test('if we can cause this to skip for no known reason', () async {
      CustomClass myClass = new CustomClass<int>();
      await myClass.processData(3);
      expect(2, 2);
    });
  });
}

class CustomClass<T> {
  Future<T> processData(T data) async {
    return data;
  }
}

We expect this test should pass, but it ends up being skipped. Commenting out this line await myClass.processData(3); results in the test passing.

Running this test in Dart 1.15 results in the test passing. It's possible that something changed in Dart 1.16, but that version wasn't tested.

@floitschG
Copy link
Contributor

/cc @nex3

@dustinlessard-wf dustinlessard-wf changed the title Tests are skipped when using 'async' on Dart 1.17 with test v0.12.13+5 Tests are skipped when using 'async/await' on Dart 1.17 with test v0.12.13+5 Jun 9, 2016
@nex3
Copy link
Member

nex3 commented Jun 9, 2016

I can reproduce this, but I'm pretty sure it's a VM issue. It looks like the VM crashes somewhere in the await statement. It seems to be very tightly coupled to the exact structure of the CustomClass.processData() method—even changing it from async { return data; } to => async data; causes the bug to disappear.

I'll see if I can find a test-free reproduction.

@nex3 nex3 added area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels Jun 9, 2016
@nex3
Copy link
Member

nex3 commented Jun 9, 2016

Update: it's definitely a VM issue. If I run this without pub run (e.g. dart bin/test.dart failure.dart from the test repo), the VM prints a segfault message. As such I'm marking this as high-severity.

@nex3 nex3 added the S1 high label Jun 9, 2016
@nex3
Copy link
Member

nex3 commented Jun 9, 2016

Okay, here's a test-free reproduction. Note that checked mode is required to reproduce this bug:

import 'dart:async';

main() async {
  var myClass = new CustomClass();
  await myClass.processData();
}

class CustomClass<T> {
  Future<T> processData() async {
    return null;
  }
}
$ dart --checked test.dart
Segmentation fault (core dumped)

It does not reproduce as of 1.16.0, so this is a new regression.

@nex3 nex3 changed the title Tests are skipped when using 'async/await' on Dart 1.17 with test v0.12.13+5 Dart 1.17 segfaults with async/await Jun 9, 2016
@kevmoo kevmoo added S0 critical and removed S1 high labels Jun 9, 2016
@kevmoo
Copy link
Member

kevmoo commented Jun 9, 2016

FYI @a-siva - this looks pretty gnarly

@fsc8000
Copy link
Contributor

fsc8000 commented Jun 9, 2016

The following assert is hit in debug mode. @crelier @mhausner

runtime/vm/flow_graph_builder.cc:2838: error: expected: instantiator != NULL
[New Thread 0x7ffff5077700 (LWP 37231)]
[New Thread 0x7ffff56b8700 (LWP 37227)]
[New Thread 0x7ffff597a700 (LWP 37226)]
[New Thread 0x7ffff7fcd700 (LWP 37225)]

Program received signal SIGABRT, Aborted.
[Switching to Thread 0x7ffff56b8700 (LWP 37227)]
0x00007ffff6c01c37 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
56  ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  0x00007ffff6c01c37 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1  0x00007ffff6c05028 in __GI_abort () at abort.c:89
#2  0x00000000008116d9 in dart::OS::Abort () at runtime/vm/os_linux.cc:424
#3  0x00000000005afe65 in dart::DynamicAssertionHelper::Fail (this=this@entry=0x7ffff56b4510, format=format@entry=0xb682a4 "expected: %s") at runtime/platform/assert.cc:42
#4  0x000000000066d2a3 in dart::EffectGraphVisitor::BuildInstantiator (this=this@entry=0x7ffff56b46d0, token_pos=..., token_pos@entry=...) at runtime/vm/flow_graph_builder.cc:2838
#5  0x000000000066d7e8 in dart::EffectGraphVisitor::BuildTypecheckArguments (this=this@entry=0x7ffff56b46d0, token_pos=token_pos@entry=..., instantiator_type_arguments_result=instantiator_type_arguments_result@entry=0x7ffff56b45c8) at runtime/vm/flow_graph_builder.cc:1492
#6  0x000000000066d8ae in dart::EffectGraphVisitor::BuildAssertAssignable (this=this@entry=0x7ffff56b46d0, token_pos=token_pos@entry=..., value=value@entry=0x7fffe807a608, dst_type=..., dst_name=...) at runtime/vm/flow_graph_builder.cc:1522
#7  0x000000000066dbe4 in dart::EffectGraphVisitor::BuildAssignableValue (this=this@entry=0x7ffff56b46d0, token_pos=..., value=0x7fffe807a608, dst_type=..., dst_name=...) at runtime/vm/flow_graph_builder.cc:1543
#8  0x000000000066dc80 in dart::ValueGraphVisitor::VisitAssignableNode (this=0x7ffff56b46d0, node=0x7fffe8078df8) at runtime/vm/flow_graph_builder.cc:1342
#9  0x000000000066a4de in dart::ValueGraphVisitor::VisitConditionalExprNode (this=0x7ffff56b47e0, node=0x7fffe8078e60) at runtime/vm/flow_graph_builder.cc:1848
#10 0x00000000006715be in dart::ValueGraphVisitor::VisitLetNode (this=0x7ffff56b48b0, node=0x7fffe8078c80) at runtime/vm/flow_graph_builder.cc:2306
#11 0x000000000067e076 in dart::EffectGraphVisitor::VisitReturnNode (this=0x7ffff56b4a60, node=0x7fffe8078e88) at runtime/vm/flow_graph_builder.cc:1125
#12 0x0000000000672813 in dart::EffectGraphVisitor::VisitSequenceNode (this=0x7ffff56b4b70, node=<optimized out>) at runtime/vm/flow_graph_builder.cc:4107
#13 0x000000000067481c in dart::EffectGraphVisitor::VisitTryCatchNode (this=0x7ffff56b4d10, node=0x7fffe8079408) at runtime/vm/flow_graph_builder.cc:4220
#14 0x0000000000672813 in dart::EffectGraphVisitor::VisitSequenceNode (this=0x7ffff56b4ec0, node=<optimized out>) at runtime/vm/flow_graph_builder.cc:4107
#15 0x0000000000672813 in dart::EffectGraphVisitor::VisitSequenceNode (this=0x7ffff56b4fb0, node=<optimized out>) at runtime/vm/flow_graph_builder.cc:4107
#16 0x000000000067ed29 in dart::FlowGraphBuilder::BuildGraph (this=this@entry=0x7ffff56b5000) at runtime/vm/flow_graph_builder.cc:4559
#17 0x00000000005fb4ab in dart::DartCompilationPipeline::BuildFlowGraph (this=<optimized out>, zone=<optimized out>, parsed_function=<optimized out>, ic_data_array=..., osr_id=<optimized out>) at runtime/vm/compiler.cc:104
#18 0x00000000005ff71d in dart::CompileParsedFunctionHelper::Compile (this=this@entry=0x7ffff56b5a10, pipeline=pipeline@entry=0x7ffff56b6528) at runtime/vm/compiler.cc:740
#19 0x00000000006025c6 in dart::CompileFunctionHelper (pipeline=0x7ffff56b6528, function=..., optimized=optimized@entry=false, osr_id=osr_id@entry=-1) at runtime/vm/compiler.cc:1266
#20 0x000000000060350b in dart::Compiler::CompileFunction (thread=thread@entry=0x12c7160, function=...) at runtime/vm/compiler.cc:1381
#21 0x0000000000603850 in DRT_HelperCompileFunction (isolate=<optimized out>, zone=<optimized out>, arguments=..., thread=0x12c7160) at runtime/vm/compiler.cc:166
#22 dart::DRT_CompileFunction (arguments=...) at runtime/vm/compiler.cc:162

@mhausner
Copy link
Contributor

mhausner commented Jun 9, 2016

I haven't verified yet but this could be a regression of this CL:

https://codereview.chromium.org/1847953002/

@crelier
Copy link
Contributor

crelier commented Jun 9, 2016

Matthias is probably right. I bet the instantiator needs to be captured when the class is generic. I'll look at it.

@crelier crelier self-assigned this Jun 9, 2016
@kevmoo
Copy link
Member

kevmoo commented Jun 10, 2016

@crelier Can we get a merge request in for 1.17?

CC @whesse

@crelier
Copy link
Contributor

crelier commented Jun 10, 2016

@kevmoo Sure, go ahead and also include this analyzer status file update:
e803457

@whesse
Copy link
Contributor

whesse commented Jun 10, 2016

Verified that this is fixed in 1.17.1.

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. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) vm-regression
Projects
None yet
Development

No branches or pull requests

8 participants