This is an automated email from the ASF dual-hosted git repository.

yjhjstz pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git

commit d58fde9741950fca532455bd222979c93219bbb5
Author: HouLei <[email protected]>
AuthorDate: Thu Feb 23 22:51:50 2023 -0800

    Double gpfdist listening to one port
    
    In an extreme case, two gpfdist occupy one port(ipv4/ipv6). The reason for 
this problem includes two aspects. The first one is that 'bind' is not mutually 
exclusive. And another is that when listening to a port fail, gpfdist will try 
the same port with a different protocol(ipv4 or ipv6).
    
    So the PR fixes the problem by changing the handling for failed listening 
behavior.
---
 src/bin/gpfdist/gpfdist.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/bin/gpfdist/gpfdist.c b/src/bin/gpfdist/gpfdist.c
index 586306281e..a6e368c549 100644
--- a/src/bin/gpfdist/gpfdist.c
+++ b/src/bin/gpfdist/gpfdist.c
@@ -2717,7 +2717,20 @@ http_setup(void)
                                                          opt.p,
                                                          saved_errno,
                                                          
strerror(saved_errno));
-                               continue;
+
+#ifdef WIN32
+                               if ( 1 )
+#else
+                               if ( errno == EADDRINUSE )
+#endif
+                               {
+                                       create_failed = true;
+                                       break;
+                               }
+                               else
+                               {
+                                       gwarning(NULL, "%s (errno=%d), port: 
%d",strerror(errno), errno, opt.p);
+                               }
                        }
                        gcb.listen_socks[gcb.listen_sock_count++] = f;
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to