ephemeral-mongo
ephemeral-mongo copied to clipboard
Improve logs when cannot start mongo
When the service cannot start, by default there is no logs only a timeout exception with a generic message.
System.TimeoutException : MongoDB connection availability took longer than the specified timeout of 30 seconds. Consider increasing the value of 'ConnectionTimeout'.
It would be nice to capture the mongo process logs and display them in the exception message. Then, it could discard the logs once the service is ready. Also, it doesn't check if the process exited while waiting for it to start. I think this improvement would simplify debugging.
This would have come in handy with the current SSL version mismatch issues with Ubuntu. https://github.com/asimmon/ephemeral-mongo/issues/51, which leads to https://github.com/asimmon/ephemeral-mongo/issues/48
Also, it doesn't check if the process exited while waiting for it to start.
We could listen to Process.Exited and stop waiting for the readiness checks, like expecting a particular message to appear in stdout.
It would be nice to capture the mongo process logs and display them in the exception message.
Regarding log capture, we've been listening to stdout and stderr from the start and have access to them through MongoRunnerOptions.StandardOutputLogger and MongoRunnerOptions.StandardErrorLogger.
The thing is, MongoDB is quite verbose. This is the log output until the server is ready to receive connections:
https://gist.github.com/asimmon/82cadc9323dca3a71aaac793c0d9d9ed
There’s so much going on, it’s hard to get a clear signal out of the noise. Filtering by severity might help, but I don't have enough data to reproduce the possible issues.
Also, issues with OpenSSL, for instance, happen even before logs are emitted, as shared libraries can't be loaded. Detecting process exit could help early exiting, but I don't know how to gather the necessary information. Again, it requires some time to investigate. I'm open to others digging into this.