[SERVER-4423] Using MongoDB in the Cygwin shell Created: 03/Dec/11  Updated: 06/Feb/23  Resolved: 06/Feb/23

Status: Closed
Project: Core Server
Component/s: Build
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Minor - P4
Reporter: Tad Marshall Assignee: [DO NOT ASSIGN] Backlog - Server Development Platform Team (SDP) (Inactive)
Resolution: Won't Do Votes: 0
Labels: sdp-backlog-purge
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows running a Cygwin bash shell


Issue Links:
Duplicate
is duplicated by SERVER-2414 no clean shutdown under cygwin bash s... Closed
is duplicated by SERVER-3684 In Cygwin, pressing ^C can terminate ... Closed
Assigned Teams:
Server Development Platform
Participants:
Case:

 Description   

This bug is to collect information and produce decisions and possible action about running MongoDB command line components under the Cygwin bash shell.



 Comments   
Comment by Iryna Zhuravlova [ 16/Nov/22 ]

After a careful backlog refinement, the team decided to close this ticket because of its low priority and limited resource capacity. If you believe that this ticket requires additional attention from the team and should be re-opened, feel free to change the status to "Needs Scheduling" and ping me or alexander.neben@mongodb.com 

Comment by Sergio Castro [ 21/Oct/19 ]

Hi all. In case it helps, I have linked SFSC 00609587, in which there were issues observed when using the mongo shell via Git Bash.

1. When using the standard SRV record connection string, the password prompt does not appear, and therefore authentication fails. The command line outputs Cannot get console mode 6 instead.

$ ./mongo "mongodb+srv://gitbashthree-z01xy.mongodb.net/test"  --username xxxxxxxx
MongoDB shell version v4.0.0
Enter password: Cannot get console mode 6
connecting to: mongodb+srv://gitbashthree-z01xy.mongodb.net/test

2. When including the password in the connection string, the session appears to hang and eventually times out:

$ ./mongo "mongodb+srv://gitbashthree-z01xy.mongodb.net/test"  --username xxxxx -p xxxxx
MongoDB shell version v4.0.0
connecting to: mongodb+srv://gitbashthree-z01xy.mongodb.net/test
2019-10-21T12:43:20.543+1100 I NETWORK  [js] Starting new replica set monitor for gitbashthree-shard-0/gitbashthree-shard-00-00-z01xy.mongodb.net.:27017,gitbashthree-shard-00-01-z01xy.mongodb.net.:27017,gitbashthree-shard-00-02-z01xy.mongodb.net.:27017
2019-10-21T12:43:21.630+1100 I NETWORK  [js] Successfully connected to gitbashthree-shard-00-02-z01xy.mongodb.net.:27017 (1 connections now open to gitbashthree-shard-00-02-z01xy.mongodb.net.:27017 with a 5 second timeout)
2019-10-21T12:43:21.630+1100 I NETWORK  [ReplicaSetMonitor-TaskExecutor] Successfully connected to gitbashthree-shard-00-00-z01xy.mongodb.net.:27017 (1 connections now open to gitbashthree-shard-00-00-z01xy.mongodb.net.:27017 with a 5 second timeout)
2019-10-21T12:43:21.877+1100 I NETWORK  [ReplicaSetMonitor-TaskExecutor] changing hosts to gitbashthree-shard-0/gitbashthree-shard-00-00-z01xy.mongodb.net:27017,gitbashthree-shard-00-01-z01xy.mongodb.net:27017,gitbashthree-shard-00-02-z01xy.mongodb.net:27017 from gitbashthree-shard-0/gitbashthree-shard-00-00-z01xy.mongodb.net.:27017,gitbashthree-shard-00-01-z01xy.mongodb.net.:27017,gitbashthree-shard-00-02-z01xy.mongodb.net.:27017
2019-10-21T12:43:23.005+1100 I NETWORK  [ReplicaSetMonitor-TaskExecutor] Successfully connected to gitbashthree-shard-00-01-z01xy.mongodb.net:27017 (1 connections now open to gitbashthree-shard-00-01-z01xy.mongodb.net:27017 with a 5 second timeout)
2019-10-21T12:43:23.005+1100 I NETWORK  [js] Successfully connected to gitbashthree-shard-00-02-z01xy.mongodb.net:27017 (1 connections now open to gitbashthree-shard-00-02-z01xy.mongodb.net:27017 with a 5 second timeout)
2019-10-21T12:43:24.336+1100 I NETWORK  [js] Successfully connected to gitbashthree-shard-00-00-z01xy.mongodb.net:27017 (1 connections now open to gitbashthree-shard-00-00-z01xy.mongodb.net:27017 with a 5 second timeout)
MongoDB server version: 3.4.23
WARNING: shell and server versions do not match

Comment by Tad Marshall [ 03/Jun/12 ]

The resolution in the ticket referenced above (SERVER-3684) was that when mongod.exe is running in the background by being started with "&" in the cygwin shell, a ctrl-C is delivered to it by cygwin even though it isn't the foreground application. So the server doesn't crash, it shuts down cleanly, but cygwin should not have delivered the ctrl-C to a background application. I'm resolving SERVER-3684 as a "duplicate" of this ticket.

Comment by Tad Marshall [ 06/Dec/11 ]

Thanks, Chris. I've got the bug you posted about crashing the server on my list and it doesn't duplicate in the current code because the shell isn't sending anything on the mistyped command – the parser fails it. But I will try to duplicate it with the version you used and see if the server still falls down on the malformed request.
I'll write up our findings in this bug report and add that information to the Wiki, thanks for testing it.

Comment by Chris Westin [ 06/Dec/11 ]

I finally got a chance to look into this.

Yes, I can confirm what you are seeing, Tad. My shortcut points to c:\cygwin\Cygwin.bat, and that just does a chdir to C:\cygwin\bin, and then issues "bash --login -i". It does not set a CYGWIN environmental variable. So, under those conditions, the shell does appear to work correctly, modulo the incident that triggered this, namely that using a ^C under certain circumstances appears to cause the shell to send a malformed message to the server.

Generated at Thu Feb 08 03:05:56 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.