[jira] [Commented] (XERCESC-2165) StdMutexMgr not working properly on VS2013 / Windows 7

2019-01-21 Thread Roger Leigh (JIRA)


[ 
https://issues.apache.org/jira/browse/XERCESC-2165?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16747920#comment-16747920
 ] 

Roger Leigh commented on XERCESC-2165:
--

If you aren't supposed to acquire a lock during DllMain, then isn't this a 
problem in the OpenDSS library due to how it's using Xerces-C++?

I'm not sure why C++11 mutexes would be any different than the original Windows 
implementation, unless there's an implementation defect in VS2013's runtime.  
Both should end up calling Enter/LeaveCriticalSection.  Is it possible to get a 
stack trace with the msvcr120d symbols?  Are they installed as the appropriate 
PDB?

Regarding the release notes, it was ticket XERCESC-2140 which should have been 
closed to include.  I've done so now.

This can certainly be documented as a known issue.  It's certainly the case 
that the CI testing is currently only done for VS2015, with VS2013 and earlier 
left untested.  And we should probably add VS2017.  I would not be averse to 
testing more Visual Studio versions if someone is willing to support them, but 
I don't personally have the time to dedicate to it.

Kind regards,
Roger

> StdMutexMgr not working properly on VS2013 / Windows 7
> --
>
> Key: XERCESC-2165
> URL: https://issues.apache.org/jira/browse/XERCESC-2165
> Project: Xerces-C++
>  Issue Type: Bug
>  Components: Utilities
>Affects Versions: 3.2.2
>Reporter: Andreas Kleber
>Priority: Minor
> Attachments: xerces-hang.png
>
>
> I am building a dynamic library which statically links OpenDSS, which 
> statically links ACE which statically links xerces-c with Visual Studio 2013.
> When I run my application on Windows 7 the loading of my dll hands during 
> static initialization in StdMutexManager::lock(). See attached screenshot.
> On windows 10 the same binaries work as expected.
> I am building xerces 3.2.2 with default parameters as static library with 
> VS2013. During my investigation I found that xerces 3.2.1 works as well as
> specifying the WindowsMutexMgr during configure, because, well, StdMutexMgr 
> was introduced in 3.2.2. Btw, this introduction of a new default Mutex 
> Manager (at least default in my environment) is not mentioned in the release 
> notes. Whould have helped me a lot
> In my environment all test pass on Windows 7 with StdMutexMgr. 
> Additional note: 
> [Microsoft|[https://docs.microsoft.com/en-us/windows/desktop/dlls/dynamic-link-library-best-practices]]
>  recommends not to acquire syncronization during dllmain.
> As Windows 7 and VS 2013 are old and a workaround exists, this issue here is 
> intended as "known issue".



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

-
To unsubscribe, e-mail: c-dev-unsubscr...@xerces.apache.org
For additional commands, e-mail: c-dev-h...@xerces.apache.org



[jira] [Resolved] (XERCESC-2140) Add MutexMgr for C++11 mutex implementation

2019-01-21 Thread Roger Leigh (JIRA)


 [ 
https://issues.apache.org/jira/browse/XERCESC-2140?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Roger Leigh resolved XERCESC-2140.
--
   Resolution: Fixed
Fix Version/s: 3.2.2

Should have been closed for 3.2.2.

> Add MutexMgr for C++11 mutex implementation
> ---
>
> Key: XERCESC-2140
> URL: https://issues.apache.org/jira/browse/XERCESC-2140
> Project: Xerces-C++
>  Issue Type: Improvement
>  Components: Utilities
>Affects Versions: 3.2.1
>Reporter: Roger Leigh
>Assignee: Roger Leigh
>Priority: Major
> Fix For: 3.2.2
>
> Attachments: 0001-StdMutexMgr-Add-C-11-mutex-manager.patch
>
>
> Xalan currently supports two mutex managers: POSIX and Windows (and 
> NoThreads, which doesn't really count).  With the advent of C++11, it's no 
> longer necessary to use platform-specific threading facilities, since it's 
> built directly into the standard library.  The attached patch adds a 
> StdMutexMgr which uses a C++11 mutex, and will work on Unix or Windows 
> systems with a sufficiently new compiler.  thread/mutex were implemented 
> years ago, so all recent and not so recent systems should support it.  For 
> those that don't, it will fall back to the POSIX/Windows managers and behave 
> like before.
>  
> Options have been added to manually select the desired manager as for other 
> options for both cmake and autoconf (standard/posix/windows/nothreads).  
> Documented in more detail on the build page.
>  
> It's tested on Linux/MacOS X/Windows with a variety of manager combinations, 
> and all looks fine so far.  Any testing/comments much appreciated.  It's a 
> compatible addition, so could go into 3.2.2 if that's acceptable, otherwise 
> could wait for later.
>  
> Looking at all of the manager implementations, one key defect (likely 
> intentional design), is that there is zero exception safety.  No currently 
> held mutex will be released if an exception gets thrown.  That could be 
> prevented by moving to using C++11 threading entirely, and using 
> std::lock_guard, which will automatically release locks on unwind.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

-
To unsubscribe, e-mail: c-dev-unsubscr...@xerces.apache.org
For additional commands, e-mail: c-dev-h...@xerces.apache.org



[jira] [Created] (XERCESC-2165) StdMutexMgr not working properly on VS2013 / Windows 7

2019-01-21 Thread Andreas Kleber (JIRA)
Andreas Kleber created XERCESC-2165:
---

 Summary: StdMutexMgr not working properly on VS2013 / Windows 7
 Key: XERCESC-2165
 URL: https://issues.apache.org/jira/browse/XERCESC-2165
 Project: Xerces-C++
  Issue Type: Bug
  Components: Utilities
Affects Versions: 3.2.2
Reporter: Andreas Kleber
 Attachments: xerces-hang.png

I am building a dynamic library which statically links OpenDSS, which 
statically links ACE which statically links xerces-c with Visual Studio 2013.
When I run my application on Windows 7 the loading of my dll hands during 
static initialization in StdMutexManager::lock(). See attached screenshot.
On windows 10 the same binaries work as expected.

I am building xerces 3.2.2 with default parameters as static library with 
VS2013. During my investigation I found that xerces 3.2.1 works as well as
specifying the WindowsMutexMgr during configure, because, well, StdMutexMgr was 
introduced in 3.2.2. Btw, this introduction of a new default Mutex Manager (at 
least default in my environment) is not mentioned in the release notes. Whould 
have helped me a lot

In my environment all test pass on Windows 7 with StdMutexMgr. 
Additional note: 
[Microsoft|[https://docs.microsoft.com/en-us/windows/desktop/dlls/dynamic-link-library-best-practices]]
 recommends not to acquire syncronization during dllmain.

As Windows 7 and VS 2013 are old and a workaround exists, this issue here is 
intended as "known issue".



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

-
To unsubscribe, e-mail: c-dev-unsubscr...@xerces.apache.org
For additional commands, e-mail: c-dev-h...@xerces.apache.org