[libreoffice/f16] Resolves: rhbz#661738 Very slow java database operations: Attach/DetachCurrentThread
sbergmann
sbergmann at fedoraproject.org
Fri Jan 13 10:45:46 UTC 2012
commit 2a5130113395cfa7367002542f556ea0e5c7ce96
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri Jan 13 11:45:22 2012 +0100
Resolves: rhbz#661738 Very slow java database operations: Attach/DetachCurrentThread
...C-driver-to-thread-affine-apartment-for-J.patch | 41 ++++++++++++++++++++
libreoffice.spec | 6 ++-
2 files changed, 46 insertions(+), 1 deletions(-)
---
diff --git a/0001-Confine-JDBC-driver-to-thread-affine-apartment-for-J.patch b/0001-Confine-JDBC-driver-to-thread-affine-apartment-for-J.patch
new file mode 100644
index 0000000..d6b3124
--- /dev/null
+++ b/0001-Confine-JDBC-driver-to-thread-affine-apartment-for-J.patch
@@ -0,0 +1,41 @@
+From cf428b66d5779cbbbb08846ae526a9a5f1043863 Mon Sep 17 00:00:00 2001
+From: Stephan Bergmann <sbergman at redhat.com>
+Date: Fri, 13 Jan 2012 11:38:24 +0100
+Subject: [PATCH] Confine JDBC driver to thread-affine apartment for Java 6
+ performance
+
+... so that the massive number of the JDBC driver's calls to JNI Attach/Detach-
+CurrentThread are guaranteed not to happen on the main thread (where they are
+extremely expensive, see
+<http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6978641> "Fix for 6929067
+introduces additional overhead in thread creation/termination paths").
+
+(cherry-picked from <http://cgit.freedesktop.org/libreoffice/core/commit/?id=bb59742bcf4883af5876a2ffadcc4a689e414b60>)
+---
+ connectivity/source/drivers/jdbc/jservices.cxx | 10 +++++++++-
+ 1 files changed, 9 insertions(+), 1 deletions(-)
+
+diff --git a/connectivity/source/drivers/jdbc/jservices.cxx b/connectivity/source/drivers/jdbc/jservices.cxx
+index aebe76b..1a438be 100644
+--- a/connectivity/source/drivers/jdbc/jservices.cxx
++++ b/connectivity/source/drivers/jdbc/jservices.cxx
+@@ -93,7 +93,15 @@ component_getImplementationEnvironment(
+ uno_Environment ** /*ppEnv*/
+ )
+ {
+- *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
++ // Recent Java 6 VMs make calls to JNI Attach/DetachCurrentThread (which
++ // this code does extensively) very expensive. A follow-up JVM fix reduced
++ // the overhead significantly again for all threads but the main thread. So
++ // a quick hack to improve performance of this component again is to confine
++ // it in the affine apartment (where all code will run on a single,
++ // dedicated thread that is guaranteed no to be the main thread). However,
++ // a better fix would still be to redesign the code so that it does not call
++ // Attach/DetachCurrentThread so frequently:
++ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME ":affine";
+ }
+
+ //---------------------------------------------------------------------------------------
+--
+1.7.7.5
+
diff --git a/libreoffice.spec b/libreoffice.spec
index 8e5875d..c064e89 100644
--- a/libreoffice.spec
+++ b/libreoffice.spec
@@ -135,6 +135,7 @@ Patch36: 0001-Resolves-rhbz-767708-avoid-SIGBUS-writing-to-overcom.patch
Patch37: 0001-sw-fdo-39159-fdo-40482-temp-selection-print-doc.patch
Patch38: 0001-smath-does-not-handle-accents-in-MathML.patch
Patch39: 0001-fix-writing-of-strings-from-the-first-module.patch
+Patch40: 0001-Confine-JDBC-driver-to-thread-affine-apartment-for-J.patch
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%define instdir %{_libdir}
@@ -818,6 +819,7 @@ mv -f redhat.soc extras/source/palettes/standard.soc
%patch37 -p1 -b .fdo39159-fdo40482-temp-selection-print-doc.patch
%patch38 -p1 -b .smath-does-not-handle-accents-in-MathML.patch
%patch39 -p1 -b .fix-writing-of-strings-from-the-first-module.patch
+%patch40 -p1 -b .Confine-JDBC-driver-to-thread-affine-apartment-for-J.patch
# these are horribly incomplete--empty translations and copied english
# strings with spattering of translated strings
@@ -2129,9 +2131,11 @@ update-desktop-database %{_datadir}/applications &> /dev/null || :
%endif
%changelog
-* Thu Jan 12 2012 David Tardon <dtardon at redhat.com> - 3.4.4.2-8-UNBUILT
+* Fri Jan 13 2012 David Tardon <dtardon at redhat.com> - 3.4.4.2-8-UNBUILT
- Resolves: rhbz#771108 English menu in writer despite installation of
libreoffice-langpack-de
+- Resolves: rhbz#661738 Very slow java database operations:
+ Attach/DetachCurrentThread
* Fri Jan 06 2012 Caolán McNamara <caolanm at redhat.com> - 3.4.4.2-7
- Resolves: fdo#40482 Writer view options destroyed by printing
More information about the scm-commits
mailing list