Skip to content

Commit 22ed1b3

Browse files
authored
Capture Chisels GC kick off & OOM error print (#1694)
1 parent 6ed7402 commit 22ed1b3

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

userspace/sysdig/chisels/wsysdig_summary.lua

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,9 @@ function on_init()
458458
finfraname = chisel.request_field("evt.arg.name")
459459
fpname = chisel.request_field("proc.pname")
460460

461+
-- kick off GC
462+
collectgarbage()
463+
461464
print('{"slices": [')
462465
return true
463466
end
@@ -480,7 +483,6 @@ function on_capture_start()
480483
end
481484
end
482485
end
483-
484486
parse_thread_table_startup()
485487
return true
486488
end
@@ -736,6 +738,10 @@ function on_interval(ts_s, ts_ns, delta)
736738
parse_thread_table_interval()
737739
parse_container_table()
738740

741+
if nintervals == 0 then
742+
-- clean up events
743+
collectgarbage()
744+
end
739745
--print(json.encode(ssummary.connectionCount, { indent = true }))
740746
add_summaries(ts_s, ts_ns, gsummary, ssummary)
741747
reset_summary(ssummary)

userspace/sysdig/sysdig.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1668,6 +1668,12 @@ sysdig_init_res sysdig_init(int argc, char **argv)
16681668
handle_end_of_file(print_progress);
16691669
res.m_res = e.scap_rc();
16701670
}
1671+
catch (const std::runtime_error& e)
1672+
{
1673+
cerr << e.what() << endl;
1674+
handle_end_of_file(print_progress);
1675+
res.m_res = EXIT_FAILURE;
1676+
}
16711677
catch(...)
16721678
{
16731679
handle_end_of_file(print_progress);

0 commit comments

Comments
 (0)