[MDEV-24132] Default value for connect timeout is rejected by the kernel on OpenBSD Created: 2020-11-05  Updated: 2020-11-07  Resolved: 2020-11-07

Status: Closed
Project: MariaDB Server
Component/s: Platform OpenBSD
Fix Version/s: N/A

Type: Task Priority: Major
Reporter: Brad Smith Assignee: Daniel Black
Resolution: Won't Fix Votes: 0
Labels: None


 Description   

We have this patch currently in our tree. I am not sure about submitting it upstream as is but I thought I would file a bug report.

Default value for connect timeout is rejected by the kernel.
 
Index: client/mysqladmin.cc
--- client/mysqladmin.cc.orig
+++ client/mysqladmin.cc
@@ -215,7 +215,7 @@ static struct my_option my_long_options[] =
   {"wait", 'w', "Wait and retry if connection is down.", 0, 0, 0, GET_UINT,
    OPT_ARG, 0, 0, 0, 0, 0, 0},
   {"connect_timeout", OPT_CONNECT_TIMEOUT, "", &opt_connect_timeout,
-   &opt_connect_timeout, 0, GET_ULONG, REQUIRED_ARG, 3600*12, 0,
+   &opt_connect_timeout, 0, GET_ULONG, REQUIRED_ARG, 0, 0,
    3600*12, 0, 1, 0},
   {"shutdown_timeout", OPT_SHUTDOWN_TIMEOUT, "", &opt_shutdown_timeout,
    &opt_shutdown_timeout, 0, GET_ULONG, REQUIRED_ARG,



 Comments   
Comment by Daniel Black [ 2020-11-05 ]

Is the maximum value accepted by the kernel able to be probed?

I traced it through and the collect timeout gets used as the argument in timeout to poll. The OpenBSD poll (https://man.openbsd.org/poll.2) seem to accept milliseconds the same as general POSIX. So I assume poll is just returning EINVAL without this patch?

Its also used in the gnutls_handshake_set_timeout.

Comment by Brad Smith [ 2020-11-06 ]

After asking around about the diff and to whom commited it; it turns out this was a workaround for an issue elsewhere which has had adjustment and the workaround has now been remove from our MariaDB port.

Comment by Daniel Black [ 2020-11-07 ]

Ok, thanks for finding out.

Eventually we will get to having OpenBSD as part of CI but in the mean time please continue to report incompatibilities and we'll see how we can resolve them.

Comment by Brad Smith [ 2020-11-07 ]

This was the kernel fix..

CVSROOT:	/cvs
Module name:	src
Changes by:	mpi@cvs.openbsd.org	2020/01/15 06:17:35
 
Modified files:
	sys/kern       : uipc_socket.c uipc_socket2.c uipc_syscalls.c 
	sys/nfs        : nfs_socket.c nfs_syscalls.c 
	sys/sys        : socketvar.h time.h 
 
Log message:
Keep socket timeout intervals in nsecs and use them with tsleep_nsec(9).
 
Introduce and use TIMEVAL_TO_NSEC() to convert SO_RCVTIMEO/SO_SNDTIMEO
specified values into nanoseconds.  As a side effect it is now possible
to specify a timeout larger that (USHRT_MAX / 100) seconds.
 
To keep code simple `so_linger' now represents a number of seconds with
0 meaning no timeout or 'infinity'.
 
Yes, the 0 -> INFSLP API change makes conversions complicated as many
timeout holders are still memset()'d.
 
Inputs from cheloha@ and bluhm@, ok bluhm@

Generated at Thu Feb 08 09:27:41 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.