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

Segmentation fault if reloading a page with a lot of big css/js files repeatedly #21795

Closed
DartBot opened this issue Dec 5, 2014 · 8 comments
Assignees
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.

Comments

@DartBot
Copy link

DartBot commented Dec 5, 2014

This issue was originally filed by tomy...@potix.com


What steps will reproduce the problem?

  1. git clone https://github.com/tomyeh/segfault
  2. run: dart test/webapp/main.dart
  3. open Chrome to visit http://localhost:8080
  4. Press Ctrl+F5 repeatedly. It take a couple minutes to crash the Dart VM. Once crashed, it reported one of the following messages (but not both):

./vm/zone.h:233: error: Zone::Alloc: 'len' is too large: len=1073741824, element_size=4
Abort trap: 6

Segmentation fault: 11

The more large JS/CSS files in the page, the more likely to crash. The content doesn't matter. It seems related to aborted connections.

Dart version: Dart VM version: 1.8.0 (Thu Nov 27 00:59:46 2014) on "macos_ia32"

@anders-sandholm
Copy link
Contributor

tomyeh, thanks for reporting this.
For point 3., I assume you mean "open Dartium"?

Ivan, looks like a crash / high-prio issue but will leave that to your judgement.


Added Area-VM, Triaged labels.

@DartBot
Copy link
Author

DartBot commented Dec 5, 2014

This comment was originally written by tomy...@potix.com


No, I'm using Chrome since it is not about the client-side code.

@iposva-google
Copy link
Contributor

Set owner to @crelier.
Added Accepted label.

@crelier
Copy link
Contributor

crelier commented Jan 9, 2015

Quick update on the issue. Not fixed yet.

This is an issue with optimized compilation of try-catch statements, but not related to inlining. A debug build will crash with an assert when compiling function _close in stream/src/server_impl.dart:190:

  void _close(HttpConnect connect) {
    try {
      connect.response.close();
        //no need to catch since close() is asynchronous
    } finally {
      if (--_connectionCount == 0 && _onIdle != null) {
        try {
          _onIdle();
        } catch (err, st) {
          _shout(connect, _errorToString(err, st));
        }
      }
    }
  }

Here are more detailed steps to reproduce:

  1. git clone https://github.com/tomyeh/segfault
  2. cd segfault
  3. using a working dart install: ...dart/sdk/bin/pub install
  4. gdb --args ~/dart2/dart/out/DebugIA32/dart --optimization_filter=_close@230921706 --print_flow_graph_optimized --no_use_inlining --optimization_counter_threshold=5 --package-root=packages/ test/webapp/main.dart
  5. (gdb) handle SIGPIPE nostop noprint pass
  6. (gdb) run
  7. open Chrome to visit http://localhost:8080

No need to refresh (btw, CTRL+F5 does not work, SHIFT+F5 does).

regis@belenos:~/segfault$ gdb --args ~/dart2/dart/out/DebugIA32/dart --optimization_filter=_close@230921706 --print_flow_graph_optimized --no_use_inlining --optimization_counter_threshold=5 --package-root=packages/ test/webapp/main.dart
GNU gdb (GDB) 7.8-gg7
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-grtev4-linux-gnu".
Type "show configuration" for configuration details.

<http://go/gdb-home FAQ: http://go/gdb-faq Email: gdb-team IRC: gdb>
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
set history expansion
set history filename ~/.gdb_history
set history save
Reading symbols from /usr/local/google/home/regis/dart2/dart/out/DebugIA32/dart...done.
Loading v16/v17 libstdc++ pretty-printers ...
(gdb) handle SIGPIPE nostop noprint pass
Signal Stop Print Pass to program Description
SIGPIPE No No Yes Broken pipe
(gdb) run
Starting program: /usr/local/google/home/regis/dart2/dart/out/DebugIA32/dart --optimization_filter=_close@230921706 --print_flow_graph_optimized --no_use_inlining --optimization_counter_threshold=5 --package-root=packages/ test/webapp/main.dart
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/grte/v4/lib64/libthread_db.so.1".
[New Thread 0xf744eb40 (LWP 18889)]
[New Thread 0xf734db40 (LWP 18890)]
[New Thread 0xf70ccb40 (LWP 18891)]
[New Thread 0xf700bb40 (LWP 18892)]
2015-01-09 13:18:54.378:stream:0
INFO: Rikulo Stream Server 1.3.1 starting on 0.0.0.0:8080
Home: /usr/local/google/home/regis/segfault/test
[Thread 0xf700bb40 (LWP 18892) exited]
[Thread 0xf70ccb40 (LWP 18891) exited]
[New Thread 0xf70ccb40 (LWP 18895)]
[New Thread 0xf700bb40 (LWP 18896)]
*** BEGIN CFG
Before Optimizations
==== package:stream/stream.dart__StreamServer@230921706__close@230921706
B0[graph]:2
B1[target]:0
    CheckStackOverflow:4()
    t0 <- LoadLocal(:current_context_var)
    StoreLocal(:saved_try_context_var, t0)
    goto:16 3
B3[join try_idx 0]:14 pred(B1)
    t0 <- LoadLocal(connect)
    PushArgument(t0)
    t0 <- InstanceCall:6( get:response, t0 IC[1: _HttpConnect@230921706 cnt:1 trgt:'_AbstractConnect@230921706.get_response'])
    PushArgument(t0)
    InstanceCall:8( close, t0 IC[1: _HttpResponse@497094340 cnt:1 trgt:'_StreamSinkImpl@497094340.close'])
    goto:12 2
B2[join]:10 pred(B3)
    t0 <- LoadLocal(this)
    PushArgument(t0)
    t0 <- LoadLocal(this)
    PushArgument(t0)
    t0 <- InstanceCall:90( get:_connectionCount@230921706, t0 IC[1: _StreamServer@230921706 cnt:1 trgt:'_StreamServer@230921706.get__connectionCount@230921706'])
    PushArgument(t0)
    t0 <- Constant(#­1)
    PushArgument(t0)
    t0 <- InstanceCall:92( -, t0, t0 IC[{smi x smi->smi} 1: _Smi@915557746, _Smi@915557746 cnt:1 trgt:'_IntegerImplementation@915557746.-'])
    t0 <- StoreLocal(:expr_temp, t0)
    PushArgument(t0)
    InstanceCall:94( set:_connectionCount@230921706, t0, t0 IC[1: _StreamServer@230921706, _Smi@915557746 cnt:1 trgt:'_StreamServer@230921706.set__connectionCount@230921706'])
    t0 <- LoadLocal(:expr_temp)
    PushArgument(t0)
    t0 <- Constant(#­0)
    PushArgument(t0)
    t0 <- InstanceCall:96( ==, t0, t0 IC[1: _Smi@915557746, _Smi@915557746 cnt:1 trgt:'_IntegerImplementation@915557746.=='])
    t1 <- Constant(#true)
    Branch if StrictCompare:98(===, t0, t1) goto (16, 23)
B16[target]:108
    t0 <- LoadLocal(this)
    PushArgument(t0)
    t0 <- InstanceCall:102( get:_onIdle@230921706, t0 IC[1: _StreamServer@230921706 cnt:1 trgt:'_StreamServer@230921706.get__onIdle@230921706'])
    t1 <- Constant(#null)
    Branch if StrictCompare:104(!==, t0, t1, with number check) goto (21, 24)
B21[target]:136
    t0 <- LoadLocal(:current_context_var)
    StoreLocal(:saved_try_context_var, t0)
    goto:120 18
B18[join try_idx 1]:118 pred(B21)
    t0 <- LoadLocal(this)
    PushArgument(t0)
    t0 <- InstanceCall:110( get:_onIdle@230921706, t0 IC[0: ])
    PushArgument(t0)
    InstanceCall:112( call, t0 IC[0: ])
    goto:116 17
B17[join]:114 pred(B18)
    goto:134 20
B24[target]:144
    goto:146 22
B23[target]:140
    goto:142 22
B22[join]:138 pred(B23, B24)
    goto:152 25
B4[target catch try_idx 2 catch_try_idx 0]
    t0 <- LoadLocal(:saved_try_context_var)
    StoreLocal(:current_context_var, t0)
    DebugStepCheck()
    t0 <- LoadLocal(:exception_var)
    PushArgument(t0)
    t0 <- LoadLocal(:stack_trace_var)
    PushArgument(t0)
    ReThrow:18()
B8[target catch try_idx -1 catch_try_idx 1]
    t0 <- LoadLocal(:saved_try_context_var)
    StoreLocal(:current_context_var, t0)
    DebugStepCheck()
    t0 <- LoadLocal(:exception_var)
    StoreLocal(err, t0)
    DebugStepCheck()
    t0 <- LoadLocal(:stack_trace_var)
    StoreLocal(st, t0)
    t0 <- LoadLocal(st)
    PushArgument(t0)
    InstanceCall:54( _setupFullStackTrace@915557746, t0 IC[0: ])
    t0 <- LoadLocal(this)
    PushArgument(t0)
    t0 <- LoadLocal(connect)
    PushArgument(t0)
    t0 <- LoadLocal(err)
    PushArgument(t0)
    t0 <- LoadLocal(st)
    PushArgument(t0)
    t0 <- StaticCall:56( _errorToString@230921706 t0, t0)
    PushArgument(t0)
    InstanceCall:58( _shout@230921706, t0, t0, t0 IC[0: ])
    goto:64 9
B15[target catch try_idx -1 catch_try_idx 2]
    t0 <- LoadLocal(:saved_try_context_var)
    StoreLocal(:current_context_var, t0)
    t0 <- LoadLocal(this)
    PushArgument(t0)
    t0 <- LoadLocal(this)
    PushArgument(t0)
    t0 <- InstanceCall:22( get:_connectionCount@230921706, t0 IC[0: ])
    PushArgument(t0)
    t0 <- Constant(#­1)
    PushArgument(t0)
    t0 <- InstanceCall:24( -, t0, t0 IC[1: _Smi@915557746, _Smi@915557746 cnt:0 trgt:'_IntegerImplementation@915557746.-'])
    t0 <- StoreLocal(:expr_temp, t0)
    PushArgument(t0)
    InstanceCall:26( set:_connectionCount@230921706, t0, t0 IC[0: ])
    t0 <- LoadLocal(:expr_temp)
    PushArgument(t0)
    t0 <- Constant(#­0)
    PushArgument(t0)
    t0 <- InstanceCall:28( ==, t0, t0 IC[1: _Smi@915557746, _Smi@915557746 cnt:0 trgt:'_IntegerImplementation@915557746.=='])
    t1 <- Constant(#true)
    Branch if StrictCompare:30(===, t0, t1) goto (5, 12)
B5[target]:40
    t0 <- LoadLocal(this)
    PushArgument(t0)
    t0 <- InstanceCall:34( get:_onIdle@230921706, t0 IC[0: ])
    t1 <- Constant(#null)
    Branch if StrictCompare:36(!==, t0, t1, with number check) goto (10, 13)
B10[target]:68
    t0 <- LoadLocal(:current_context_var)
    StoreLocal(:saved_try_context_var, t0)
    goto:52 7
B7[join try_idx 1]:50 pred(B10)
    t0 <- LoadLocal(this)
    PushArgument(t0)
    t0 <- InstanceCall:42( get:_onIdle@230921706, t0 IC[0: ])
    PushArgument(t0)
    InstanceCall:44( call, t0 IC[0: ])
    goto:48 6
B6[join]:46 pred(B7)
    goto:66 9
B9[join]:62 pred(B6, B8)
    goto:82 14
B13[target]:76
    goto:78 11
B12[target]:72
    goto:74 11
B11[join]:70 pred(B12, B13)
    goto:84 14
B14[join]:80 pred(B9, B11)
    t0 <- LoadLocal(:exception_var)
    PushArgument(t0)
    t0 <- LoadLocal(:stack_trace_var)
    PushArgument(t0)
    ReThrow:86()
B19[target catch try_idx -1 catch_try_idx 1]
    t0 <- LoadLocal(:saved_try_context_var)
    StoreLocal(:current_context_var, t0)
    DebugStepCheck()
    t0 <- LoadLocal(:exception_var)
    StoreLocal(err, t0)
    DebugStepCheck()
    t0 <- LoadLocal(:stack_trace_var)
    StoreLocal(st, t0)
    t0 <- LoadLocal(st)
    PushArgument(t0)
    InstanceCall:122( _setupFullStackTrace@915557746, t0 IC[0: ])
    t0 <- LoadLocal(this)
    PushArgument(t0)
    t0 <- LoadLocal(connect)
    PushArgument(t0)
    t0 <- LoadLocal(err)
    PushArgument(t0)
    t0 <- LoadLocal(st)
    PushArgument(t0)
    t0 <- StaticCall:124( _errorToString@230921706 t0, t0)
    PushArgument(t0)
    InstanceCall:126( _shout@230921706, t0, t0, t0 IC[0: ])
    goto:132 20
B20[join]:130 pred(B17, B19)
    goto:150 25
B25[join]:148 pred(B20, B22)
    t0 <- Constant(#null)
    DebugStepCheck()
    Return:154(t0)
*** END CFG
*** BEGIN CFG
After SSA
==== package:stream/stream.dart__StreamServer@230921706__close@230921706
B0[graph]:2 {
      v0 <- Constant(#null)
      v1 <- Constant(#<optimized out>)
      v2 <- Constant(#Context@0xf6e6ec59 num_variables: 0)
      v3 <- Parameter(0)
      v4 <- Parameter(1)
      v57 <- Constant(#­1)
      v60 <- Constant(#­0)
      v63 <- Constant(#true)
}
B1[target]:0
    CheckStackOverflow:4()
    goto:16 3
B3[join try_idx 0]:14 pred(B1)
    PushArgument(v4)
    v118 <- InstanceCall:6( get:response, v4 IC[1: _HttpConnect@230921706 cnt:1 trgt:'_AbstractConnect@230921706.get_response'])
    PushArgument(v118)
    InstanceCall:8( close, v118 IC[1: _HttpResponse@497094340 cnt:1 trgt:'_StreamSinkImpl@497094340.close'])
    goto:12 2
B2[join]:10 pred(B3)
    PushArgument(v3)
    PushArgument(v3)
    v120 <- InstanceCall:90( get:_connectionCount@230921706, v3 IC[1: _StreamServer@230921706 cnt:1 trgt:'_StreamServer@230921706.get__connectionCount@230921706'])
    PushArgument(v120)
    PushArgument(v57)
    v122 <- InstanceCall:92( -, v120, v57 IC[{smi x smi->smi} 1: _Smi@915557746, _Smi@915557746 cnt:1 trgt:'_IntegerImplementation@915557746.-'])
    PushArgument(v122)
    InstanceCall:94( set:_connectionCount@230921706, v3, v122 IC[1: _StreamServer@230921706, _Smi@915557746 cnt:1 trgt:'_StreamServer@230921706.set__connectionCount@230921706'])
    PushArgument(v122)
    PushArgument(v60)
    v124 <- InstanceCall:96( ==, v122, v60 IC[1: _Smi@915557746, _Smi@915557746 cnt:1 trgt:'_IntegerImplementation@915557746.=='])
    Branch if StrictCompare:98(===, v124, v63) goto (16, 23)
B16[target]:108
    PushArgument(v3)
    v126 <- InstanceCall:102( get:_onIdle@230921706, v3 IC[1: _StreamServer@230921706 cnt:1 trgt:'_StreamServer@230921706.get__onIdle@230921706'])
    Branch if StrictCompare:104(!==, v126, v0, with number check) goto (21, 24)
B21[target]:136
    goto:120 18
B18[join try_idx 1]:118 pred(B21)
    PushArgument(v3)
    v128 <- InstanceCall:110( get:_onIdle@230921706, v3 IC[0: ])
    PushArgument(v128)
    InstanceCall:112( call, v128 IC[0: ])
    goto:116 17
B17[join]:114 pred(B18)
    goto:134 20
B24[target]:144
    goto:146 22
B23[target]:140
    goto:142 22
B22[join]:138 pred(B23, B24)
    goto:152 25
B4[target catch try_idx 2 catch_try_idx 0] {
      v106 <- Parameter(0)
      v107 <- Parameter(1)
      v108 <- Parameter(2)
      v109 <- Parameter(3)
      v110 <- Parameter(4)
      v111 <- Parameter(5)
      v112 <- Parameter(6)
      v113 <- Parameter(7)
      v114 <- Parameter(8)
      v115 <- Parameter(9)
      v116 <- Parameter(10)
      v117 <- Parameter(11)
}
    DebugStepCheck()
    PushArgument(v111)
    PushArgument(v112)
    ReThrow:18()
B8[target catch try_idx -1 catch_try_idx 1] {
      v92 <- Parameter(0)
      v93 <- Parameter(1)
      v94 <- Parameter(2)
      v95 <- Parameter(3)
      v96 <- Parameter(4)
      v97 <- Parameter(5)
      v98 <- Parameter(6)
      v99 <- Parameter(7)
      v100 <- Parameter(8)
      v101 <- Parameter(9)
      v102 <- Parameter(10)
      v103 <- Parameter(11)
}
    DebugStepCheck()
    DebugStepCheck()
    PushArgument(v101)
    InstanceCall:54( _setupFullStackTrace@915557746, v101 IC[0: ])
    PushArgument(v92)
    PushArgument(v93)
    PushArgument(v100)
    PushArgument(v101)
    v104 <- StaticCall:56( _errorToString@230921706 v100, v101)
    PushArgument(v104)
    InstanceCall:58( _shout@230921706, v92, v93, v104 IC[0: ])
    goto:64 9
B15[target catch try_idx -1 catch_try_idx 2] {
      v43 <- Parameter(0)
      v44 <- Parameter(1)
      v45 <- Parameter(2)
      v46 <- Parameter(3)
      v47 <- Parameter(4)
      v48 <- Parameter(5)
      v49 <- Parameter(6)
      v50 <- Parameter(7)
      v51 <- Parameter(8)
      v52 <- Parameter(9)
      v53 <- Parameter(10)
      v54 <- Parameter(11)
}
    PushArgument(v43)
    PushArgument(v43)
    v55 <- InstanceCall:22( get:_connectionCount@230921706, v43 IC[0: ])
    PushArgument(v55)
    PushArgument(v57)
    v58 <- InstanceCall:24( -, v55, v57 IC[1: _Smi@915557746, _Smi@915557746 cnt:0 trgt:'_IntegerImplementation@915557746.-'])
    PushArgument(v58)
    InstanceCall:26( set:_connectionCount@230921706, v43, v58 IC[0: ])
    PushArgument(v58)
    PushArgument(v60)
    v61 <- InstanceCall:28( ==, v58, v60 IC[1: _Smi@915557746, _Smi@915557746 cnt:0 trgt:'_IntegerImplementation@915557746.=='])
    Branch if StrictCompare:30(===, v61, v63) goto (5, 12)
B5[target]:40
    PushArgument(v43)
    v64 <- InstanceCall:34( get:_onIdle@230921706, v43 IC[0: ])
    Branch if StrictCompare:36(!==, v64, v0, with number check) goto (10, 13)
B10[target]:68
    goto:52 7
B7[join try_idx 1]:50 pred(B10)
    PushArgument(v43)
    v66 <- InstanceCall:42( get:_onIdle@230921706, v43 IC[0: ])
    PushArgument(v66)
    InstanceCall:44( call, v66 IC[0: ])
    goto:48 6
B6[join]:46 pred(B7)
    goto:66 9
B9[join]:62 pred(B6, B8) {
      v83 <- phi(v47, v99) alive
      v85 <- phi(v48, v97) alive
      v86 <- phi(v49, v98) alive
}
    goto:82 14
B13[target]:76
    goto:78 11
B12[target]:72
    goto:74 11
B11[join]:70 pred(B12, B13)
    goto:84 14
B14[join]:80 pred(B9, B11) {
      v71 <- phi(v83, v47) alive
      v73 <- phi(v85, v48) alive
      v74 <- phi(v86, v49) alive
}
    PushArgument(v73)
    PushArgument(v74)
    ReThrow:86()
B19[target catch try_idx -1 catch_try_idx 1] {
      v5 <- Parameter(0)
      v6 <- Parameter(1)
      v7 <- Parameter(2)
      v8 <- Parameter(3)
      v9 <- Parameter(4)
      v10 <- Parameter(5)
      v11 <- Parameter(6)
      v12 <- Parameter(7)
      v13 <- Parameter(8)
      v14 <- Parameter(9)
      v15 <- Parameter(10)
      v16 <- Parameter(11)
}
    DebugStepCheck()
    DebugStepCheck()
    PushArgument(v14)
    InstanceCall:122( _setupFullStackTrace@915557746, v14 IC[0: ])
    PushArgument(v5)
    PushArgument(v6)
    PushArgument(v13)
    PushArgument(v14)
    v17 <- StaticCall:124( _errorToString@230921706 v13, v14)
    PushArgument(v17)
    InstanceCall:126( _shout@230921706, v5, v6, v17 IC[0: ])
    goto:132 20
B20[join]:130 pred(B17, B19) {
      v22 <- phi(v2, v12) alive
}
    goto:150 25
B25[join]:148 pred(B20, B22) {
      v34 <- phi(v22, v2) alive
}
    DebugStepCheck()
    Return:154(v0)
*** END CFG
*** BEGIN CFG
After Optimizations
==== package:stream/stream.dart__StreamServer@230921706__close@230921706
  0: B0[graph]:2 {
      v0 <- Constant(#null) T{Null?}
      v1 <- Constant(#<optimized out>) T{_OneByteString}
      v2 <- Constant(#Context@0xf6e6ec59 num_variables: 0) T{Context}
      v3 <- Parameter(0) T{_StreamServer}
      v4 <- Parameter(1)
      v57 <- Constant(#­1) [1, 1] T{_Smi}
      v60 <- Constant(#­0) [0, 0] T{_Smi}
      v63 <- Constant(#true) T{bool}
}
  2: B1[target]:0
  4: CheckStackOverflow:4()
  6: ParallelMove eax <- S-1 goto:16 3
  8: B3[join try_idx 0]:14 pred(B1)
 10: CheckClass:6(v4 IC[1: _HttpConnect@230921706 cnt:1 trgt:'_AbstractConnect@230921706.get_response'])
 12: v118 <- LoadField(v4 T{_HttpConnect}, 12 {response} [non-nullable _HttpResponse@497094340], immutable=1) T{_HttpResponse}
 14: PushArgument(v118)
 16: PolymorphicInstanceCall:8( close, v118 IC[1: _HttpResponse@497094340 cnt:1 trgt:'_StreamSinkImpl@497094340.close'])
 18: ParallelMove eax <- S-2 goto:12 2
 20: B2[join]:10 pred(B3)
 22: v120 <- LoadField(v3, 40 {_connectionCount@230921706} [non-nullable _Smi@915557746], immutable=0) [-1073741824, 1073741823] T{_Smi}
 24: ParallelMove edx <- ecx
 24: v122 <- BinarySmiOp:92(-, v120, v57) [-1073741824, 1073741822] T{_Smi}
 26: StoreInstanceField(_connectionCount@230921706 {40}, v3, v122)
 28: goto:96 22
 30: B22[join]:138 pred(B2)
 32: goto:152 25
 34: B4[target catch try_idx 2 catch_try_idx 0] {
      v106 <- Parameter(0)
      v107 <- Parameter(1)
      v130 <- Constant(#null)
      v131 <- Constant(#Context@0xf6e6ec59 num_variables: 0)
      v132 <- Constant(#Context@0xf6e6ec59 num_variables: 0)
      v111 <- Parameter(5)
      v112 <- Parameter(6)
      v133 <- Constant(#null)
      v134 <- Constant(#null)
      v135 <- Constant(#null)
      v136 <- Constant(#null)
      v137 <- Constant(#null)
}
 36: PushArgument(v111)
 38: PushArgument(v112)
 40: ReThrow:18()
 42: B8[target catch try_idx -1 catch_try_idx 1] {
      v92 <- Parameter(0)
      v93 <- Parameter(1)
      v94 <- Parameter(2)
      v95 <- Parameter(3)
      v96 <- Parameter(4)
      v97 <- Parameter(5)
      v98 <- Parameter(6)
      v99 <- Parameter(7)
      v100 <- Parameter(8)
      v101 <- Parameter(9)
      v102 <- Parameter(10)
      v103 <- Parameter(11)
}
 44: PushArgument(v101)
 46: InstanceCall:54( _setupFullStackTrace@915557746, v101 IC[0: ])
 48: PushArgument(v92)
 50: PushArgument(v93)
 52: PushArgument(v100)
 54: PushArgument(v101)
 56: v104 <- StaticCall:56( _errorToString@230921706 v100, v101)
 57: ParallelMove eax <- eax
 58: PushArgument(v104)
 60: InstanceCall:58( _shout@230921706, v92, v93, v104 IC[0: ])
 61: ParallelMove edx <- S+3, ecx <- S+4, eax <- S+5
 62: ParallelMove edx <- eax, ecx <- edx, eax <- ecx goto:64 9
 64: B15[target catch try_idx -1 catch_try_idx 2] {
      v43 <- Parameter(0)
      v44 <- Parameter(1)
      v138 <- Constant(#null)
      v139 <- Constant(#Context@0xf6e6ec59 num_variables: 0)
      v140 <- Constant(#Context@0xf6e6ec59 num_variables: 0)
      v48 <- Parameter(5)
      v49 <- Parameter(6)
      v141 <- Constant(#null)
      v142 <- Constant(#null)
      v143 <- Constant(#null)
      v144 <- Constant(#null)
      v145 <- Constant(#null)
}
 66: PushArgument(v43)
 68: PushArgument(v43)
 70: v55 <- InstanceCall:22( get:_connectionCount@230921706, v43 IC[0: ])
 71: ParallelMove eax <- eax
 72: CheckSmi:24(v55)
 74: ParallelMove ecx <- eax
 74: v58 <- BinarySmiOp:24(-, v55 T{_Smi}, v57) [-1073741824, 1073741822] T{_Smi}
 75: ParallelMove S+10 <- ecx
 76: PushArgument(v58)
 78: InstanceCall:26( set:_connectionCount@230921706, v43, v58 IC[0: ])
 79: ParallelMove eax <- S+10
 80: Branch if EqualityCompare:28(v58 == v60) T{bool} goto (5, 12)
 82: B5[target]:40
 84: PushArgument(v43)
 86: v64 <- InstanceCall:34( get:_onIdle@230921706, v43 IC[0: ])
 87: ParallelMove eax <- eax
 88: Branch if StrictCompare:36(!==, v64, v0) goto (10, 13)
 90: B10[target]:68
 92: goto:52 7
 94: B7[join try_idx 1]:50 pred(B10)
 96: PushArgument(v43)
 98: v66 <- InstanceCall:42( get:_onIdle@230921706, v43 IC[0: ])
 99: ParallelMove eax <- eax
100: PushArgument(v66)
102: InstanceCall:44( call, v66 IC[0: ])
104: ParallelMove ecx <- S+3, eax <- S+4 goto:48 6
106: B6[join]:46 pred(B7)
108: ParallelMove edx <- C, ecx <- ecx, eax <- eax goto:66 9
110: B9[join]:62 pred(B6, B8) {
      v83 <- phi(v140 T{??}, v99) alive T{??}
      v85 <- phi(v48, v97) alive T{??}
      v86 <- phi(v49, v98) alive T{??}
}
112: ParallelMove edx <- edx, ecx <- ecx, eax <- eax goto:82 14
114: B13[target]:76 ParallelMove ecx <- S+3, eax <- S+4
116: goto:78 11
118: B12[target]:72 ParallelMove ecx <- S+3, eax <- S+4
120: goto:74 11
122: B11[join]:70 pred(B12, B13)
124: ParallelMove edx <- C, ecx <- ecx, eax <- eax goto:84 14
126: B14[join]:80 pred(B9, B11) {
      v71 <- phi(v83, v140 T{??}) alive T{??}
      v73 <- phi(v85, v48) alive T{??}
      v74 <- phi(v86, v49) alive T{??}
}
127: ParallelMove S+10 <- edx
128: PushArgument(v73)
130: PushArgument(v74)
132: ReThrow:86()
134: B20[target catch try_idx -1 catch_try_idx 1] {
      v5 <- Parameter(0)
      v6 <- Parameter(1)
      v7 <- Parameter(2)
      v146 <- Constant(#Context@0xf6e6ec59 num_variables: 0)
      v147 <- Constant(#Context@0xf6e6ec59 num_variables: 0)
      v10 <- Parameter(5)
      v11 <- Parameter(6)
      v148 <- Constant(#Context@0xf6e6ec59 num_variables: 0)
      v13 <- Parameter(8)
      v14 <- Parameter(9)
      v149 <- Constant(#null)
      v150 <- Constant(#null)
}
136: PushArgument(v14)
138: InstanceCall:122( _setupFullStackTrace@915557746, v14 IC[0: ])
140: PushArgument(v5)
142: PushArgument(v6)
144: PushArgument(v13)
146: PushArgument(v14)
148: v17 <- StaticCall:124( _errorToString@230921706 v13, v14)
149: ParallelMove eax <- eax
150: PushArgument(v17)
152: InstanceCall:126( _shout@230921706, v5, v6, v17 IC[0: ])
154: goto:150 25
156: B25[join]:148 pred(B20, B22)
157: ParallelMove eax <- C
158: Return:154(v0)
*** END CFG
runtime/vm/code_descriptors.h:148: error: expected: (0 <= try_index) && (try_index < Length())

Program received signal SIGABRT, Aborted.
[Switching to Thread 0xf70ccb40 (LWP 18895)]
0xf7fdb430 in __kernel_vsyscall ()
(gdb) bt
#­0 0xf7fdb430 in __kernel_vsyscall ()
#­1 0xf7cbe577 in raise () from /lib/i386-linux-gnu/libc.so.6
#­2 0xf7cc19a3 in abort () from /lib/i386-linux-gnu/libc.so.6
#­3 0x082732fd in dart::DynamicAssertionHelper::Fail (this=0xf70ca254,
    format=0x8aaacfe "expected: %s") at runtime/platform/assert.cc:41
#­4 0x082fc36a in dart::ExceptionHandlerList::SetNeedsStacktrace (this=0xf692b6dc, try_index=2)
    at runtime/vm/code_descriptors.h:148
#­5 0x082f838b in dart::FlowGraphCompiler::SetNeedsStacktrace (this=0xf70ca648, try_index=2)
    at runtime/vm/flow_graph_compiler.cc:605
#­6 0x08391f1a in dart::ReThrowInstr::EmitNativeCode (this=0xf6c4d820, compiler=0xf70ca648)
    at runtime/vm/intermediate_language_ia32.cc:6488
#­7 0x082f7737 in dart::FlowGraphCompiler::VisitBlocks (this=0xf70ca648)
    at runtime/vm/flow_graph_compiler.cc:414
#­8 0x08304658 in dart::FlowGraphCompiler::CompileGraph (this=0xf70ca648)
    at runtime/vm/flow_graph_compiler_ia32.cc:1130
#­9 0x0829a0d9 in dart::CompileParsedFunctionHelper (pipeline=0xf70cb10c,
    parsed_function=0xf70ca960, optimized=true, osr_id=-1) at runtime/vm/compiler.cc:695
#­10 0x0829b27c in dart::CompileFunctionHelper (pipeline=0xf70cb10c, function=..., optimized=true,
    osr_id=-1) at runtime/vm/compiler.cc:959
#­11 0x0829b5fb in dart::Compiler::CompileOptimizedFunction (isolate=0x8d2a888, function=...,
    osr_id=-1) at runtime/vm/compiler.cc:1023
#­12 0x0852f5cc in dart::DRT_HelperOptimizeInvokedFunction (isolate=0x8d2a888, arguments=...)
    at runtime/vm/code_generator.cc:1310
#­13 0x0852f46a in dart::DRT_OptimizeInvokedFunction (arguments=...)
    at runtime/vm/code_generator.cc:1299
#­14 0xf714d07f in ?? ()
#­15 0xf714efbe in ?? ()
#­16 0xf6be9dc6 in ?? ()
#­17 0xf6be9cde in ?? ()
#­18 0xf72b6022 in ?? ()
#­19 0xf72b5eca in ?? ()
#­20 0xf72b5d03 in ?? ()
#­21 0xf7187bf6 in ?? ()
#­22 0xf718799b in ?? ()
#­23 0xf7186b97 in ?? ()
#­24 0xf7185874 in ?? ()
#­25 0xf7185741 in ?? ()
#­26 0xf718565b in ?? ()
#­27 0xf7295a50 in ?? ()
#­28 0xf7295887 in ?? ()
#­29 0xf72952e0 in ?? ()
#­30 0xf72950f1 in ?? ()
#­31 0xf72a7741 in ?? ()
#­32 0xf72a765b in ?? ()

---Type <return> to continue, or q <return> to quit---q
Quit
(gdb) up 4
#­4 0x082fc36a in dart::ExceptionHandlerList::SetNeedsStacktrace (this=0xf692b6dc, try_index=2)
    at runtime/vm/code_descriptors.h:148
148 ASSERT((0 <= try_index) && (try_index < Length()));
(gdb) p try_index
$1 = 2
(gdb) p Length()
$2 = 2
(gdb)


Added Started label.

@crelier
Copy link
Contributor

crelier commented Jan 10, 2015

It looks like the order in which code for catch blocks and rethrows is generated is different in unoptimized code and optimized code.

Exception handlers are inserted in a list while compiling code for a catch, and compiling a rethrow expects the handler to be present in the list.

If I print when a handler is added and expected, I get this (unoptimized followed by optimized):
AddExceptionHandler try_index=0
SetNeedsStacktrace try_index=0
AddExceptionHandler try_index=1
AddExceptionHandler try_index=2
SetNeedsStacktrace try_index=2
AddExceptionHandler try_index=1
AddExceptionHandler try_index=0
SetNeedsStacktrace try_index=0
AddExceptionHandler try_index=1
SetNeedsStacktrace try_index=2
runtime/vm/code_descriptors.h:148: error: expected: (0 <= try_index) && (try_index < Length())

If I replace the failing assert by a call to AddPlaceHolder(), everything seems to work:

AddExceptionHandler try_index=0
SetNeedsStacktrace try_index=0
AddExceptionHandler try_index=1
AddExceptionHandler try_index=2
SetNeedsStacktrace try_index=2
AddExceptionHandler try_index=1
AddExceptionHandler try_index=0
SetNeedsStacktrace try_index=0
AddExceptionHandler try_index=1
SetNeedsStacktrace try_index=2
AddExceptionHandler try_index=2 // this comes after its use above
AddExceptionHandler try_index=1

cl on its way shortly: https://codereview.chromium.org/847613002

@fsc8000
Copy link
Contributor

fsc8000 commented Jan 12, 2015

Here is a short standalone regression test.


Attachment:
tryfail.dart (500 Bytes)

@crelier
Copy link
Contributor

crelier commented Jan 13, 2015

Fixed in r42824.


Added Fixed label.

@iposva-google
Copy link
Contributor

Merge of this fix to trunk has been requested with issue #22056 and should be available in any stable release after 1.8.5.

@DartBot DartBot added Type-Defect area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. labels Jan 13, 2015
This issue was closed.
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.
Projects
None yet
Development

No branches or pull requests

6 participants