Repository navigation
Description
System: OSX 10.10.5
Tried with latest docker-machine and Docker for Mac
TC version 1.1.7
HW:
Model Name: MacBook Pro
Model Identifier: MacBookPro11,5
Processor Name: Intel Core i7
Processor Speed: 2,5 GHz
Number of Processors: 1
Total Number of Cores: 4
L2 Cache (per Core): 256 KB
L3 Cache: 6 MB
Memory: 16 GB
Problem: When running parallel selenium tests with gradle (4 forks), sometimes tests leave containers running even though in shutdown hooks I do stop them. Mostly the problem happens with BrowserWebDriverContainer, but sometimes other GenericContainer's are showing the same behaviour. The problem can't be reproduced when single tests are run, so it's kind of difficult to debug. Only when I run all tests in parallel "ghost" browser containers start piling up after 5 minutes or so and I have to kill them manually from command line (if I don't them my tests will start failing and new containers fail to start). I know this is a very vague way to report a problem, but maybe someone can give me a hint on where to start with debugging. At this point I'm stuck and out of ideas.
docker info:
Containers: 7
Running: 7
Paused: 0
Stopped: 0
Images: 11
Server Version: 1.12.4-rc1
Storage Driver: aufs
Root Dir: /mnt/sda1/var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 107
Dirperm1 Supported: true
Logging Driver: json-file
Plugins:
Volume: local
Network: null bridge host overlay
Kernel Version: 4.4.36-boot2docker
Operating System: Boot2Docker 1.12.4-rc1 (TCL 7.2); HEAD : 2a30a73 - Thu Dec 8 18:24:06 UTC 2016
OSType: linux
Architecture: x86_64
CPUs: 7
Total Memory: 7.789 GiB
Name: default
ID: HPQP:JBG2:NSWF:IUFQ:5QTM:CMOY:WQK5:OSKY:OBTV:ZIKS:T5AD:FVSA
Debug mode (server): true
File Descriptors: 63
Goroutines: 57
System Time: 2016-12-09T20:26:44.574994251Z
EventsListeners: 0
Init SHA1:
Init Path:
Docker Root Dir: /mnt/sda1/var/lib/docker
Labels:
provider=virtualbox
Activity
rnorth commentedon Dec 9, 2016
pavelpp commentedon Dec 9, 2016
These are forked JVM's. Tests are started like this:
Can't really share the repo. Logs - will try to get.
pavelpp commentedon Dec 10, 2016
I noticed timezone is incorrect in my browser container. Is there a way to set correct timezone via testcontainers?
bsideup commentedon Dec 10, 2016
@rnorth this is my colleague, I'll try to debug his project since I have an access to the project:)
Maybe you have some ideas what to check?
FYI: the project is based on Cucumber, all container management is done manually (not with JUnit rules), I suspect it to be an issue.
rnorth commentedon Dec 10, 2016
pavelpp commentedon Dec 10, 2016
@after("@web")
cleanup method is invoked after every scenario with tag @web. I suspect that the problem might be in how container is started. Is it possible that start() method somehow starts two copies of the container, thus stop() method will only stop the last copy? I'm not getting any errors when stopping containers.
Yesterday experimented with this instead of calling stop():
same result. No change, so my only theory is that sometimes two browser containers are started with one start() method, leaving one of them orphaned, until all tests finish running
pavelpp commentedon Dec 11, 2016
Regarding timezones. I did not set any timezone myself, maybe that was the issue, but it's not documented anywhere. I've added
browserContainer.withEnv("TZ", "Europe/Helsinki")and now time seems to be correct.pavelpp commentedon Dec 12, 2016
Case closed. Problem with orphaned containers boiled down to me not calling driver.quit() before stopping container. Still don't quite understand why this is necessary though.
rnorth commentedon Dec 12, 2016
pavelpp commentedon Dec 12, 2016
After further investigation I still face the issue. Tracked the problem down to simultaneous initialization of browser in several parallel tests. Sometimes (randomly) one of the started instances is not going the usual route (I rename containers at start, adding "browser" prefix). And for some reason this very container it is not getting stopped after test is over. As I have lots of tests and each of them starts new browser container, during an hour or so such orphaned containers keep piling up. I've run the same sub-set of tests multiple times and sometimes they create containers as expected - sometimes not. It's random, but I suspect it has something to do with timing of browser container creation.
This is how I create container:
Am I doing it wrong?