Project

Profile

Help

Bug #3977

closed

XdmAtomicValue problems when deleting object - JET RUNTIME HAS DETECTED UNRECOVERABLE ERROR

Added by O'Neil Delpratt over 5 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Category:
C++ API
Start date:
2018-10-15
Due date:
% Done:

100%

Estimated time:
Found in version:
1.1.0
Fixed in version:
1.1.2
Platforms:

Description

Reported by user:

It appears that under certain conditions that the creation of XdmAtomicValue i.e. via makeStringValue() function on the SaxonProcessor once this function is called, a subsequent call to SaxonProcessor's release() will reliably cause the crash, if the XdmAtomicValue instance is not destroyed first.

#include "../saxonpy/include/saxon/SaxonProcessor.h"
#include "../saxonpy/include/saxon/XdmAtomicValue.h"
#include <iostream>
#include <memory>
using namespace std;


void saxon_cpp()
{
    cout << "CPP Creating Saxon Processor\n";
    shared_ptr<SaxonProcessor> sp( new SaxonProcessor(true) );

    cout << "CPP Making String Value\n";
    // **** REMOVE BRACES FOR ERROR ****
    {
        shared_ptr<XdmAtomicValue> msv( sp->makeStringValue("Some String") );
    }
    cout << "CPP Releasing Saxon Processor\n";
    SaxonProcessor::release();

    return;
}



int main()
{
    saxon_cpp();
    return 0;
}

Output:

CPP Creating Saxon Processor
Library length: 15
Env length: 8
dllname length alloc: 24
resources length alloc: 20
size of dllname 23
dllName: /usr/lib/libsaxoneec.so
resources_dir: /usr/lib/saxon-data
size of resources dir 19
/usr/lib/libsaxoneec.so loaded
initJavaRT - load Saxon/C library
: Success
Class net/sf/saxon/Version found
Class net/sf/saxon/s9api/Processor found
Class net/sf/saxon/option/cpp/SaxonCAPI found
Class net/sf/saxon/s9api/XdmAtomicValue found
CPP Making String Value
CPP Releasing Saxon Processor

JET RUNTIME HAS DETECTED UNRECOVERABLE ERROR: system exception at 0x0000000000000000
Please, contact the vendor of the application.
Core dump will be piped to "/usr/share/apport/apport %p %s %c %d %P"
Extra information about error is saved in the "jet_err_25486.txt" file.

Fatal Error: Crash during termination.
Aborted (core dumped)

If I run the program using gdb and handle the SIG35 error with the following command:

gdb ./testValidator
(gdb) handle SIG35 noprint nostop
(gdb) run
(gdb) bt

Output:

#0  0x0000000000000000 in ?? ()
#1  0x00000000004073da in JNIEnv_::DeleteLocalRef (this=0x882d90, obj=0x7ffaf54b16f9)
    at ../../Saxon.C.API/jni.h:851
#2  0x00000000004152c4 in XdmItem::~XdmItem (this=0xb97e70, __in_chrg=<optimised out>)
    at ../../Saxon.C.API/XdmItem.h:30
#3  0x0000000000416a93 in XdmAtomicValue::~XdmAtomicValue (this=0xb97e70, 
    __in_chrg=<optimised out>) at ../../Saxon.C.API/XdmAtomicValue.h:30
#4  0x0000000000416ac8 in XdmAtomicValue::~XdmAtomicValue (this=0xb97e70, 
    __in_chrg=<optimised out>) at ../../Saxon.C.API/XdmAtomicValue.h:34
#5  0x0000000000419fc8 in std::_Sp_counted_ptr<XdmAtomicValue*, (__gnu_cxx::_Lock_policy)2>::_M_dispose (this=0xb97ef0) at /usr/include/c++/5/bits/shared_ptr_base.h:374
#6  0x0000000000419b7a in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release
    (this=0xb97ef0) at /usr/include/c++/5/bits/shared_ptr_base.h:150
#7  0x0000000000419aa7 in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count (this=0x7fffffffdd78, __in_chrg=<optimised out>)
    at /usr/include/c++/5/bits/shared_ptr_base.h:659
#8  0x0000000000419a3a in std::__shared_ptr<XdmAtomicValue, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr (this=0x7fffffffdd70, __in_chrg=<optimised out>)
    at /usr/include/c++/5/bits/shared_ptr_base.h:925
#9  0x0000000000419a56 in std::shared_ptr<XdmAtomicValue>::~shared_ptr (
    this=0x7fffffffdd70, __in_chrg=<optimised out>)
    at /usr/include/c++/5/bits/shared_ptr.h:93
#10 0x0000000000419922 in saxon_cpp () at testValidator.cpp:203
#11 0x0000000000419988 in main () at testValidator.cpp:213

Please register to edit this issue

Also available in: Atom PDF