[openoffice.org/f14/master] Resolves: rhbz#637738 threading problems with using libgcrypt via neon
Caolan McNamara
caolanm at fedoraproject.org
Mon Sep 27 12:37:00 UTC 2010
commit b6a7fda42d624869b25b0ba1e7c464b3502e2b95
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Sep 27 13:36:57 2010 +0100
Resolves: rhbz#637738 threading problems with using libgcrypt via neon
...ice.org-3.3.0.rh637738.libgcrypt.addmutex.patch | 166 ++++++++++++++++++++
openoffice.org.spec | 8 +-
2 files changed, 173 insertions(+), 1 deletions(-)
---
diff --git a/openoffice.org-3.3.0.rh637738.libgcrypt.addmutex.patch b/openoffice.org-3.3.0.rh637738.libgcrypt.addmutex.patch
new file mode 100644
index 0000000..0d9154c
--- /dev/null
+++ b/openoffice.org-3.3.0.rh637738.libgcrypt.addmutex.patch
@@ -0,0 +1,166 @@
+diff -ru ucb.orig/source/ucp/webdav/NeonHeadRequest.cxx ucb/source/ucp/webdav/NeonHeadRequest.cxx
+--- ucb.orig/source/ucp/webdav/NeonHeadRequest.cxx 2010-09-27 11:08:46.000000000 +0100
++++ ucb/source/ucp/webdav/NeonHeadRequest.cxx 2010-09-27 13:21:17.000000000 +0100
+@@ -156,6 +156,8 @@
+ // Constructor
+ // -------------------------------------------------------------------
+
++extern osl::Mutex aGlobalNeonMutex;
++
+ NeonHeadRequest::NeonHeadRequest( HttpSession* inSession,
+ const rtl::OUString & inPath,
+ const std::vector< ::rtl::OUString > &
+@@ -179,7 +181,10 @@
+ ne_add_response_header_catcher( req, NHR_ResponseHeaderCatcher, &aCtx );
+ #endif
+
+- nError = ne_request_dispatch( req );
++ {
++ osl::Guard< osl::Mutex > theGlobalGuard( aGlobalNeonMutex );
++ nError = ne_request_dispatch( req );
++ }
+
+ #if NEON_VERSION >= 0x0250
+ process_headers(req, ioResource, inHeaderNames);
+diff -ru ucb.orig/source/ucp/webdav/NeonSession.cxx ucb/source/ucp/webdav/NeonSession.cxx
+--- ucb.orig/source/ucp/webdav/NeonSession.cxx 2010-09-27 11:08:46.000000000 +0100
++++ ucb/source/ucp/webdav/NeonSession.cxx 2010-09-27 13:26:01.000000000 +0100
+@@ -118,7 +118,12 @@
+ // -------------------------------------------------------------------
+ // static members!
+ bool NeonSession::m_bGlobalsInited = false;
+-osl::Mutex NeonSession::m_aGlobalMutex;
++//See https://bugzilla.redhat.com/show_bug.cgi?id=544619#c4
++//neon is threadsafe, but uses gnutls which is only thread-safe
++//if initialized to be thread-safe. cups, unfortunately, generally
++//initializes it first, and as non-thread-safe, leaving the entire
++//stack unsafe
++osl::Mutex aGlobalNeonMutex;
+ // -------------------------------------------------------------------
+ // Helper fuction
+ // -------------------------------------------------------------------
+@@ -665,7 +670,10 @@
+ {
+ if ( m_pHttpSession )
+ {
+- ne_session_destroy( m_pHttpSession );
++ {
++ osl::Guard< osl::Mutex > theGlobalGuard( aGlobalNeonMutex );
++ ne_session_destroy( m_pHttpSession );
++ }
+ m_pHttpSession = 0;
+ // Note: Uncomment the following if locking support is required
+ /*
+@@ -691,11 +699,7 @@
+ if ( m_pHttpSession == 0 )
+ {
+ // Ensure that Neon sockets are initialize
+-
+- // --> tkr #151111# crashed if copy and pasted pictures from the internet
+- // ne_sock_init() was executed by two threads at the same time.
+- osl::Guard< osl::Mutex > theGlobalGuard( m_aGlobalMutex );
+- // <--
++ osl::Guard< osl::Mutex > theGlobalGuard( aGlobalNeonMutex );
+ if ( !m_bGlobalsInited )
+ {
+ if ( ne_sock_init() != 0 )
+@@ -730,7 +734,10 @@
+ m_nProxyPort = rProxyCfg.nPort;
+
+ // new session needed, destroy old first
+- ne_session_destroy( m_pHttpSession );
++ {
++ osl::Guard< osl::Mutex > theGlobalGuard( aGlobalNeonMutex );
++ ne_session_destroy( m_pHttpSession );
++ }
+ m_pHttpSession = 0;
+ bCreateNewSession = true;
+ }
+@@ -743,14 +750,15 @@
+ // currently (0.22.0) neon does not allow to pass the user info
+ // to the session
+
+- m_pHttpSession = ne_session_create(
+- rtl::OUStringToOString( m_aScheme,
+- RTL_TEXTENCODING_UTF8 ).getStr(),
+- /* theUri.GetUserInfo(),
+- @@@ for FTP via HTTP proxy, but not supported by Neon */
+- rtl::OUStringToOString( m_aHostName,
+- RTL_TEXTENCODING_UTF8 ).getStr(),
+- m_nPort );
++ {
++ osl::Guard< osl::Mutex > theGlobalGuard( aGlobalNeonMutex );
++ m_pHttpSession = ne_session_create(
++ rtl::OUStringToOString( m_aScheme, RTL_TEXTENCODING_UTF8 ).getStr(),
++ /* theUri.GetUserInfo(),
++ @@@ for FTP via HTTP proxy, but not supported by Neon */
++ rtl::OUStringToOString( m_aHostName, RTL_TEXTENCODING_UTF8 ).getStr(),
++ m_nPort );
++ }
+
+ if ( m_pHttpSession == 0 )
+ throw DAVException( DAVException::DAV_SESSION_CREATE,
+@@ -1316,11 +1324,11 @@
+ void NeonSession::ABORT()
+ throw ( DAVException )
+ {
+- // 11.11.09 (tkr): The following code lines causing crashes if closing a ongoing connection. It turned out that this existing solution doesn't work in multi-threading environments.
+- // So I disabled them in 3.2. . Issue #73893# should fix it in OOo 3.3.
+-
+- //if (NULL !=m_pHttpSession)
+- // ne_close_connection(m_pHttpSession);
++ if (NULL != m_pHttpSession)
++ {
++ osl::Guard< osl::Mutex > theGlobalGuard( aGlobalNeonMutex );
++ ne_close_connection(m_pHttpSession);
++ }
+ }
+
+ // -------------------------------------------------------------------
+@@ -1703,7 +1711,10 @@
+ #endif
+ ne_add_response_body_reader( req, ne_accept_2xx, reader, userdata );
+
+- ret = ne_request_dispatch( req );
++ {
++ osl::Guard< osl::Mutex > theGlobalGuard( aGlobalNeonMutex );
++ ret = ne_request_dispatch( req );
++ }
+
+ #if NEON_VERSION >= 0x0250
+ if ( getheaders )
+@@ -1741,7 +1752,10 @@
+
+ ne_set_request_body_buffer( req, buffer, size );
+
+- ret = ne_request_dispatch( req );
++ {
++ osl::Guard< osl::Mutex > theGlobalGuard( aGlobalNeonMutex );
++ ret = ne_request_dispatch( req );
++ }
+
+ if ( ret == NE_OK && ne_get_status( req )->klass != 2 )
+ ret = NE_ERROR;
+@@ -1786,7 +1800,10 @@
+
+ ne_set_request_body_buffer( req, buffer, strlen( buffer ) );
+
+- ret = ne_request_dispatch( req );
++ {
++ osl::Guard< osl::Mutex > theGlobalGuard( aGlobalNeonMutex );
++ ret = ne_request_dispatch( req );
++ }
+
+ //if ( ctx.error )
+ // ret = NE_ERROR;
+diff -ru ucb.orig/source/ucp/webdav/NeonSession.hxx ucb/source/ucp/webdav/NeonSession.hxx
+--- ucb.orig/source/ucp/webdav/NeonSession.hxx 2010-09-27 11:08:46.000000000 +0100
++++ ucb/source/ucp/webdav/NeonSession.hxx 2010-09-27 13:06:43.000000000 +0100
+@@ -50,7 +50,6 @@
+ {
+ private:
+ osl::Mutex m_aMutex;
+- static osl::Mutex m_aGlobalMutex;
+ rtl::OUString m_aScheme;
+ rtl::OUString m_aHostName;
+ rtl::OUString m_aProxyName;
diff --git a/openoffice.org.spec b/openoffice.org.spec
index d6d75f4..ff8b35e 100644
--- a/openoffice.org.spec
+++ b/openoffice.org.spec
@@ -1,6 +1,6 @@
%define oootag OOO330
%define ooomilestone 8
-%define rh_rpm_release 3
+%define rh_rpm_release 4
# rhbz#465664 jar-repacking breaks help by reordering META-INF/MANIFEST.MF
%define __jar_repack %{nil}
@@ -118,6 +118,7 @@ Patch39: workspace.cmcfixes78.patch
Patch40: openoffice.org-3.3.0.ooo114012.sd.bada11ychain.patch
Patch41: workspace.cmcfixes79.patch
Patch42: openoffice.org-3.3.0.ooo114703.vcl.betterlocalize.font.patch
+Patch43: openoffice.org-3.3.0.rh637738.libgcrypt.addmutex.patch
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%define instdir %{_libdir}
@@ -1648,6 +1649,7 @@ cp -p %{SOURCE5} external/unowinreg/unowinreg.dll
%patch40 -p0 -b .ooo114012.sd.bada11ychain.patch
%patch41 -p1 -b .workspace.cmcfixes79.patch
%patch42 -p1 -b .ooo114703.vcl.betterlocalize.font.patch
+%patch43 -p1 -b .rh637738.libgcrypt.addmutex.patch
%build
echo build start time is `date`, diskspace: `df -h . | tail -n 1`
@@ -3846,6 +3848,10 @@ unopkg remove --shared org.openoffice.legacy.ScriptProviderForPython.zip > /dev/
%endif
%changelog
+* Mon Sep 27 2010 Caolán McNamara <caolanm at redhat.com>- 1:3.3.0-8.4
+- Resolves: rhbz#637738 threading problems with using libgcrypt via neon when
+ libgcrypt which was initialized by cups to be non-thread safe
+
* Thu Sep 23 2010 Caolán McNamara <caolanm at redhat.com>- 1:3.3.0-8.3
- Resolves: rhbz#114703 betterlocalize font name, fixes sluggish
pause in nl_NL autotext load
More information about the scm-commits
mailing list