-
Type:
Bug
-
Resolution: Done
-
Priority:
Trivial - P5
-
None
-
Affects Version/s: 3.0.2
-
Component/s: mongodump
-
None
-
Environment:Windows Server 2012 R2.
Azure D1 Instance
When using mongorestore from command line it works flawlessly for a given database.
Cmd : mongodump.exe /db my-db-name /o some-path
Upon automating the call to the binary via a C# Process it would hang after a few collections.
This hanging only occours to v3.0+ Older v2 binariers work fine.
There are a number of way to execute external C# process, the notable different is when the call to the process is either a blocking call or not.
When executing a blocking Process.Start(), and waiting for the process to end before reading StdOut/Err via :
var stdOut = Process.StandardOutput.ReadToEnd();
var stdErr = Process.StandardError.ReadToEnd();
As I mentioned above, this worked with v2 binaries.
I've resolved it by using a non-blocking tread to start the process; passing delegates the read StdOut/Err as mongodump writes to the StdIO buffers.
It appears that the windows mongodump.exe binaries require the StdOut buffer to be read before continuing/compleating the dump.