HI all
If I try to create a IPC connection when the server is busy for a long query, will hopen fail with timeout and it will wait until the long query finished? Say I haven’t turn on the multi-thread support and KDB server running in single thread mode
Thanks!
?you can simulate a server being busy by pushing a _ test _ serving process into suspended mode (debug prompt), e.g. at
?q){a}
'a
[1] {a}
^
and then try from a remote:
q)h:hopen (`:localhost:5000;5000)
'timeout
[0] h:hopen (`:localhost:5000;5000)
^
?the client process will timeout if it cannot establish the connection (including username:password exchange) within the specified timeout.?
Thanks a lot Charles, so for the above example it is 5000 milli-second, and I think if I don’t specific any timeout, then it will wait forever, right?
good question. :-)
tcp connect has its own default timeout, which will become apparent in the event of network errors or a full listen queue on the receiver - the timings and behaviour (in case of full listen queue) appear to be OS specific, somewhat tunable. That aside, without an explicit timeout for hopen, and if the tcp stack is functioning unencumbered, then the connection will be established (in terms of tcp state) and the client will then send the username:password. The remote server may read and respond to this at its convenience, so, yes, the client will wait until it receives that response.