We’re having the same issue - mongo sometimes fails to finish booting in circleci.
One note - the error you posted doesn’t seem to be related to the issue, it happens during successful runs too (check the successful job you posted https://circleci.com/gh/prisma/prisma/5154)
Error saving history file: FileOpenFailed: Unable to open() file /home/mongodb/.dbshell: Unknown error
During failed runs, the mongo container logs stop here:
2019-05-02T12:25:38.915+0000 I CONTROL [signalProcessingThread] shutting down with code:0
Whereas successful runs include the same output as failed runs but continue from there:
2019-04-30T17:54:14.965+0000 I CONTROL [signalProcessingThread] shutting down with code:0
MongoDB init process complete; ready for start up.
2019-04-30T17:54:15.992+0000 I CONTROL [initandlisten] MongoDB starting : pid=7 port=27017 dbpath=/data/db 64-bit host=a3bbefded09f
2019-04-30T17:54:15.992+0000 I CONTROL [initandlisten] db version v3.6.12
I can’t link to our jobs since they’re private but we’re having the exact same problem. Using mongo:4.1, also tried mongo:4.0. It started happening intermittently some time in the past couple weeks and we could get around it by re-running workflows until they passed. As of yesterday it’s been happening consistently.
Do you mean it is not intermittent for you? Log a support ticket at support@circleci.com and describe the problem in detail, including links to failed builds. A non-intermittent example will be helpful for engineers to see what the issue is.
This is a bit confusing - your image that worked is circleci/mongo:3 and your image that failed uses mongo:4. They are obviously not the same images - do you have example links where the image was the same, but the results were different?
I’m not entirely convinced this is related to that issue though since prior successful runs log save errors as well.
In order to mitigate this, I removed the MONGO_INITDB_ROOT_USERNAME and MONGO_INITDB_ROOT_PASSWORD env vars so that the mongo container wouldn’t attempt to create a user and would init an auth-less db - my usecase doesn’t truly require an auth-ed db (tests which leverage a temp mongo db).
I did attempt to manually create a root db user in CI but couldn’t re-authenticate connections with it so I’m not sure whats going on there.
For anyone interested in trying it:
- run:
name: Create Mongo Super user
command: |
mongo --eval 'db.createUser({ user: "user", pwd: "password", roles: [ { role: "root", db: "admin" } ] });'
mongo -u user -p password --authenticationDatabase admin --eval 'db.getUsers()' # THIS FAILS
It may be worth logging this as a specific support issue. I can’t see that anyone has logged it from this thread, and I wonder if it might not get looked at without a ticket.