This is an automated email from the ASF dual-hosted git repository. wusheng pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/skywalking-rover.git
The following commit(s) were added to refs/heads/main by this push: new d997947 Fix the ztunnel process id not setting to the BPF when process changed (#199) d997947 is described below commit d99794757d03a3a617158e91a51a70861da016cf Author: mrproliu <741550...@qq.com> AuthorDate: Thu Jul 3 10:42:42 2025 +0800 Fix the ztunnel process id not setting to the BPF when process changed (#199) --- pkg/accesslog/collector/ztunnel.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pkg/accesslog/collector/ztunnel.go b/pkg/accesslog/collector/ztunnel.go index 550e2a9..be5c168 100644 --- a/pkg/accesslog/collector/ztunnel.go +++ b/pkg/accesslog/collector/ztunnel.go @@ -80,11 +80,6 @@ func (z *ZTunnelCollector) Start(_ *module.Manager, ctx *common.AccessLogContext return nil } - // setting the ztunnel pid in the BPF - if err = ctx.BPF.ZtunnelProcessPid.Set(z.collectingProcess.Pid); err != nil { - return fmt.Errorf("failed to set ztunnel process pid: %v", err) - } - ctx.BPF.ReadEventAsync(ctx.BPF.ZtunnelLbSocketMappingEventQueue, func(data interface{}) { event := data.(*events.ZTunnelSocketMappingEvent) localIP := z.convertBPFIPToString(event.OriginalSrcIP) @@ -189,6 +184,7 @@ func (z *ZTunnelCollector) findZTunnelProcessAndCollect() error { running, err := z.collectingProcess.IsRunning() if err == nil && running { // already collecting the process + log.Debugf("found the ztunnel process and collecting ztunnel data from pid: %d", z.collectingProcess.Pid) return nil } log.Warnf("detected ztunnel process is not running, should re-scan process to find and collect it") @@ -235,6 +231,11 @@ func (z *ZTunnelCollector) collectZTunnelProcess(p *process.Process) error { uprobeFile := z.alc.BPF.OpenUProbeExeFile(pidExeFile) uprobeFile.AddLink(trackBoundSymbol[0].Name, z.alc.BPF.ConnectionManagerTrackOutbound, nil) + + // setting the ztunnel pid in the BPF + if err = z.alc.BPF.ZtunnelProcessPid.Set(p.Pid); err != nil { + return fmt.Errorf("failed to set ztunnel process pid in the BPF: %v", err) + } return nil }