Comments (4)
I'm not familiar with how the Linux kernel works, but Indy has never relied on OS-level timeouts for its ConnectTimeout
handling, especially since there is no standard socket option to specify a timeout for connect()
. As Indy uses blocking sockets, it runs connect()
in its own worker thread, waiting up to ConnectTimeout
for that thread to terminate. If the thread does not terminate in time, shutdown()
is then called to abort the connection in progress, and close()
to close the socket. So, the only hangup should be if connect()
is not respecting shutdown()
/close()
in a timely manner.
That being said, there is an open ticket to re-design ConnectTimeout
handling to use a non-blocking connect()
with select()
/(e)poll()
on platforms which support that option. But that is work for a future release.
from indy.
So, the only hangup should be if connect() is not respecting shutdown()/close() in a timely manner.
Yes, and as I understand, the kernel now prohibits shutting down the connection attempt, and Indy's mechanism is now useless.
shutdown()
does not work... further down TIdStackUnix.WSShutdown
returns -1
. So the thread keeps waiting until eventually the OS decides to give up on connect()
from indy.
Yes, and as I understand, the kernel now prohibits shutting down the connection attempt, and Indy's mechanism is now useless.
Oh, well, that would certainly suck :-( That doesn't seem like a very good change for them to make in the kernel, and it certainly isn't documented behavior, AFAICS.
shutdown()
does not work... further downTIdStackUnix.WSShutdown
returns-1
. So the thread keeps waiting until eventually the OS decides to give up onconnect()
Then I guess I need to bump up the priority on #3.
from indy.
I have verified it working again. Without changing anything in freepascal, it works in linux 6.6.2 and 6.1.63. (timeout in the program is 3000ms, see above).
Most probably fixed by torvalds/linux@419ce13 , as mentioned in #493 .
$ uname -a
Linux 6.6.2-v8+ #1 SMP PREEMPT Tue Nov 21 22:28:24 UTC 2023
aarch64 GNU/Linux
and
$ uname -a
Linux 6.1.63-v8+ #1700 SMP PREEMPT Thu Nov 23 14:10:01 GMT 2023
aarch64 GNU/Linux
/dev/shm $ strace -r -f -e trace=open,socket,connect,bind
./conecttimeout
0.000000 socket(AF_INET, SOCK_STREAM, IPPROTO_IP) = 3
0.000889 bind(3, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("0.0.0.0")}, 16) = 0
strace: Process 1162 attached
[pid 1162] 0.002929 connect(3, {sa_family=AF_INET, sin_port=htons(8090), sin_addr=inet_addr("192.168.1.184")}, 16) = -1 ECONNRESET
[pid 1162] 3.008621 +++ exited with 0 +++
An unhandled exception occurred at $00000000004E40A4:
EIdConnectTimeout: Connect timed out.
$00000000004E40A4 DOCONNECTTIMEOUT, line 328 of ../../lib/indy10/Core/IdIOHandlerStack.pas
$00000000004E32CC OPEN, line 369 of ../../lib/indy10/Core/IdIOHandlerSocket.pas
$000000000045DFC8 CONNECT, line 328 of ../../lib/indy10/Core/IdTCPClient.pas
$000000000045E90C CONNECT, line 514 of ../../lib/indy10/Core/IdTCPClient.pas
$00000000004009F0 main, line 22 of ../../../../../dev/shm/conecttimeout
$0000007F9AF1EE18
$0000000000400928
1.503324 +++ exited with 217 +++
from indy.
Related Issues (20)
- Remove IIdTextEncoding parameters for AnsiString input on FreePascal 3.0+
- ConnectTimeout not working HOT 1
- Service compiled with Delphi 11 (TidTCPServer) with Clients compiled with Delphi XE3 not connecting. HOT 2
- Compile error after fc3966b : an open parenthesis is missing in idHTTP line 3189
- Error reading IdSSLIOHandlerSocketOpenSSL1.SSLOptions.Method: Invalid property value HOT 2
- Make it easier to send replies in TIdEventSocksServer event handlers
- EIdOpenSSLShutdownError on TCP server shutdown after verifying SSL_shutdown result code HOT 4
- When SSL_get_error() returns SSL_ERROR_SYSCALL, include the error from GetLastError()
- documentation can't be downloaded HOT 5
- Assume the highest supported compiler version when a new compiler is released
- CTCP PING does not return correct value HOT 6
- Update IdCustomHTTPServer responses HOT 1
- SCRAM-SHA-1(-PLUS) + SCRAM-SHA-256(-PLUS) + SCRAM-SHA-512(-PLUS) + SCRAM-SHA3-512(-PLUS) supports
- Delphi 2007 w/ Indy 10.6.2.0 Won't Compile (File not found: IdSys.dcu) HOT 2
- EConvertError in TIdX509.notBefore and TIdX509.notAfter properties for 4-digit years
- Tidtelnet.Disconnect cannot be disconnected HOT 2
- No FHeadIndex - A Bug? HOT 4
- Wont Reset Bytes - A Bug? HOT 4
- Rad Studio 12 - Settings compatible HOT 3
- idHttp - IPv6 - IPVersion-ProtocolSwitch on Redirect (HandleRedirects=true) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from indy.