{"action":"created","issue":{"url":"https://api.github.com/repos/dart-lang/pub/issues/1293","labels_url":"https://api.github.com/repos/dart-lang/pub/issues/1293/labels{/name}","comments_url":"https://api.github.com/repos/dart-lang/pub/issues/1293/comments","events_url":"https://api.github.com/repos/dart-lang/pub/issues/1293/events","html_url":"https://github.com/dart-lang/pub/issues/1293","id":93837464,"number":1293,"title":"Using \"pub get --offline\" after a normal \"pub get\" seems in certain cases to fail","user":{"login":"mkustermann","id":5757092,"avatar_url":"https://avatars.githubusercontent.com/u/5757092?v=3","gravatar_id":"","url":"https://api.github.com/users/mkustermann","html_url":"https://github.com/mkustermann","followers_url":"https://api.github.com/users/mkustermann/followers","following_url":"https://api.github.com/users/mkustermann/following{/other_user}","gists_url":"https://api.github.com/users/mkustermann/gists{/gist_id}","starred_url":"https://api.github.com/users/mkustermann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mkustermann/subscriptions","organizations_url":"https://api.github.com/users/mkustermann/orgs","repos_url":"https://api.github.com/users/mkustermann/repos","events_url":"https://api.github.com/users/mkustermann/events{/privacy}","received_events_url":"https://api.github.com/users/mkustermann/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/dart-lang/pub/labels/bug","name":"bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":{"login":"nex3","id":188,"avatar_url":"https://avatars.githubusercontent.com/u/188?v=3","gravatar_id":"","url":"https://api.github.com/users/nex3","html_url":"https://github.com/nex3","followers_url":"https://api.github.com/users/nex3/followers","following_url":"https://api.github.com/users/nex3/following{/other_user}","gists_url":"https://api.github.com/users/nex3/gists{/gist_id}","starred_url":"https://api.github.com/users/nex3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nex3/subscriptions","organizations_url":"https://api.github.com/users/nex3/orgs","repos_url":"https://api.github.com/users/nex3/repos","events_url":"https://api.github.com/users/nex3/events{/privacy}","received_events_url":"https://api.github.com/users/nex3/received_events","type":"User","site_admin":false},"milestone":null,"comments":2,"created_at":"2015-07-08T16:46:03Z","updated_at":"2015-07-09T18:11:50Z","closed_at":"2015-07-09T00:26:57Z","body":"The dart team provides base [Dockerfiles](https://github.com/dart-lang/dart_docker/blob/master/runtime/Dockerfile.template#L14) which make use of the `--offline` option the pub client provides.\r\n\r\nThe motivation for having two separate steps (i.e. `pub get` and `pub get --offline`) is to make use of Docker's layer caching functionality, which allows us to avoid re-running the slow `pub get` step in a developer cycle.\r\n\r\nWe've had repeated reports, from internal and external Dart users, that this causes sometimes issues of the following form:\r\n```\r\n...\r\nINFO: --------------------  DOCKER BUILD  --------------------\r\nDEBUG: \"POST /v1.10/build?q=False&... HTTP/1.1\" 200 None\r\n\r\nINFO: # Executing 4 build triggers\r\n\r\n\r\nINFO: Trigger 0, ADD pubspec.* /app/\r\nINFO: Step 0 : ADD pubspec.* /app/\r\nINFO: ---> Using cache\r\nINFO: Trigger 1, RUN pub get\r\nINFO: Step 0 : RUN pub get\r\nINFO: ---> Using cache\r\nINFO: Trigger 2, ADD . /app/\r\nINFO: Step 0 : ADD . /app/\r\nINFO: Trigger 3, RUN pub get --offline\r\nINFO: Step 0 : RUN pub get --offline\r\nINFO: ---> Running in 20d5b52f15d6\r\nINFO: Resolving dependencies...\r\nINFO: \r\nINFO: Unsupported operation: Cannot download packages when offline.\r\nINFO: ../tmp/tmp_ldPtI/dart-1.10.0/dart/sdk/lib/_internal/pub/lib/src/source/hosted.dart 261  OfflineHostedSource._download\r\n../tmp/tmp_ldPtI/dart-1.10.0/dart/sdk/lib/_internal/pub/lib/src/source/hosted.dart 88   HostedSource.downloadToSystemCache.<fn>\r\nINFO: dart:isolate                                                                            _RawReceivePortImpl._handleMessage\r\nINFO: This is an unexpected error. Please run\r\nINFO:     pub --trace 'get' '--offline'\r\nINFO: and include the results in a bug report on http://dartbug.com/new.\r\n\r\nERROR: The command [/bin/sh -c pub get --offline] returned a non-zero code: 1\r\n...\r\n```\r\n\r\nThe layer caching of docker should guarantee the following properties\r\n  * The version of the dart SDK (and therefore pub's version) of both \"pub get\" steps is the same\r\n  * The `pubspec.{yaml,lock}` files in both \"pub get\" steps are the same\r\n\r\nThe only possible explanation I can come up is that there is a bug in pub. The first successful `pub get` step should populate the pub cache with all necessary external dependencies. Any subsequent runs of `pub get --offline` with the same `pubspec.{yaml,lock}` files should never hit the network and all external dependencies should be available in the pub cache.\r\n\r\n@nex3 @munificent Can you go through the code and look when this error can happen? Or do you see any other possible explanation?\r\n\r\ncc: @enyo, @lukechurch, @sgjesse \r\n\r\n"},"comment":{"url":"https://api.github.com/repos/dart-lang/pub/issues/comments/120090799","html_url":"https://github.com/dart-lang/pub/issues/1293#issuecomment-120090799","issue_url":"https://api.github.com/repos/dart-lang/pub/issues/1293","id":120090799,"user":{"login":"nex3","id":188,"avatar_url":"https://avatars.githubusercontent.com/u/188?v=3","gravatar_id":"","url":"https://api.github.com/users/nex3","html_url":"https://github.com/nex3","followers_url":"https://api.github.com/users/nex3/followers","following_url":"https://api.github.com/users/nex3/following{/other_user}","gists_url":"https://api.github.com/users/nex3/gists{/gist_id}","starred_url":"https://api.github.com/users/nex3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nex3/subscriptions","organizations_url":"https://api.github.com/users/nex3/orgs","repos_url":"https://api.github.com/users/nex3/repos","events_url":"https://api.github.com/users/nex3/events{/privacy}","received_events_url":"https://api.github.com/users/nex3/received_events","type":"User","site_admin":false},"created_at":"2015-07-09T18:11:50Z","updated_at":"2015-07-09T18:11:50Z","body":"As far as I could tell, the only way for the bug you're seeing to come up is if there was a legitimate error—in particular, if there was a locked version of a package that didn't exist in the local cache. That said, it's possible that the HTTP requests that were being made incorrectly had broader implications that could cause strange behavior. I think the only way to know for sure is to see how the Docker/Dart integration works with the new pub."}}