Project

Profile

Help

Bug #2772

Static variable environ resetting its value to zero and crashes Python test

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

Status:
Closed
Priority:
Normal
Category:
C++ API
Start date:
2016-06-03
Due date:
% Done:

100%

Found in version:
1.0.1
Fixed in version:
1.0.2

Description

The static variable environ is being reset to zero in multi-threaded applications. Reproduced in a python test: testXPathSingle.

Bug issue started in https://saxonica.plan.io/boards/4/topics/6413:

The problem and solution to this problem is described here: http://stackoverflow.com/questions/4448296/static-variable-resetting-its-value-to-0-on-its-own-apparently

The variable is identified as static:

static sxnc_environment * environ;

which means each compilation unit will get its own copy of the variable. Instead it should be declare with extern in the header file:

extern static sxnc_environment * environ;

and initialise it in the implementation file

sxnc_environment * SaxonProcessor::environ = 0;

History

#1 Updated by O'Neil Delpratt over 2 years ago

  • Status changed from In Progress to Resolved
  • % Done changed from 0 to 100

The same fix should be applied to the static variable jvmCreatedCPP.

Bug fixed and committed to subversion

#2 Updated by O'Neil Delpratt over 2 years ago

The initial fix did not work because you cannot mix extern and static in C++. I reverted back to using static variables.

The fix was to make the method getStringValue in XdmItem as virtual.

#3 Updated by O'Neil Delpratt over 2 years ago

  • Fixed in version set to 1.0.2

Bug fix applied in the Saxon/C 1.0.2 maintenance release

#4 Updated by O'Neil Delpratt over 2 years ago

  • Status changed from Resolved to Closed

Please register to edit this issue

Also available in: Atom PDF