0 Replies Latest reply: Jan 31, 2013 12:40 PM by wp416
wp416 Level 1 (0 points)

The bonjour client on Windows is shipped as Bonjour Print Services for windows, and consists of two services, one printing specific, and one a general

bonjour zeroconf "mdnssd"  implementation.


Since there is no other standard Windows implementation of zeroconf/bonjour on Windows, some third party software vendors including RemObjects Software, that supports zeroconf discovery, uses the Bonjour Client for Windows dll (dnssd.dll) in order to provide zeroconf service discovery features.


I am using this RemObjects software, and I am finding that when I run inside any debug environment, that at DLL unload time, the dnssd.dll is reporting heap corruption.  What I am confused by is that such heap corruption checks are even being done.  (It seems like maybe Apple's developers shipped a debug build instead of a release build?)


here is the message I'm seeing:


HEAP: Free Heap block 028E12C0 modified at 028E12F0 after it was freed


There is also an INT3 (breakpoint) happening, which would cause the application to crash out (if not inside a debugger) or stop (if run inside a debuggger).

This is happening on Windows 8, which might be the underlying issue. There may be some problem in using the currently shipping Bonjour Print Services for Windows which were released in the year 2010, supporting Windows 7, Vista, and XP, when run on Windows 8.


Here is the output if I run in the Visual Studio Debugger, and capture the output, which seems to indicate that there is a race condition between a blocking background thread, and the DLL unloading in the main thread:


The thread 'Win32 Thread' (0x16dc) has exited with code 0 (0x0).

dnssd_clientstub read_all(464) failed -1/28 10038 An operation was attempted on something that is not a socket.The thread 'Win32 Thread' (0x245c) has exited with code 0 (0x0).

The thread 'Win32 Thread' (0x130c) has exited with code 0 (0x0).

First-chance exception at 0x74b64b32 in Server.exe: 0x0EEDFADE: 0xeedfade.

First-chance exception at 0x74b64b32 in Server.exe: 0x0000071A: The remote procedure call was cancelled.

The thread 'Win32 Thread' (0x1d98) has exited with code 0 (0x0).

The thread 'Win32 Thread' (0xfe4) has exited with code 0 (0x0).

'Server.exe': Unloaded 'C:\Windows\SysWOW64\dnssd.dll'

'Server.exe': Unloaded 'C:\Windows\SysWOW64\FWPUCLNT.DLL'

'Server.exe': Unloaded 'C:\Windows\SysWOW64\wtsapi32.dll'


I also see indications of heap corruption like this:


HEAP: Free Heap block 036712C0 modified at 036712F0 after it was freed


Usually one or the other happens, and so, I suspect that we are dealing with a race condition in the code. I am unable to reproduce this on Windows 7, but it always reproduces on Windows 8.


I can provide a small client and server EXE that are simply "demos" of using dnssd.dll on Windows.