@@ -1092,6 +1092,14 @@ ngx_[% subsys %]_lua_run_thread(lua_State *L, [% req_type %] *r,
1092
1092
1093
1093
NGX_LUA_EXCEPTION_TRY {
1094
1094
1095
+ /*
1096
+ * silence a -Werror=clobbered warning with gcc 5.4
1097
+ * due to above setjmp
1098
+ */
1099
+ err = NULL ;
1100
+ msg = NULL ;
1101
+ trace = NULL ;
1102
+
1095
1103
if (ctx -> cur_co_ctx -> thread_spawn_yielded ) {
1096
1104
ngx_ [% subsys %]_lua_probe_info ("thread spawn yielded" );
1097
1105
@@ -1464,30 +1472,34 @@ user_co_done:
1464
1472
ctx -> cur_co_ctx = orig_coctx ;
1465
1473
}
1466
1474
1467
- if (lua_isstring (ctx -> cur_co_ctx -> co , -1 )) {
1468
- dd ("user custom error msg" );
1469
- msg = lua_tostring (ctx -> cur_co_ctx -> co , -1 );
1470
-
1471
- } else {
1472
- msg = "unknown reason" ;
1473
- }
1474
-
1475
1475
ngx_ [% subsys %]_lua_cleanup_pending_operation (ctx -> cur_co_ctx );
1476
1476
1477
1477
ngx_ [% subsys %]_lua_probe_coroutine_done (r , ctx -> cur_co_ctx -> co , 0 );
1478
1478
1479
1479
ctx -> cur_co_ctx -> co_status = NGX_ [% SUBSYS %]_LUA_CO_DEAD ;
1480
1480
1481
- ngx_ [% subsys %]_lua_thread_traceback (L , ctx -> cur_co_ctx -> co ,
1482
- ctx -> cur_co_ctx );
1483
- trace = lua_tostring (L , -1 );
1481
+ if (orig_coctx -> is_uthread
1482
+ || orig_coctx -> is_wrap
1483
+ || ngx_ [% subsys %]_lua_is_entry_thread (ctx ))
1484
+ {
1485
+ ngx_ [% subsys %]_lua_thread_traceback (L , orig_coctx -> co ,
1486
+ orig_coctx );
1487
+ trace = lua_tostring (L , -1 );
1488
+
1489
+ if (lua_isstring (orig_coctx -> co , -1 )) {
1490
+ msg = lua_tostring (orig_coctx -> co , -1 );
1491
+ dd ("user custom error msg: %s" , msg );
1484
1492
1485
- propagate_error :
1493
+ } else {
1494
+ msg = "unknown reason" ;
1495
+ }
1496
+ }
1486
1497
1487
- ngx_ [% subsys %]_lua_assert (err != NULL && msg != NULL
1488
- && trace != NULL );
1498
+ propagate_error :
1489
1499
1490
1500
if (ctx -> cur_co_ctx -> is_uthread ) {
1501
+ ngx_ [% subsys %]_lua_assert (err != NULL && msg != NULL
1502
+ && trace != NULL );
1491
1503
1492
1504
ngx_log_error (NGX_LOG_ERR , r -> connection -> log , 0 ,
1493
1505
"[% log_prefix %]lua user thread aborted: %s: %s\n%s" ,
@@ -1538,6 +1550,9 @@ propagate_error:
1538
1550
}
1539
1551
1540
1552
if (ngx_ [% subsys %]_lua_is_entry_thread (ctx )) {
1553
+ ngx_ [% subsys %]_lua_assert (err != NULL && msg != NULL
1554
+ && trace != NULL );
1555
+
1541
1556
ngx_log_error (NGX_LOG_ERR , r -> connection -> log , 0 ,
1542
1557
"lua entry thread aborted: %s: %s\n%s" ,
1543
1558
err , msg , trace );
@@ -1603,9 +1618,6 @@ propagate_error:
1603
1618
lua_xmove (orig_coctx -> co , next_co , 1 );
1604
1619
nrets = 2 ;
1605
1620
1606
- ngx_log_error (NGX_LOG_ERR , r -> connection -> log , 0 ,
1607
- "lua coroutine: %s: %s\n%s" , err , msg , trace );
1608
-
1609
1621
/* try resuming on the new coroutine again */
1610
1622
continue ;
1611
1623
}
0 commit comments