[GODRIVER-1115] Mongodb socket: permission denied in Golang_workspace Created: 06/Jun/19  Updated: 27/Oct/23  Resolved: 01/Jul/19

Status: Closed
Project: Go Driver
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: anwar h Assignee: Run Tian Yu (Inactive)
Resolution: Gone away Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Hi,

We are facing an permission denied error with mongodb while connecting the db from Golang_workspace.

But using the same mongo db string, we can able to access other application without any issue. Only from Golang_workspace, we are getting this error. Please let us know,  any Go lang package compatability is casuing this issue.

Please find the error below:

root@ip:#gopherjs run main.go
gopherjs: Source maps disabled. Install source-map-support module for nice stack traces. See https://github.com/gopherjs/gopherjs#gopherjs-run-gopherj
s-test. |
Cancel !!! |
This is result 51
DB connection success !!!
warning: system calls not available, see https://github.com/gopherjs/gopherjs/blob/master/doc/syscalls.md
2019/06/06 14:26:01 server selection error: server selection timeout
current topology: Type: Unknown
Servers:
Addr: ip:27017, Type: Unknown, State: Connected, Average RTT: 0, Last error: connection() : dial tcp ip:27017: socket: permission denied



 Comments   
Comment by Run Tian Yu (Inactive) [ 12/Jun/19 ]

Hi anwar@spikecloud.com, are you able to make a  connection to your server using net.Dial instead of the Go driver? Something similar to

conn, err := net.Dial("tcp", "localhost:27017")

Additionally, could you provide us with your file so we can reproduce the error ourselves?

Comment by anwar h [ 12/Jun/19 ]

Hi Connie,

Please let us know,

1) Whether you want to know the installation steps or error which we are getting while executing the goperjs run command.

root@ip:#gopherjs run main.go
gophers: Source maps disabled. Install source-map-support module for nice stack traces. See https://github.com/gopherjs/gopherjs#gopherjs-run-gopherjs-test.
Cancel !!!
This is result 51
DB connection success !!!
2019/06/11 06:43:05 server selection error: server selection timeout
current topology: Type: Unknown
Servers:
Addr: ip:27017, Type: Unknown, State: Connected, Average RTT: 0, Last error: connection() : dial tcp ip:27017: setsockopt: bad address

2) Regarding the server connection outside of the Go driver, whether we need to open the Go driver port to the mongodb servers or you are telling about the mongodb port need to be opened to this godriver server.

If mongodb means already we have opened mongodb port to this  Go driver server

 

Comment by Run Tian Yu (Inactive) [ 11/Jun/19 ]

Hi anwar@spikecloud.com, to further assist you with this issue could you:

  1. provide a reproduction of this error
  2. ensure that you are able to make a server connection outside of the Go driver
Comment by anwar h [ 11/Jun/19 ]

Hi Connie,

On the server, we are using a node version: 10 only.

root@ip:# node -v
v10.16.0

Now we have installed system calls module, Post installing the system calls module, when we run the main.go application. we are getting the setsockopt: bad address error.

root@ip:#gopherjs run main.go
gophers: Source maps disabled. Install source-map-support module for nice stack traces. See https://github.com/gopherjs/gopherjs#gopherjs-run-gopherjs-test.
Cancel !!!
This is result 51
DB connection success !!!
2019/06/11 06:43:05 server selection error: server selection timeout
current topology: Type: Unknown
Servers:
Addr: ip:27017, Type: Unknown, State: Connected, Average RTT: 0, Last error: connection() : dial tcp ip:27017: setsockopt: bad address

 

 

Comment by Run Tian Yu (Inactive) [ 10/Jun/19 ]

Hi anwar@spikecloud.com, the socket permission denied error is a result of syscalls not being available. Please ensure that you are running Node.js (v10.0.0 or newer) and have installed the system calls module, as mentioned [here|https://github.com/gopherjs/gopherjs/blob/master/doc/syscalls.md]. As a side note, we do not officially support GopherJS.

Comment by anwar h [ 10/Jun/19 ]

Hi Connie, Kindly provide a solution on permission denied error with MongoDB while connecting the DB from Golang_workspace.

Comment by anwar h [ 07/Jun/19 ]

Hi Connie, currently we are running this application in ubuntu 16 infra, whether we need to compile the syscalls for this application

Comment by Run Tian Yu (Inactive) [ 06/Jun/19 ]

Hi anwar@spikecloud.com, can you give us some more information about the environment this is running in? As per https://github.com/gopherjs/gopherjs/blob/master/doc/syscalls.md, syscalls are not available when running in browsers.

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