Bug #29093 Wrong path is being taken for signal handling on HP-UX
Submitted: 14 Jun 2007 0:56 Modified: 16 Mar 2009 12:56
Reporter: Adam Dixon Email Updates:
Status: Closed
Category:Server: Compiling Severity:S3 (Non-critical)
Version:Any OS:HP/UX
Assigned to: Daniel Fischer Target Version:
Tags: hp/ux, path, signal
Triage: D4 (Minor)

[14 Jun 2007 0:56] Adam Dixon
Description:
From customer,
MySQL sometimes follow the Windows path for HP-UX and does not take advantage of built in
system calls for signal handling between processes. This does not happen for the build on
Linux. So, to force the HP-UX build not to take Windows path:

edit the file /sql/net_serv.cc

Add the following code in line 75

#if defined(__hpux)
#define NO_ALARM /* use HP-UX alarm calls */
#endif

How to repeat:
Not needed.

Suggested fix:
edit the file /sql/net_serv.cc

Add the following code in line 75

#if defined(__hpux)
#define NO_ALARM /* use HP-UX alarm calls */
#endif
[14 Jun 2007 9:14] Daniel Fischer
The report is not clear. NO_ALARM is currently defined on Windows and triggers omission of
code that requires support for the alarm signal, which Windows lacks. So we are /not/
currently following the Windows path on HP/UX.

The alarm signal is used to implement timeouts in networking code. If NO_ALARM is
defined, as it is on Windows, socket timeouts are used instead, implemented by setsockopt
SO_SNDTIMEO and SO_RCVTIMEO. These /do/ work on Windows (and Linux) but /do not/ work on
many UNIX OS, even though part of the UNIX standard. So changing this on HP/UX and
defining NO_ALARM /would actually make us/ take the Windows part.

As far as I know (currently), setsockopt SO_*TIMEO always returns ENOPROTOOPT on HP/UX
11i, meaning these options are not supported. This is legal according to the UNIX
standard which specifies that the set of supported options can differ between protocols.

If it is not certain that these options work on HP/UX, we cannot implement this
suggestion.
[27 Jun 2007 22:57] John Mendonca
sample get/set sockopt program

Attachment: sockopt.c (text/x-csrc), 1.68 KiB.

[27 Jun 2007 23:03] John Mendonca
Hello Adam

That attached sample sockopt program should demonstrate successful setting and getting of
the SO_SND/RCVTIMEO options on hp-ux 11.11 (HP-PA) and 11.23 (Itanium) platforms.

John
[28 Jun 2007 0:25] John Mendonca
Adam / Daniel

I still need to do some research as it seems that Daniel's comments may be accurate for
the X/Open UNIX 03 version of the HP-UX socket library on 11.31.  

John
[28 Jun 2007 11:32] Daniel Fischer
John, thanks for the effort.

I'm having a bit of trouble locating documentation on this, so if you can produce any
documentation that clearly states this is working I think this will be enough.

You may be right about UNIX 2003, if I remember correctly I got the idea that this is not
supported from 11i v3 release notes. I don't have access to hardware running this release,
I would very much appreciate verification.