Bug 2150889

Summary: wrong client.xprt.srcport in /usr/libexec/pcp/pmdas/nfsclient/pmdanfsclient.python
Product: Red Hat Enterprise Linux 8 Reporter: Lukas Herbolt <lherbolt>
Component: pcpAssignee: Nathan Scott <nathans>
Status: VERIFIED --- QA Contact: Jan Kurik <jkurik>
Severity: medium Docs Contact: Jacob Taylor Valdez <jvaldez>
Priority: unspecified    
Version: 8.7CC: jkurik, nathans, scox
Target Milestone: rcKeywords: Bugfix, Triaged
Target Release: 8.9   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: pcp-5.3.7-17.el8 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Lukas Herbolt 2022-12-05 14:37:41 UTC
Description of problem:
Getting errors in /var/log/pcp/pmcd/nfsclient.log

Traceback (most recent call last):
  File "/var/lib/pcp/pmdas/nfsclient/pmdanfsclient.python", line 666, in nfsclient_fetch
    self.nfsclient_refresh()
  File "/var/lib/pcp/pmdas/nfsclient/pmdanfsclient.python", line 599, in nfsclient_refresh
    client.xprt.srcport = values[1]
TypeError: bytes or integer address expected instead of str instance
Traceback (most recent call last):
  File "/var/lib/pcp/pmdas/nfsclient/pmdanfsclient.python", line 666, in nfsclient_fetch
    self.nfsclient_refresh()
  File "/var/lib/pcp/pmdas/nfsclient/pmdanfsclient.python", line 599, in nfsclient_refresh
    client.xprt.srcport = values[1]
TypeError: bytes or integer address expected instead of str instance
Traceback (most recent call last):
  File "/var/lib/pcp/pmdas/nfsclient/pmdanfsclient.python", line 666, in nfsclient_fetch
    self.nfsclient_refresh()
  File "/var/lib/pcp/pmdas/nfsclient/pmdanfsclient.python", line 599, in nfsclient_refresh
    client.xprt.srcport = values[1]


Version-Release number of selected component (if applicable):
pcp-pmda-nfsclient-5.3.7-7.el8.x86_64

How reproducible:
everytime

Steps to Reproduce:
1. install pmda
2. mount rdma nfs
3. check the stats

Actual results:
above error

Expected results:
values are logged

Additional info:
Fix:
[lherbolt@trufa ~]Φ less Downloads/diff 
--- pmdanfsclient.python.orig   2022-12-02 12:05:43.533711411 -0500
+++ pmdanfsclient.python        2022-12-02 12:02:20.299097718 -0500
@@ -585,7 +585,7 @@
                         client.xprt.sending_u = self.longs(values[12])
                         client.xprt.pending_u = self.longs(values[13])
                     elif xprt_prot == 'udp':
-                        client.xprt.srcport = values[1]
+                        client.xprt.srcport = self.chars(values[1])
                         client.xprt.bind_count = self.longs(values[2])
                         client.xprt.sends = self.longs(values[3])
                         client.xprt.recvs = self.longs(values[4])
@@ -596,7 +596,7 @@
                         client.xprt.sending_u = self.longs(values[9])
                         client.xprt.pending_u = self.longs(values[10])
                     elif xprt_prot == 'rdma':
-                        client.xprt.srcport = values[1]
+                        client.xprt.srcport = self.chars(values[1])
                         client.xprt.bind_count = self.longs(values[2])
                         client.xprt.connect_count = self.longs(values[3])
                         client.xprt.connect_time = self.longs(values[4])

Comment 1 Nathan Scott 2022-12-05 20:45:40 UTC
Thanks for the report and patch Lukas, much appreciated!

Could you attach a copy of an affected /proc/self/mountstats file please?  I'll use it to make an automated regression test - we clearly have a gap in our test coverage here.

cheers.