[MDEV-5913] Windows: 10.0 crashes on shutdown Created: 2014-03-20 Updated: 2014-03-26 Resolved: 2014-03-26 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | 5.1.67, 5.2.14, 5.3.12, 5.5.36, 10.0.9 |
| Fix Version/s: | 5.5.37, 10.0.10 |
| Type: | Bug | Priority: | Major |
| Reporter: | Sergei Petrunia | Assignee: | Sergei Golubchik |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Windows Server 2012 (only?) |
||
| Description |
|
As reported by Elena: mysqld.exe crashes on shutdown on Windows Server 2012. Maybe, only the debug build is affected. The stacktrace looks like this:
CORRECTION: forgot the first frames in the stack. They are like this:
|
| Comments |
| Comment by Sergei Petrunia [ 2014-03-20 ] | ||||||||||||||||||||
|
Debugging, I see that the crash happens inside this call: pthread_mutex_init(&THR_LOCK_dbug, NULL); pthread_mutex_init translates to InitializeCriticalSection on Windows. InitializeCriticalSection only requires that valid memory is passed to it (which is true). | ||||||||||||||||||||
| Comment by Sergei Petrunia [ 2014-03-20 ] | ||||||||||||||||||||
|
My guess is that we're trying to initialize another critical section where the first critical section is already initialized. MSDN mentions that CRITICAL_SECTION objects cannot be moved in memory, so attempt to initialize one over another may be considered an invalid operation. | ||||||||||||||||||||
| Comment by Sergei Petrunia [ 2014-03-20 ] | ||||||||||||||||||||
|
The following patch makes the crash go away:
When running with the patch, I see: psergey: initing THR_LOCK_dbug (standard messages about MariaDB startup) psergey: freeing THR_LOCK_dbug | ||||||||||||||||||||
| Comment by Sergei Petrunia [ 2014-03-20 ] | ||||||||||||||||||||
|
So, it could be that this particular Windows Server 2012 machine started being picky about programs placing one CRITICAL_SECTION object over another. | ||||||||||||||||||||
| Comment by Elena Stepanova [ 2014-03-20 ] | ||||||||||||||||||||
|
As Sergei found out, the machine had Application Verifier set up for mysqld.exe. It made the machine being picky about this critical section specifics. The crash only happens under verifier on debug builds, both 5.5 and 10.0. I don't know whether the verifier points out at a real problem here – if it does, then it should probably be fixed. If it's just the verifier's whim which does not reveal a code flaw, I suppose it can be left as is. How it happened: | ||||||||||||||||||||
| Comment by Sergei Petrunia [ 2014-03-20 ] | ||||||||||||||||||||
|
serg, please review the fix (assuming fprintfs will be deleted). |