Re: simple.pg of polygraph-2.8.1 on linux

Alex Rousskov <[email protected]>
Newsgroups gmane.comp.web.web-polygraph.user
Message-ID <[email protected]>
On Wed, 2005-06-22 at 11:50 -0700, Ashwani Wason wrote:
> 
> I am pretty much following the instructions in the user manual of
> polygraph-2.8.1 for using the default simple.pg, which sets up a server
> on 127.0.0.1:9090 and client on 127.0.0.1. I am on Fedora (post core 4)
> Linux.
> 
> The client fails to connect to the server. I changed the IP addresses so
> that the client and the server run on different machines, but still I
> get the same error. I searched the list archives and web for this error
> but did not find much info.
> 
> Here is some output from the client:
> 
> Running: "/usr/local/polygraph/bin/polyclt
> --config /home/awason/polygraph/workloads/simple.pg
> --cfg_dirs /home/awason/polygraph/workloads/include --verb_lvl 10"...
> gadgets.cc:282: (s0) Success
> gadgets.cc:282: (s0) Success
> gadgets.cc:282: (s0) Success
> /usr/local/polygraph/bin/polyclt: warning: no run phases were specified;
> generating and using default phase
> PolyApp.cc:720: (s0) Success
..
> gadgets.cc:282: (s0) Success
> gadgets.cc:282: (s0) Success
..
> 000.02| fyi: max local population size: 1 robots
> 000.02| Connection.cc:136: error: 1/1 (s22) Invalid argument
> 000.02| Client.cc:306: error: 1/2 (c59) failed to establish a connection
> 000.02| 127.0.0.1 failed to connect to 127.0.0.1:9090
> 000.02| fyi: reached max local population size: 1 robots
> 000.02| Connection.cc:136: error: 2/3 (s22) Invalid argument
> 000.02| Client.cc:306: error: 2/4 (c59) failed to establish a connection

The attached patch fixes the problem (which Ashwani was kind enough to
help to debug off the mailing list). The bug seems to affect
IPv6-capable versions of Polygraph and newer Linux kernels that have
more strict checks for system call parameters.

HTH,

Alex.
socket-size.patch (text/x-patch, 409 B)
--- polygraph-2.8.1/src/xstd/Socket.cc	Fri May  2 13:51:35 2003
+++ polygraph-3.0/src/xstd/Socket.cc	Wed Jan 19 10:56:49 2005
@@ -38,7 +38,7 @@
 #define SOCKADDRLEN_SS(A) A.ss_len
 #define SOCKADDRLEN_SIN(A) A.sin_len
 #else
-#define SOCKADDRLEN_SS(A) sizeof(A)
+#define SOCKADDRLEN_SS(A) ((A).ss_family == AF_INET ? sizeof(sockaddr_in) : sizeof(sockaddr_in6))
 #define SOCKADDRLEN_SIN(A) sizeof(A)
 #endif
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.