Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Pipelines intermittently fails to connect to defined Mongo service

Rob Wilson
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 1, 2019

In our pipeline we have two defined services, MongoDB and Redis.

 

Our first step is our backend tests which interact with both these services.

 

Approximately 20% of the time the step fails with: `MongoError: failed to connect to server [localhost:27017] on first connect` and I have to manually re-run the failed step.

In the screenshot below, multiple tests had already passed which created and closed connections to Mongo, only for it to fail later on. Other times it fails immediately.

Screenshot 2019-08-01 at 11.30.46.png

 

pipelines:
default:
- step:
name: Server Test
image: <redacted>
script:
- cd express
- echo $dotenv | base64 -d > .env
- npm install
- npm test
services:
- mongo
- redis
- <other steps redacted>
definitions:
services:
mongo:
image: mongo
redis:
image: redis

Has anyone else come accross this issue? 

1 answer

0 votes
Peter Plewa
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 2, 2019

Hi @Rob Wilson

Could you upload full logs for both your mongo service and script? 

If mongo successfully starts all the time it looks like a race condition that you may be able to workaround by either adding additional checks in your script to see if it's up or adding delays.

Thanks,
Peter

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events