Project

Profile

Help

Bug #2772

closed

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

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

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

100%

Estimated time:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Found in version:
1.0.1
Fixed in version:
1.0.2
SaxonC Languages:
SaxonC Platforms:
SaxonC Architecture:

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;

Please register to edit this issue

Also available in: Atom PDF