Hi<div><br></div><div>We are developing and testing an application that involves a vortex (version 1.1.8) based client and a server which uses Java implementation of BEEP. The application has been running fine on several platforms including Linux, AIX, HP, Solaris. In one the machines which runs RedHat 6.1 we are facing issues. The failure happens during connection establishment. The error message indicates that socket connect operation is in progress. Following are vortex log messages. Please note that the line numbers may not match with the vortex 1.1.8 code since I had added a few extra log messages in the same file.</div>


<div><br></div><div><div><font color="#000099">(debug) vortex_connection.c:1661 executing connection new in blocking mode to localhost:47720 id=1</font></div><div><font color="#000099">(debug) vortex_connection.c:1274 detected connect timeout during 30 seconds (starting from: 1344323279)</font></div>


<div><font color="#000099">(debug) vortex_connection.c:1294 __vortex_connection_wait_on (sock=4) operation finished, err=1, errno=115 (Operation now in progress), wait_for=2 (ellapsed: 0)</font></div><div><font color="#cc0000">(warning) vortex_connection.c:1310 error level set on waiting socket</font></div>


<div><font color="#000099">(debug) vortex_connection.c:1321 timeout operation finished, with err=-6, errno=115, ellapsed time=0 (seconds)</font></div><div><font color="#ff0000">(warning) vortex_connection.c:1470 unable to connect to remote host (timeout)</font></div>


<div><font color="#000099">(debug) vortex_connection.c:2373 closing a connection which is not opened, unref resources..</font></div></div><div><br></div><div>I looked at the function &quot;__vortex_connection_wait_on&quot; that sets the error to &quot;-6&quot; and logs the first warning message. The function &quot;vortex_io_waiting_invoke_wait&quot; which calls &quot;epoll&quot; (epoll is available in this OS version) returns the number of writable FDs. If the return value is &gt;0 then vortex calls &quot;getsockopt&quot; to get any error on the socket. This seems to give value for SO_ERROR as &quot;111&quot;, which stands for &quot;Connection refused&quot;. Since the number of file descriptors ready for write is greater than zero I thought calling &quot;getsockopt&quot; is not necessary and hence removed the code to call &quot;getsockopt&quot;. This means if the number of FDs ready for write is &gt;0 then I assume the socket is ready and hence break from the loop. With this change the issue being hit earlier was resolved. This meant that &quot;getsockopt&quot; returned wrong error code. I am wondering if that is because of calling getsockopt even in success case.</div>
<div><br></div><div>Note that without the above mentioned change the issue was very consistent and frequent but with the change the issue was not observed at all.</div><div><br></div><div>Now I want to know if the above mentioned change is correct. I see a comment in &quot;__vortex_connection_wait_on&quot; function which mentions about an issue with not calling getsockopt API in older version of Linux. Is this still applicable? I checked with a few of colleagues who have a few years of experience of using these APIs. They mentioned that it would have been required in older versions but not in the current versions of operating systems.</div>


<div><br></div><div>So the question is &quot;<font color="#000099">Is it fine not to call getsockopt API and check SO_ERROR when the number of file descriptors ready is greater than zero?</font>&quot;.</div><div><br></div>


<div>Thanks</div><div>Subrahmanya</div>