If a provider object passes out of scope but its probes do not, then the provider get garbage collected, and unregisters all USDT probes. The following program can recreate this:
var d = require('dtrace-provider');
var dtp = d.createDTraceProvider('gctest');
var p1 = dtp.addProbe('probe1', 'int', 'int');
var p2 = dtp.addProbe('probe2', 'char *', 'int');
dtp.enable();
module.exports = {
p1: p1,
p2: p2
};
% sudo dtrace -Zln 'gctest$target:::' -p `pgrep node`
ID PROVIDER MODULE FUNCTION NAME
dtrace: failed to match gctest8494:::: No probe matches description
We can see that it gets removed by the GC by tracing the program:
If a provider object passes out of scope but its probes do not, then the provider get garbage collected, and unregisters all USDT probes. The following program can recreate this:
And:
If you run the program:
You can't find the probes:
We can see that it gets removed by the GC by tracing the program: