Uploaded image for project: 'Xerces-C++'
  1. Xerces-C++
  2. XERCESC-2031

Janitor<BinInputStream>::~Janitor() throws in unwind

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.1.1
    • 3.1.2, 3.2.0
    • Utilities
    • None
    • Solaris 10, x86

    Description

      If PosixFileMgr::fileClose() receives an invalid file handler or if its unable to close a file handler it will throw an exception. If this is done in an unwind of, for example, Janitor<BinInputStream> noone is around to catch that exception before the process is terminated. (Leaving a destructor with a throw during unwind is rewarded with termination of the process)

      This happens when variable "streamJanitor" goes out of scope in ReaderMgr::createReader(...)

      Callstack looks like this:
      [6] std::terminate(0xfeafd2e3, 0xfe7eb940, 0xfc5c5ce8, 0xfe7eb940, 0x0, 0xfe7eb940), at 0xfe7d471f
      [7] __Cimpl::ex_terminate(0xfedf9290, 0xfee69fd0, 0x2, 0xfe7ec658, 0xfe7ec4a0, 0x0), at 0xfe7d4b82
      [8] _ex_throw_body(0xfe7ec658, 0xfeafd2e3, 0xfc5c5d60, 0xfe7d546e), at 0xfe7d5561
      [9] __Crun::ex_throw(0xfe7ec6a4, 0xfed84ab8, 0xfeb04488, 0xfed82da2), at 0xfe7d54ca
      [10] xercesc_3_1::PosixFileMgr::fileClose(this = 0x8f69a18, f = 0xfe3f2d00, manager = 0x8f69618) (optimized), at 0xfed82e40 (line ~81) in "PosixFileMgr.cpp"
      [11] xercesc_3_1::XMLPlatformUtils::closeFile(theFile = 0xfe3f2d00, memmgr = 0x8f69618) (optimized), at 0xfeb021b9 (line ~578) in "PlatformUtils.cpp"
      [12] xercesc_3_1::BinFileInputStream::~BinFileInputStream(this = 0x91df400) (optimized), at 0xfeafd2de (line ~64) in "BinFileInputStream.cpp"
      [13] _SLIP.DELETER_A(this = 0x91df400, delete = 1) (optimized), at 0xfeafd53e (line ~61) in "BinFileInputStream.cpp"
      [14] xercesc_3_1::Janitor<xercesc_3_1::BinInputStream>::reset(this = 0xfc5c5e84, p = (nil)) (optimized), at 0xfec16fd6 (line ~90) in "Janitor.c"
      [15] xercesc_3_1::Janitor<xercesc_3_1::BinInputStream>::~Janitor(this = 0xfc5c5e84) (optimized), at 0xfec166f8 (line ~43) in "Janitor.c"
      [16] xercesc_3_1::ReaderMgr::createReader(this = 0x930a604, src = CLASS, _ARG3 = true, refFrom = RefFrom_NonLiteral, type = Type_General, source = Source_External, calcSrcOfs = false, lowWaterMark = 100U) (optimized), at 0xfec12ee4 (line ~440) in "ReaderMgr.cpp"
      [17] xercesc_3_1::IGXMLScanner::scanReset(this = 0x930a578, src = CLASS) (optimized), at 0xfec08e7c (line ~1275) in "IGXMLScanner2.cpp"
      [18] xercesc_3_1::IGXMLScanner::scanDocument(this = 0x930a578, src = CLASS) (optimized), at 0xfebfb52e (line ~198) in "IGXMLScanner.cpp"
      [19] xercesc_3_1::AbstractDOMParser::parse(this = 0xfc5c6018, source = CLASS) (optimized), at 0xfec67c34 (line ~545) in "AbstractDOMParser.cpp"
      [20] xercesc_3_1::IGXMLScanner::resolveSchemaGrammar(this = 0x9283f68, loc = 0x93c4b3c, uri = 0x93c5020, ignoreLoadSchema = true) (optimized), at 0xfec0a8d0 (line ~1859) in "IGXMLScanner2.cpp"
      [21] xercesc_3_1::IGXMLScanner::parseSchemaLocation(this = 0x9283f68, schemaLocationStr = 0x9627e10, ignoreLoadSchema = true) (optimized), at 0xfec0a0b4 (line ~1727) in "IGXMLScanner2.cpp"
      [22] xercesc_3_1::IGXMLScanner::scanStartTagNS(this = 0x9283f68, gotData = true) (optimized), at 0xfebff71a (line ~2205) in "IGXMLScanner.cpp"
      [23] xercesc_3_1::IGXMLScanner::scanContent(this = 0x9283f68) (optimized), at 0xfebfcb7b (line ~890) in "IGXMLScanner.cpp"
      [24] xercesc_3_1::IGXMLScanner::scanDocument(this = 0x9283f68, src = CLASS) (optimized), at 0xfebfb571 (line ~217) in "IGXMLScanner.cpp"
      [25] xercesc_3_1::AbstractDOMParser::parse(this = 0x92e6e50, source = CLASS) (optimized), at 0xfec67c34 (line ~545) in "AbstractDOMParser.cpp"
      [26] xercesc_3_1::DOMLSParserImpl::parse(this = 0x92e6e50, source = 0xfc5c6718) (optimized), at 0xfec714ce (line ~754) in "DOMLSParserImpl.cpp"

      This applies to WindowsFileMgr as well.
      If additional information is needed I'm happy to provide it.

      Attachments

        Activity

          People

            amassari Alberto Massari
            hogklint Jimmie Högklint
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: