Skip to content

Conversation

@kimullaa
Copy link
Contributor

@kimullaa kimullaa commented Oct 22, 2025

follow the QA 983 style(cleanup the socat using pmsignal)

It works in my environment, but I haven't confirmed whether it works in the CI environment.

$ ./check 867
Warning: changing umask from 0002 to 0022
867 0s ...
Passed 1 tests
$ echo $?
0
$ ps -ef | grep socat
kimullaa 2558431 2497823  0 21:01 pts/2    00:00:00 grep --color=auto socat

Copy link
Member

@kmcdonell kmcdonell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, @kimullaa ... this is still not working for me, I'm afraid.

  1. you need to rm -f /tmp/httpcache.sock before running socat
  2. the test hangs in httpcache

Here is some debugging I've been able to collect ...

$ sh -x 867
+ basename 867
+ seq=867
+ echo QA output created by 867
...
+ rm -f /var/tmp/867-19435.socat.out /var/tmp/867-19435.socat.err /tmp/httpcache.sock
+ socat_pid=19586
+ socat -d -d unix-listen:/tmp/httpcache.sock,fork tcp-connect:localhost:44323
+ echo == Check HTTP cache
+ tee -a /home/kenj/src/pcp/qa/867.full
== Check HTTP cache
+ /home/kenj/src/pcp/qa/src/httpcache

and httpcache never exits.

$ cat /var/tmp/867-19435.socat.err
2025/10/23 07:45:00 socat[19586] N listening on AF=1 "/tmp/httpcache.sock"

$ cat /var/tmp/867-19435.socat.out

$ pstree -p 19435
sh(19435)─┬─httpcache(19589)
└─socat(19586)

$ gdb -p 19589 ~/src/pcp/qa/src/httpcache
...
(gdb) where
#0 0x000075589f32bbfd in __libc_recv (fd=3, buf=0x7ffe848bf910, len=8192,
flags=0) at ../sysdeps/unix/sysv/linux/recv.c:28
#1 0x000075589f63844a in __pmRecv () from /lib/libpcp.so.4
#2 0x000075589f5476ca in ?? () from /lib/libpcp_web.so.1
#3 0x000075589f54864a in pmhttpClientGet () from /lib/libpcp_web.so.1
#4 0x000055c0640b729c in call_http_get (
url=0x55c0640b8070 "http://localhost:44323/series/metrics?match=kernel.all.load") at httpcache.c:19
#5 0x000055c0640b7463 in main (argc=1, argv=0x7ffe848c1b38) at httpcache.c:65

Hope that's enough for you to figure out the issue(s).

@kmcdonell
Copy link
Member

Sorry @kimullaa this is still not working for me. It now hangs in the first iteration of the added socat block.

@kimullaa kimullaa force-pushed the fix-qa-867 branch 2 times, most recently from 9d05eef to 08d5ce9 Compare October 24, 2025 11:55
@kmcdonell
Copy link
Member

@kimullaa Still no luck for me ... it is back to hanging in httpcache.
I think the issue may be you're pmproxy config which is not default.
If this is the case, your test needs to take control and start a new pmproxy with the config you need, then cleanup afterwards. qa/1214 shows how to start a private pmproxy and key server (if you need that).

@kimullaa
Copy link
Contributor Author

kimullaa commented Oct 25, 2025

@kmcdonell thank you for a advice!That’s very helpful.

Hmm, I don’t think I’ve changed the configuration.

diff -u /etc/pcp/pmproxy/pmproxy.conf src/pmproxy/pmproxy.conf

If this is the case, your test needs to take control and start a new pmproxy with the config you need, then cleanup afterwards. qa/1214 shows how to start a private pmproxy and key server (if you need that).

It is a good practice, so I’ll incorporate that.

I hope this fix resolves the issue, but if it doesn’t,I'd like to reproduce the hang myself — could you tell me about your environment, such as which distribution you're using?

- start a private pmproxy and key server
- check if socat is running
- clean up $tmp files and processes

Signed-off-by: Shunsuke Kimura <pbrehpuum@gmail.com>
@kmcdonell
Copy link
Member

G'day @kimullaa

Latest version works 100% for me ... 🍻

Just one small nit in httpcache.c ... please use pmsprintf() in place of sprintf() ... the extra (2nd) argument protects against buffer overrun (it is not really an issue here, but various compilers and code analysers we use will complain and require the change to be made anyway to keep our "no compiler warnings or code analyser issues" goal).

For reference my main failing system is a 64-bit Ubuntu 24.04, but I think taking control of your own key server and pmproxy instance was the key (excuse the pun), not the platform per se.

Cheers, Ken.

@kmcdonell kmcdonell merged commit d97fa5b into performancecopilot:main Oct 29, 2025
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants