[SERVER-33483] HTTP detection no longer working Created: 26/Feb/18  Updated: 29/Oct/23  Resolved: 07/Mar/18

Status: Closed
Project: Core Server
Component/s: Networking
Affects Version/s: 3.6.2
Fix Version/s: 3.6.4, 3.7.3

Type: Bug Priority: Major - P3
Reporter: Tim Niemueller Assignee: Jonathan Reams
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v3.6
Steps To Reproduce:
  • Run MongoDB 3.6 from
  • Access localhost:27017 with a web browser or curl

In Docker:

# docker run --rm --name mongotest mongo:3.6

Next console:

# docker exec -ti mongotest bash
# apt-get update
# apt-get install curl
# curl localhost:27017

Actual results:

curl: (56) Recv failure: Connection reset by peer

Expected:

It looks like you are trying to access MongoDB over HTTP on the native driver port.

Sprint: Platforms 2018-03-12
Participants:

 Description   

When accessing MongoDB over HTTP, it returns a simple HTTP response stating that it does not server HTTP:

It looks like you are trying to access MongoDB over HTTP on the native driver port.

This is a nice feature in order to check for principal MongoDB liveness, and we use it, for example, to check whether MongoDB has come up yet in automated experiments running in a Kubernetes cluster (https://github.com/timn/docker-robotics/blob/master/rcll-sim/scripts/run-component#L32).
This used to work with MongoDB 3.4, but does not work anymore with MongoDB 3.6 (using . The server log for each connection request contains something like this:

Error receiving request from client: SSLHandshakeFailed: SSLHandshakeFailed. Ending connection from 127.0.0.1:45380

This is done using the current mongo image from Docker hub.



 Comments   
Comment by Githook User [ 09/Mar/18 ]

Author:

{'email': 'jbreams@mongodb.com', 'name': 'Jonathan Reams', 'username': 'jbreams'}

Message: SERVER-33483 Make sure TransportLayerASIO handles HTTP GET requests correctly
Branch: v3.6
https://github.com/mongodb/mongo/commit/bd6b8fc4e93013ad149f08bc989c24645839c237

Comment by Jonathan Reams [ 07/Mar/18 ]

Author:

{'email': 'jbreams@mongodb.com', 'name': 'Jonathan Reams', 'username': 'jbreams'}

Message: SERVER-33843 Make sure TransportLayerASIO handles HTTP GET requests correctly
Branch: master
https://github.com/mongodb/mongo/commit/540da1228909d58b08c393c3e08f28eb649a1600

Comment by Tim Niemueller [ 01/Mar/18 ]

jonathan.reams, thanks for the update. Looking forward to the backport, happy to test. Can you point me to the code repo or branch with the fix? Curious...

Comment by Jonathan Reams [ 28/Feb/18 ]

timn, yes we are planning on backporting the fix to 3.6. The new transport layer does enable some new async networking features, but they are off-by-default and experimental in 3.6.

Comment by Tim Niemueller [ 27/Feb/18 ]

Hi Jonathan.

Thanks for the quick update. I didn't realize there was a whole new transport layer. That explains it. It is nice if this is added back in place for easy liveness checking with common tools. Is there some documentation on what one looses with switching back to the old transport layer? Is it "just" performance or do some of the newer features depend on it? Will the fix be backported to 3.6?

Comment by Jonathan Reams [ 27/Feb/18 ]

timn, this does appear to be a regression in 3.6. We'll work on fixing it and including the fix in a future release, however there should be a workaround you can use right now. You can start mongod with the legacy transport layer by starting mongod with --transportLayer=legacy or changing it in the config file (see link for details). This change enables the 3.4 networking code and should resolve your issue for now. Please let me know if this doesn't work or if you have any questions.

Comment by Ramon Fernandez Marina [ 26/Feb/18 ]

Thanks for your report, I can reproduce this issue and we're investigating.

Generated at Thu Feb 08 04:33:33 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.