Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


Please review the below master fix for backporting to libreoffice-3-5. (I actually first encountered the problem on the LO 3.5 codeline.)

The below master commit will not cleanly apply to libreoffice-3-5 (at least not to libreoffice-3-5-4, where I tried it), so find attached an adapted 0001-Revert-fix-for-i86306-prepare-against-really-broken-.patch.

Thanks,
Stephan

On 05/18/2012 09:12 PM, Stephan Bergmann wrote:
  vcl/unx/generic/printer/cupsmgr.cxx |   76 +++++++-----------------------------
  1 file changed, 15 insertions(+), 61 deletions(-)

New commits:
commit ef48b58387fdc04050c3362440ffe3ca0037d8d0
Author: Stephan Bergmann<sbergman@redhat.com>
Date:   Fri May 18 20:52:15 2012 +0200

     Revert fix for "#i86306# prepare against really broken CUPS installations..."

     ...from 8046a87ecc879651ee9cf344211cdd198a419cab.  At least sometimes in
     sw_complex test (with various bundled Java extensions enabled) under load, this
     code reports "Signal 11 during cups initialization called, ignoring cups" and
     in-process JVM aborts in panic.  Looks like a legitimate SIGSEGV (to be
     translated into java.lang.NullPointerException) from JVM code is erroneously
     caught by the temporary lcl_signal_action in cupsmgr.cxx instead.  As there is
     no non-cooperative way to have different signal handlers for different threads
     (at least under POSIX), and
     <https://issues.apache.org/ooo/show_bug.cgi?id=86306>  "office crashes at startup
     on Solaris Intel" suggests this signal-catching business is only there to work
     around a completely broken machine, I think it is best to simply remove it
     again.

     Change-Id: I55b95a71d622f83c975989a4ffb1d95ef5737075

diff --git a/vcl/unx/generic/printer/cupsmgr.cxx b/vcl/unx/generic/printer/cupsmgr.cxx
index a0e020a..0f45b46 100644
--- a/vcl/unx/generic/printer/cupsmgr.cxx
+++ b/vcl/unx/generic/printer/cupsmgr.cxx
@@ -43,8 +43,6 @@
  #include "rtl/ustrbuf.hxx"

  #include<algorithm>
-#include<setjmp.h>
-#include<signal.h>

  #define CUPS_LIB_NAME "libcups.so.2"

@@ -442,17 +440,6 @@ void CUPSManager::runDestThread( void* pThis )
      ((CUPSManager*)pThis)->runDests();
  }

-static sigjmp_buf aViolationBuffer;
-
-extern "C"
-{
-    static void lcl_signal_action(int nSignal)
-    {
-        fprintf( stderr, "Signal %d during cups initialization called, ignoring cups\n", nSignal );
-        siglongjmp( aViolationBuffer, 1 );
-    }
-}
-
  void CUPSManager::runDests()
  {
  #if OSL_DEBUG_LEVEL>  1
@@ -460,62 +447,29 @@ void CUPSManager::runDests()
  #endif
      cups_dest_t* pDests = NULL;

-    // #i86306# prepare against really broken CUPS installations / missing servers
-
-    // install signal handler for SEGV, BUS and ABRT
-    struct sigaction act;
-    struct sigaction oact[3];
-
-    act.sa_handler = lcl_signal_action;
-    act.sa_flags   = 0;
-    sigemptyset(&(act.sa_mask));
-
-    int nSegvSignalInstalled = sigaction(SIGSEGV,&act,&oact[0]);
-    int nBusSignalInstalled = sigaction(SIGBUS,&act,&oact[1]);
-    int nAbortSignalInstalled = sigaction(SIGABRT,&act,&oact[2]);
-
-    // prepare against a signal during FcInit or FcConfigGetCurrent
-    if( sigsetjmp( aViolationBuffer, ~0 ) == 0 )
+    // n#722902 - do a fast-failing check for cups working *at all* first
+    http_t* p_http;
+    if( (p_http=m_pCUPSWrapper->httpConnectEncrypt(
+             m_pCUPSWrapper->cupsServer(),
+             m_pCUPSWrapper->ippPort(),
+             m_pCUPSWrapper->cupsEncryption())) != NULL )
      {
-        // n#722902 - do a fast-failing check for cups working *at
-        // all* first
-        http_t* p_http;
-        if( (p_http=m_pCUPSWrapper->httpConnectEncrypt(
-                 m_pCUPSWrapper->cupsServer(),
-                 m_pCUPSWrapper->ippPort(),
-                 m_pCUPSWrapper->cupsEncryption())) != NULL )
-        {
-            // neat, cups is up, clean up the canary
-            m_pCUPSWrapper->httpClose(p_http);
+        // neat, cups is up, clean up the canary
+        m_pCUPSWrapper->httpClose(p_http);

-            int nDests = m_pCUPSWrapper->cupsGetDests(&pDests );
+        int nDests = m_pCUPSWrapper->cupsGetDests(&pDests );
  #if OSL_DEBUG_LEVEL>  1
-            fprintf( stderr, "came out of cupsGetDests\n" );
+        fprintf( stderr, "came out of cupsGetDests\n" );
  #endif

-            osl::MutexGuard aGuard( m_aCUPSMutex );
-            m_nDests = nDests;
-            m_pDests = pDests;
-            m_bNewDests = true;
+        osl::MutexGuard aGuard( m_aCUPSMutex );
+        m_nDests = nDests;
+        m_pDests = pDests;
+        m_bNewDests = true;
  #if OSL_DEBUG_LEVEL>  1
-            fprintf( stderr, "finished cupsGetDests\n" );
+        fprintf( stderr, "finished cupsGetDests\n" );
  #endif
-        }
      }
-    else
-    {
-        #if OSL_DEBUG_LEVEL>  1
-        fprintf( stderr, "cupsGetDests crashed, not using CUPS\n" );
-        #endif
-    }
-
-    // restore old signal handlers
-    if( nSegvSignalInstalled == 0 )
-        sigaction( SIGSEGV,&oact[0], NULL );
-    if( nBusSignalInstalled == 0 )
-        sigaction( SIGBUS,&oact[1], NULL );
-    if( nAbortSignalInstalled == 0 )
-        sigaction( SIGABRT,&oact[2], NULL );
  }

  void CUPSManager::initialize()
_______________________________________________
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

From 0b8287d198b2603ed781efb40d6d266f529617b8 Mon Sep 17 00:00:00 2001
From: Stephan Bergmann <sbergman@redhat.com>
Date: Fri, 18 May 2012 20:52:15 +0200
Subject: [PATCH] Revert fix for "#i86306# prepare against really broken CUPS
 installations..."

...from 8046a87ecc879651ee9cf344211cdd198a419cab.  At least sometimes in
sw_complex test (with various bundled Java extensions enabled) under load, this
code reports "Signal 11 during cups initialization called, ignoring cups" and
in-process JVM aborts in panic.  Looks like a legitimate SIGSEGV (to be
translated into java.lang.NullPointerException) from JVM code is erroneously
caught by the temporary lcl_signal_action in cupsmgr.cxx instead.  As there is
no non-cooperative way to have different signal handlers for different threads
(at least under POSIX), and
<https://issues.apache.org/ooo/show_bug.cgi?id=86306> "office crashes at startup
on Solaris Intel" suggests this signal-catching business is only there to work
around a completely broken machine, I think it is best to simply remove it
again.

(cherry picked from commit ef48b58387fdc04050c3362440ffe3ca0037d8d0)

Conflicts:

        vcl/unx/generic/printer/cupsmgr.cxx

Change-Id: I55b95a71d622f83c975989a4ffb1d95ef5737075
---
 vcl/unx/generic/printer/cupsmgr.cxx |   76 +++++++----------------------------
 1 files changed, 15 insertions(+), 61 deletions(-)

diff --git a/vcl/unx/generic/printer/cupsmgr.cxx b/vcl/unx/generic/printer/cupsmgr.cxx
index 381478d..3278d3d 100644
--- a/vcl/unx/generic/printer/cupsmgr.cxx
+++ b/vcl/unx/generic/printer/cupsmgr.cxx
@@ -43,8 +43,6 @@
 #include "rtl/ustrbuf.hxx"
 
 #include <algorithm>
-#include <setjmp.h>
-#include <signal.h>
 
 #define CUPS_LIB_NAME "libcups.so.2"
 
@@ -442,17 +440,6 @@ void CUPSManager::runDestThread( void* pThis )
     ((CUPSManager*)pThis)->runDests();
 }
 
-static sigjmp_buf aViolationBuffer;
-
-extern "C"
-{
-    static void lcl_signal_action(int nSignal)
-    {
-        fprintf( stderr, "Signal %d during cups initialization called, ignoring cups\n", nSignal );
-        siglongjmp( aViolationBuffer, 1 );
-    }
-}
-
 void CUPSManager::runDests()
 {
 #if OSL_DEBUG_LEVEL > 1
@@ -460,62 +447,29 @@ void CUPSManager::runDests()
 #endif
     cups_dest_t* pDests = NULL;
 
-    // #i86306# prepare against really broken CUPS installations / missing servers
-
-    // install signal handler for SEGV, BUS and ABRT
-    struct sigaction act;
-    struct sigaction oact[3];
-
-    act.sa_handler = lcl_signal_action;
-    act.sa_flags   = 0;
-    sigemptyset(&(act.sa_mask));
-
-    int nSegvSignalInstalled = sigaction(SIGSEGV, &act, &oact[0]);
-    int nBusSignalInstalled = sigaction(SIGBUS, &act, &oact[1]);
-    int nAbortSignalInstalled = sigaction(SIGABRT, &act, &oact[2]);
-
-    // prepare against a signal during FcInit or FcConfigGetCurrent
-    if( sigsetjmp( aViolationBuffer, ~0 ) == 0 )
+    // n#722902 - do a fast-failing check for cups working *at all* first
+    http_t* p_http;
+    if( (p_http=m_pCUPSWrapper->httpConnectEncrypt(
+             m_pCUPSWrapper->cupsServer(),
+             m_pCUPSWrapper->ippPort(),
+             m_pCUPSWrapper->cupsEncryption())) != NULL )
     {
-        // n#722902 - do a fast-failing check for cups working *at
-        // all* first
-        http_t* p_http;
-        if( (p_http=m_pCUPSWrapper->httpConnectEncrypt(
-                 m_pCUPSWrapper->cupsServer(), 
-                 m_pCUPSWrapper->ippPort(),
-                 m_pCUPSWrapper->cupsEncryption())) != NULL )
-        {
-            // neat, cups is up, clean up the canary
-            m_pCUPSWrapper->httpClose(p_http);
+        // neat, cups is up, clean up the canary
+        m_pCUPSWrapper->httpClose(p_http);
 
-            int nDests = m_pCUPSWrapper->cupsGetDests( &pDests );
+        int nDests = m_pCUPSWrapper->cupsGetDests( &pDests );
 #if OSL_DEBUG_LEVEL > 1
-            fprintf( stderr, "came out of cupsGetDests\n" );
+        fprintf( stderr, "came out of cupsGetDests\n" );
 #endif
 
-            osl::MutexGuard aGuard( m_aCUPSMutex );
-            m_nDests = nDests;
-            m_pDests = pDests;
-            m_bNewDests = true;
+        osl::MutexGuard aGuard( m_aCUPSMutex );
+        m_nDests = nDests;
+        m_pDests = pDests;
+        m_bNewDests = true;
 #if OSL_DEBUG_LEVEL > 1
-            fprintf( stderr, "finished cupsGetDests\n" );
+        fprintf( stderr, "finished cupsGetDests\n" );
 #endif
-        }
     }
-    else
-    {
-        #if OSL_DEBUG_LEVEL > 1
-        fprintf( stderr, "cupsGetDests crashed, not using CUPS\n" );
-        #endif
-    }
-
-    // restore old signal handlers
-    if( nSegvSignalInstalled == 0 )
-        sigaction( SIGSEGV, &oact[0], NULL );
-    if( nBusSignalInstalled == 0 )
-        sigaction( SIGBUS, &oact[1], NULL );
-    if( nAbortSignalInstalled == 0 )
-        sigaction( SIGABRT, &oact[2], NULL );
 }
 
 void CUPSManager::initialize()
-- 
1.7.7.6


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.