{"action":"created","issue":{"url":"https://api.github.com/repos/testcontainers/testcontainers-java/issues/253","repository_url":"https://api.github.com/repos/testcontainers/testcontainers-java","labels_url":"https://api.github.com/repos/testcontainers/testcontainers-java/issues/253/labels{/name}","comments_url":"https://api.github.com/repos/testcontainers/testcontainers-java/issues/253/comments","events_url":"https://api.github.com/repos/testcontainers/testcontainers-java/issues/253/events","html_url":"https://github.com/testcontainers/testcontainers-java/issues/253","id":194688650,"number":253,"title":"Containers are not stopped on OSX","user":{"login":"pavelpp","id":4384615,"avatar_url":"https://avatars.githubusercontent.com/u/4384615?v=3","gravatar_id":"","url":"https://api.github.com/users/pavelpp","html_url":"https://github.com/pavelpp","followers_url":"https://api.github.com/users/pavelpp/followers","following_url":"https://api.github.com/users/pavelpp/following{/other_user}","gists_url":"https://api.github.com/users/pavelpp/gists{/gist_id}","starred_url":"https://api.github.com/users/pavelpp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pavelpp/subscriptions","organizations_url":"https://api.github.com/users/pavelpp/orgs","repos_url":"https://api.github.com/users/pavelpp/repos","events_url":"https://api.github.com/users/pavelpp/events{/privacy}","received_events_url":"https://api.github.com/users/pavelpp/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2016-12-09T20:24:40Z","updated_at":"2016-12-12T17:34:43Z","closed_at":"2016-12-12T08:16:44Z","body":"System: OSX 10.10.5\r\nTried with latest docker-machine and Docker for Mac\r\nTC version 1.1.7\r\n\r\nHW:\r\n  Model Name:\tMacBook Pro\r\n  Model Identifier:\tMacBookPro11,5\r\n  Processor Name:\tIntel Core i7\r\n  Processor Speed:\t2,5 GHz\r\n  Number of Processors:\t1\r\n  Total Number of Cores:\t4\r\n  L2 Cache (per Core):\t256 KB\r\n  L3 Cache:\t6 MB\r\n  Memory:\t16 GB\r\n\r\nProblem: 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.\r\n\r\ndocker info:\r\nContainers: 7\r\n Running: 7\r\n Paused: 0\r\n Stopped: 0\r\nImages: 11\r\nServer Version: 1.12.4-rc1\r\nStorage Driver: aufs\r\n Root Dir: /mnt/sda1/var/lib/docker/aufs\r\n Backing Filesystem: extfs\r\n Dirs: 107\r\n Dirperm1 Supported: true\r\nLogging Driver: json-file\r\nPlugins: \r\n Volume: local\r\n Network: null bridge host overlay\r\nKernel Version: 4.4.36-boot2docker\r\nOperating System: Boot2Docker 1.12.4-rc1 (TCL 7.2); HEAD : 2a30a73 - Thu Dec  8 18:24:06 UTC 2016\r\nOSType: linux\r\nArchitecture: x86_64\r\nCPUs: 7\r\nTotal Memory: 7.789 GiB\r\nName: default\r\nID: HPQP:JBG2:NSWF:IUFQ:5QTM:CMOY:WQK5:OSKY:OBTV:ZIKS:T5AD:FVSA\r\nDebug mode (server): true\r\n File Descriptors: 63\r\n Goroutines: 57\r\n System Time: 2016-12-09T20:26:44.574994251Z\r\n EventsListeners: 0\r\n Init SHA1: \r\n Init Path: \r\n Docker Root Dir: /mnt/sda1/var/lib/docker\r\nLabels:\r\n provider=virtualbox\r\n"},"comment":{"url":"https://api.github.com/repos/testcontainers/testcontainers-java/issues/comments/266496457","html_url":"https://github.com/testcontainers/testcontainers-java/issues/253#issuecomment-266496457","issue_url":"https://api.github.com/repos/testcontainers/testcontainers-java/issues/253","id":266496457,"user":{"login":"pavelpp","id":4384615,"avatar_url":"https://avatars.githubusercontent.com/u/4384615?v=3","gravatar_id":"","url":"https://api.github.com/users/pavelpp","html_url":"https://github.com/pavelpp","followers_url":"https://api.github.com/users/pavelpp/followers","following_url":"https://api.github.com/users/pavelpp/following{/other_user}","gists_url":"https://api.github.com/users/pavelpp/gists{/gist_id}","starred_url":"https://api.github.com/users/pavelpp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pavelpp/subscriptions","organizations_url":"https://api.github.com/users/pavelpp/orgs","repos_url":"https://api.github.com/users/pavelpp/repos","events_url":"https://api.github.com/users/pavelpp/events{/privacy}","received_events_url":"https://api.github.com/users/pavelpp/received_events","type":"User","site_admin":false},"created_at":"2016-12-12T17:34:43Z","updated_at":"2016-12-12T17:34:43Z","body":"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 through 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 a lot 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.\r\n```\r\n$ docker ps\r\nCONTAINER ID        IMAGE                                           COMMAND                  CREATED             STATUS              PORTS                                              NAMES\r\ne1e309c3ee18        selenium/standalone-chrome-debug:3.0.1-barium   \"/opt/bin/entry_point\"   14 seconds ago      Up 12 seconds           0.0.0.0:33077->4444/tcp, 0.0.0.0:33076->5900/tcp   browser_awesome_babbage\r\n69b73e2ebf15        selenium/standalone-chrome-debug:3.0.1-barium   \"/opt/bin/entry_point\"   14 seconds ago      Up 13 seconds           0.0.0.0:33075->4444/tcp, 0.0.0.0:33074->5900/tcp   admiring_poincare\r\n```\r\n\r\nThis is how I create container:\r\n\r\n```\r\nimport org.jetbrains.annotations.NotNull;\r\nimport org.openqa.selenium.remote.DesiredCapabilities;\r\nimport org.testcontainers.containers.BrowserWebDriverContainer;\r\nimport org.testcontainers.images.RemoteDockerImage;\r\n\r\nimport java.time.Duration;\r\n\r\npublic class BrowserContainerProvider {\r\n\r\n    @NotNull\r\n    public static BrowserWebDriverContainer getBrowserWebDriverContainer() {\r\n        return new BrowserWebDriverContainer() {\r\n            @Override\r\n            protected void configure() {\r\n                super.configure();\r\n                withStartupAttempts(5);\r\n                withStartupTimeout(Duration.ofMinutes(5));\r\n                withDesiredCapabilities(DesiredCapabilities.chrome());\r\n            }\r\n\r\n            @Override\r\n            public String getDockerImageName() {\r\n                setImage(new RemoteDockerImage(\"selenium/standalone-chrome-debug:3.0.1-barium\"));\r\n                return super.getDockerImageName();\r\n            }\r\n        };\r\n    }\r\n}\r\n```\r\n\r\nAm I doing it wrong?"}}
{"actor":{"display_login":"pavelpp"}}