Patch Name: PHCO_29959 Patch Description: s700_800 11.00 Pthread library cumulative patch Creation Date: 03/12/06 Post Date: 03/12/19 Hardware Platforms - OS Releases: s700: 11.00 s800: 11.00 Products: N/A Filesets: OS-Core.C-MIN-32ALIB,fr=B.11.00,fa=HP-UX_B.11.00_32/64,v=HP OS-Core.C-MIN-64ALIB,fr=B.11.00,fa=HP-UX_B.11.00_32/64,v=HP OS-Core.CORE-64SLIB,fr=B.11.00,fa=HP-UX_B.11.00_32/64,v=HP OS-Core.CORE-SHLIBS,fr=B.11.00,fa=HP-UX_B.11.00_32/64,v=HP Automatic Reboot?: No Status: General Release Critical: Yes PHCO_29959: HANG PHCO_29108: HANG PHCO_26960: ABORT PHKL_17935: ABORT This defect could result in an application core dump. PHKL_17709: ABORT This defect could result in an application hang. Category Tags: defect_repair enhancement general_release critical halts_system Path Name: /hp-ux_patches/s700_800/11.X/PHCO_29959 Symptoms: PHCO_29959: ( SR:8606338187 CR:JAGae99161 ) Under certain circumstances, a multi-threaded application that has a thread suspending itself while depending upon a different thread to resume it, could experience a hang. PHCO_29108: ( SR:8606307008 CR:JAGae70043 ) Java processes can hang occasionally. ( SR:8606294128 CR:JAGae57868 ) Thread can get cancelled even though cancellation is disabled. ( SR:8606314230 CR:JAGae77005 ) The pthread library does not export two functions that are useful to the Java virtual machine. PHCO_26960: ( SR:8606245135 CR:JAGae11610 ) Application fails with internal error in pthread library when the kernel patch that implements a new light weight syscall is not applied. ( SR:8606249251 CR:JAGae15645 ) Application aborts when a detached thread forks child process. ( SR:8606232793 CR:JAGae02021 ) Private mutex lock throughput not acceptable for some applications with heavy mutex contention. ( SR:8606255251 CR:JAGae19578 ) pthread_cancel() fails to cancel a thread in certain conditions. ( SR:8606259437 CR:JAGae23755 ) pthread_mutex_destroy() intermittently returns EBUSY even when there are no threads accessing the mutex. PHCO_26000: ( SR:8606186056 CR:JAGad55261 ) Software providers may observe performance deficiencies in applications which heavily use shared mutexes. Performance of a PTHREAD_PROCESS_SHARED mutex unlock operation is slower than that of a PTHREAD_PROCESS_PRIVATE mutex, even in the non-contended (i.e., no waiters) case. PHCO_23792: libpthread didn't support initialized TLS variables. PHCO_19666: Libc was unable to use thread callbacks, which are needed for multithreaded performance enhancements. JAGab19980 PHKL_17935: SR: 1653296962 CR: JAGaa94129 An application that calls pthread_create() can terminate with the following error when running on a system with heavy memory usage: Pthread internal error: message: __alloc_stack() PHKL_17709: When calling pthread_[cond,mutex,rwlock]_init(), subsequent use of these objects can cause the process or thread to hang if the error is not properly checked, or structures associated with these routines are not properly initialized. PHKL_17294: If you have installed Patch PHKL_17390 and you use java and the pthread asynchronous cancellation feature you may experience incorrect program behavior -- possible program aborts, hangs, etc. If you do not use the pthreads asynchronous cancellation feature, this patch is not required. PHKL_16239: SCHED_TIMESHARE thread priorities degrade over time and with cpu usage. SCHED_NOAGE provides a scheduling policy where the priority does not degrade. In order to utilize the SCHED_NOAGE feature, patch PHKL_16236 must be installed along with PHKL_16239. The order of installation is not important. If this feature will not be used, PHKL_16236 is not necessary. PHKL_16368: System peformance degrades when thread spinlock contention occurs. libpthread enhancement to improve thread spinlock performance and overall system performance by lowering the amount of bus traffic during spinlock contention. Defect Description: PHCO_29959: ( SR:8606338187 CR:JAGae99161 ) Pthread library keeps track of thread suspensions using internal suspend count, Suspend count is incremented when a thread gets suspended and decremented when thread is resumed. The problem occurs when a thread suspends itself inside a loop while waiting for a different thread to resume it. The thread suspending itself may never get resumed since the suspend count maintained inside the library will not match the actual suspension state of the thread. Resolution: The internal counter that maintains thread's suspend count has been fixed to avoid this situation. PHCO_29108: ( SR:8606307008 CR:JAGae70043 ) During normal operation, the Java Virtual Machine may suspend a thread. When a thread gets suspended, it could be holding internal pthread resources. This can cause a deadlock. Resolution: Solution is to ensure target does not get suspended while holding internal pthread resources. ( SR:8606294128 CR:JAGae57868 ) The cancellation operation (pthread_cancel) can race with cancel enable/disable (pthread_setcancelstate). Resolution: While cancelling a thread, detect that the thread has now disabled cancellation. ( SR:8606314230 CR:JAGae77005 ) The pthread library does not export two functions that are useful to the Java virtual machine. Resolution: libpthread will now export the two symbols PHCO_26960: ( SR:8606245135 CR:JAGae11610 ) If SIGSYS is ignored by the application, the sigtimedwait() system call finds no pending SIGSYS after the check for new light weight system call fails with ENOSYS. This results in pthread internal error because SIGSYS was expected. Resolution: The check for new syscall is aptly handled so that internal error doesn't occur. ( SR:8606249251 CR:JAGae15645 ) In the child process forked from a detached thread, the first thread in the exit path references a stale pointer. This results in application aborting in pthread library. Resolution: The stale pointer is reset in the child fork cleanup path. ( SR:8606232793 CR:JAGae02021 ) When large number of threads contend for a mutex, it results in contention for the internal lock of the mutex, thereby exacerbating the mutex contention seen by the application. Resolution: The pthread mutex unlock path has been modified to release internal lock before waking up a waiting thread, and thus reducing contention for the internal lock and improving performance. The performance changes can take effect only if the POSIX real-time restrictions on threads waiting on a mutex are relaxed. This is done by disabling the mutex handoff mode for real-time threads and can be done using pthread_mutex_disable_handoff_np() or pthread_mutexattr_disable_handoff_np() or by setting the environment variable PTHREAD_DISABLE_HANDOFF=ON. By default these performance changes are disabled. The first API pthread_mutex_disable_handoff_np() is for process wide disabling of handoff mode in all mutexes. So is the environment variable PTHREAD_DISABLE_HANDOFF. The pthread_mutexattr_disable_handoff_np() takes an argument pointer to pthread_mutexattr_t and can be used to disable handoff mode for a particular mutex. The pthread_mutex_disable_handoff_np() has no arguments and has to be called by the main thread before any new threads are created. "Handoff mode" is used to strictly adhere to POSIX real-time characteristics, when real-time threads waiting on a mutex are woken up. If the application does not have any real-time threads acquiring mutex locks, or if the application does not rely on strict real-time behavior of real-time threads waiting on a mutex, the mutex handoff mode can be disabled, to take advantage of these performance changes. ( SR:8606255251 CR:JAGae19578 ) There is a race condition in thread cancellation path in pthread library, because of which pthread_cancel() fails to cancel a thread. Resolution: The race condition in the cancellation path is removed by protecting the internal cancellation structure with a spinlock. ( SR:8606259437 CR:JAGae23755 ) The problem with pthread_mutex_destroy() is attributed to the fact that, pthread_mutex_unlock() does not keep track of the number of waiters accurately. The mutex cannot be destroyed when there are waiters, and hence EBUSY is returned by pthread_mutex_destroy(). Resolution: The change introduced in this patch will accurately keep track of all the waiters. PHCO_26000: ( SR:8606186056 CR:JAGad55261 ) In the PTHREAD_PROCESS_SHARED mutex case, the unlock operation always makes a system call to synchronize with threads in other processes which may be waiting for the mutex. This makes the code path significantly longer. Resolution: Change pthread_mutex_unlock(), in the case of a shared mutex, to call a new light weight system call rather than the existing system call. If that new system call is not available, then use the regular system call instead. (Patch PHKL_25998, also required for this enhancement, adapts the existing system call which handles waiters of shared mutexes to coordinate with the light weight unlock system call. Patch PHKL_25999, also required for this enhancement, provides the new light weight system call for shared mutex unlock.) PHCO_23792: Initialized TLS variable support. PHCO_19666: Multithreaded performance enhancement JAGab19980 PHKL_17935: SR: 1653296962 CR: JAGaa94129 The pthread_create() path uses mmap() to allocate a stack. pthread_create() checks for a NULL return. However, mmap() returns MAP_FAILED if it cannot perform the allocation. Typically what happens is that the subsequent mprotect() will fail to setup the guard page, then munmap() fails when trying to clean up on the error return path, generating an "INTERNAL ERROR" message and a core dump from the library. Also, since the mmap() failure check passes even if it fails (we're not looking for the correct return value), pthread_create() doesn't return an error. Instead, it terminates with "INTERNAL ERROR." Resolution: pthread_create() now checks for MAP_FAILED and returns the error instead of failing with "INTERNAL ERROR.". PHKL_17709: Structures associated with pthread_[cond,mutex,rwlock]_init() are not being initialized correctly. This causes a call to these routines to return EBUSY. Resolution: We no longer check for "cookie" values to validate these objects. We unconditionally initialize them. PHKL_17294: A kernel interface change required that we save a register in a new location when the application enters the kernel via the trap path. The kernel change was made in patch PHKL_17390. Resolution: The pthreads library must now look in the new location for the register value in this case. PHKL_16239: The SCHED_NOAGE scheduling policy has approximately the same priority range as SCHED_TIMESHARE. However, the priority does not degrade with time or cpu usage. It provides an alternative to real time processes which always run first and have the possibility of taking over the system. PHKL_16368: The thread library spinlock did not take advantage of the cached lock value. In addition, it performed an unnecessary fetch each time through the 'spin' loop while waiting for the lock to be free. These conditions caused a large amount of unnecessary bus traffic. Enhancement: No (superseded patches contained enhancements) PHCO_29108: Enhancements were delivered in a patch this one has superseded. Please review the Defect Description text for more information. SR: 1653294868 1653296962 4701401240 5003360446 5003451591 8606184540 8606186056 8606232793 8606245135 8606249251 8606255251 8606259437 8606294128 8606307008 8606314230 8606338187 Patch Files: OS-Core.C-MIN-32ALIB,fr=B.11.00,fa=HP-UX_B.11.00_32/64,v=HP: /usr/lib/libpthread.a /usr/lib/libpthread_tr.a OS-Core.C-MIN-64ALIB,fr=B.11.00,fa=HP-UX_B.11.00_32/64,v=HP: /usr/lib/pa20_64/libpthread.a /usr/lib/pa20_64/libpthread_tr.a OS-Core.CORE-64SLIB,fr=B.11.00,fa=HP-UX_B.11.00_32/64,v=HP: /usr/lib/pa20_64/libpthread.1 /usr/lib/pa20_64/libpthread_tr.1 OS-Core.CORE-SHLIBS,fr=B.11.00,fa=HP-UX_B.11.00_32/64,v=HP: /usr/lib/libpthread.1 /usr/lib/libpthread_tr.1 what(1) Output: OS-Core.C-MIN-32ALIB,fr=B.11.00,fa=HP-UX_B.11.00_32/64,v=HP: /usr/lib/libpthread.a: libpthread.c $Date: 2003/12/05 21:50:14 $Revision: r 11ros/11 PATCH_11.00 (PHCO_29959) Pthread Interfaces libpthread HP-UX (Release B.11.00): Thu Jan 10 21:02 :09 PST 2002 /usr/lib/libpthread_tr.a: libpthread.c $Date: 2003/12/05 21:50:14 $Revision: r 11ros/11 PATCH_11.00 (PHCO_29959) Pthread Interfaces libpthread HP-UX (Release B.11.00): Thu Jan 10 21:35 :40 PST 2002 OS-Core.C-MIN-64ALIB,fr=B.11.00,fa=HP-UX_B.11.00_32/64,v=HP: /usr/lib/pa20_64/libpthread.a: libpthread.c $Date: 2003/12/05 21:50:14 $Revision: r 11ros/11 PATCH_11.00 (PHCO_29959) Pthread Interfaces libpthread HP-UX (Release B.11.00): Thu Jan 10 21:41 :18 PST 2002 /usr/lib/pa20_64/libpthread_tr.a: libpthread.c $Date: 2003/12/05 21:50:14 $Revision: r 11ros/11 PATCH_11.00 (PHCO_29959) Pthread Interfaces libpthread HP-UX (Release B.11.00): Thu Jan 10 21:42 :11 PST 2002 OS-Core.CORE-64SLIB,fr=B.11.00,fa=HP-UX_B.11.00_32/64,v=HP: /usr/lib/pa20_64/libpthread.1: Pthread Interfaces libpthread HP-UX (Release B.11.00): Thu Jan 10 21:41 :41 PST 2002 libpthread.c $Date: 2003/12/05 21:50:14 $Revision: r 11ros/11 PATCH_11.00 (PHCO_29959) /usr/lib/pa20_64/libpthread_tr.1: Pthread Interfaces libpthread HP-UX (Release B.11.00): Thu Jan 10 21:42 :36 PST 2002 libpthread.c $Date: 2003/12/05 21:50:14 $Revision: r 11ros/11 PATCH_11.00 (PHCO_29959) OS-Core.CORE-SHLIBS,fr=B.11.00,fa=HP-UX_B.11.00_32/64,v=HP: /usr/lib/libpthread.1: libpthread.c $Date: 2003/12/05 21:50:14 $Revision: r 11ros/11 PATCH_11.00 (PHCO_29959) Pthread Interfaces libpthread HP-UX (Release B.11.00): Thu Jan 10 21:02 :44 PST 2002 /usr/lib/libpthread_tr.1: libpthread.c $Date: 2003/12/05 21:50:14 $Revision: r 11ros/11 PATCH_11.00 (PHCO_29959) Pthread Interfaces libpthread HP-UX (Release B.11.00): Thu Jan 10 21:36 :02 PST 2002 cksum(1) Output: OS-Core.C-MIN-32ALIB,fr=B.11.00,fa=HP-UX_B.11.00_32/64,v=HP: 3236750825 229698 /usr/lib/libpthread.a 1975051705 259494 /usr/lib/libpthread_tr.a OS-Core.C-MIN-64ALIB,fr=B.11.00,fa=HP-UX_B.11.00_32/64,v=HP: 2306232184 379094 /usr/lib/pa20_64/libpthread.a 4024219847 432308 /usr/lib/pa20_64/libpthread_tr.a OS-Core.CORE-64SLIB,fr=B.11.00,fa=HP-UX_B.11.00_32/64,v=HP: 2531242455 135760 /usr/lib/pa20_64/libpthread.1 2857805086 165064 /usr/lib/pa20_64/libpthread_tr.1 OS-Core.CORE-SHLIBS,fr=B.11.00,fa=HP-UX_B.11.00_32/64,v=HP: 449572058 143360 /usr/lib/libpthread.1 3523806967 167936 /usr/lib/libpthread_tr.1 Patch Conflicts: None Patch Dependencies: s700: 11.00: PHKL_17390 s800: 11.00: PHKL_17390 Hardware Dependencies: None Other Dependencies: PHCO_26000: To enable the pthread shared mutex performance enhancement, three patches (PHKL_25998, PHKL_25999, and PHCO_26000) are required. To enable the TLS feature, the following patches should also be installed: PHCO_24148 libc cumulative patch PHSS_23440 linker cumulative patch PHSS_23785 linker startup patch PHSS_23953 Fortran90 B.11.01 patch Supersedes: PHKL_17935 PHKL_17709 PHKL_17294 PHKL_16368 PHKL_16239 PHCO_29108 PHCO_26960 PHCO_26000 PHCO_23792 PHCO_19666 Equivalent Patches: PHCO_29960: s700: 11.11 s800: 11.11 Patch Package Size: 530 KBytes Installation Instructions: Please review all instructions and the Hewlett-Packard SupportLine User Guide or your Hewlett-Packard support terms and conditions for precautions, scope of license, restrictions, and, limitation of liability and warranties, before installing this patch. ------------------------------------------------------------ 1. Back up your system before installing a patch. 2. Login as root. 3. Copy the patch to the /tmp directory. 4. Move to the /tmp directory and unshar the patch: cd /tmp sh PHCO_29959 5. Run swinstall to install the patch: swinstall -x autoreboot=true -x patch_match_target=true \ -s /tmp/PHCO_29959.depot By default swinstall will archive the original software in /var/adm/sw/save/PHCO_29959. If you do not wish to retain a copy of the original software, include the patch_save_files option in the swinstall command above: -x patch_save_files=false WARNING: If patch_save_files is false when a patch is installed, the patch cannot be deinstalled. Please be careful when using this feature. For future reference, the contents of the PHCO_29959.text file is available in the product readme: swlist -l product -a readme -d @ /tmp/PHCO_29959.depot To put this patch on a magnetic tape and install from the tape drive, use the command: dd if=/tmp/PHCO_29959.depot of=/dev/rmt/0m bs=2k Special Installation Instructions: None