Author: markt
Date: Tue Jun 28 14:05:49 2016
New Revision: 1750514

URL: http://svn.apache.org/viewvc?rev=1750514&view=rev
Log:
Correct a potential performance problem identified by Nate Clark due to Tomcat 
Native providing OpenSSL with thread identifiers poorly suited to the hash 
function used by OpenSSL when selecting a bucket for the hash that holds the 
per thread error data.
Tomcat Native on Windows was not affected.
This fix applies to OSX and Linux.
Other platforms may still be affected.

Modified:
    tomcat/native/trunk/native/src/ssl.c
    tomcat/native/trunk/xdocs/miscellaneous/changelog.xml

Modified: tomcat/native/trunk/native/src/ssl.c
URL: 
http://svn.apache.org/viewvc/tomcat/native/trunk/native/src/ssl.c?rev=1750514&r1=1750513&r2=1750514&view=diff
==============================================================================
--- tomcat/native/trunk/native/src/ssl.c (original)
+++ tomcat/native/trunk/native/src/ssl.c Tue Jun 28 14:05:49 2016
@@ -20,6 +20,10 @@
 #include "apr_atomic.h"
 #include "apr_poll.h"
 
+#ifdef __linux__
+#include <sys/syscall.h>
+#endif
+
 #ifdef HAVE_OPENSSL
 #include "ssl_private.h"
 
@@ -420,6 +424,12 @@ static unsigned long ssl_thread_id(void)
     return psaptr->PSATOLD;
 #elif defined(WIN32)
     return (unsigned long)GetCurrentThreadId();
+#elif defined(DARWIN)
+    uint64_t tid;
+    pthread_threadid_np(NULL, &tid);
+    return (unsigned long)tid;
+#elif defined(__linux__)
+    return (unsigned long)syscall(SYS_gettid);
 #else
     return (unsigned long)(apr_os_thread_current());
 #endif

Modified: tomcat/native/trunk/xdocs/miscellaneous/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/native/trunk/xdocs/miscellaneous/changelog.xml?rev=1750514&r1=1750513&r2=1750514&view=diff
==============================================================================
--- tomcat/native/trunk/xdocs/miscellaneous/changelog.xml (original)
+++ tomcat/native/trunk/xdocs/miscellaneous/changelog.xml Tue Jun 28 14:05:49 
2016
@@ -44,6 +44,14 @@
       Correctly handle OS level EAGAIN return codes during non-blocking TLS 
I/O.
       (markt)
     </fix>
+    <fix>
+      Correct a potential performance problem identified by Nate Clark due to
+      Tomcat Native providing OpenSSL with thread identifiers poorly suited to
+      the hash function used by OpenSSL when selecting a bucket for the hash
+      that holds the per thread error data. Tomcat Native on Windows was not
+      affected. A fix has been applied for OSX and Linux. Other platforms may
+      still be affected. (markt/rjung)
+    </fix>
   </changelog>
 </section>
 <section name="Changes in 1.2.7">



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to