Skip to content

Add a flag to silence the error message for an out-of-date snapshot version #20784

Description

@nex3

When "pub run" starts running the VM on a snapshot, it pipes the child process's stdout and stderr to the main process's streams. However, if the snapshot is out-of-date, this means that the user sees the "Wrong full snapshot version" message, which is confusing for them since pub otherwise silently handles snapshot recompilation.

It would be good if there were a flag that could be passed to the VM to disable this message.

Activity

  1. sethladd commented on Sep 3, 2014

    @sethladd
    Contributor

    Could you consume the stderr, look for this warning, and if you see it, filter it and compensate (recompile) ?

    Are you spawning the child process as an isolate or as a separate OS process?

    Agreed, this would be a confusing message for the user.


    Removed Priority-Unassigned label.
    Added Priority-Low label.

  2. nex3 commented on Sep 3, 2014

    @nex3
    MemberAuthor

    Could you consume the stderr, look for this warning, and if you see it, filter it and compensate (recompile) ?

    Theoretically yes, but this would add a lot of complexity since we want to avoid getting in the way of child processes at all. We don't want to parse the output as a string since it may be binary data, so we'd have to match the raw bytes against some known prefix. We'd need to replay them if we found any that don't match the expected message from the VM or if the process exited with a non-VM exit code. All of this would have to be done in the face of potentially-arbitrary chunking of bytes.

    Are you spawning the child process as an isolate or as a separate OS process?

    The latter, although that's not set in stone.

  3. nex3 commented on Feb 6, 2015

    @nex3
    MemberAuthor

    Marked this as blocking #22308.

  4. sethladd commented on May 8, 2015

    @sethladd
    Contributor

    Just ran stagehand, and got two scary messages:

    sethladd@sethladd-macbookair ~/manyanonlibs $ stagehand package
    Wrong script snapshot version, expected 'a10659e29cf9744e06a63bf183bc5c49' found 'd4922cb239c676d9d6f97ef6347fc02b'
    Wrong script snapshot version, expected 'a10659e29cf9744e06a63bf183bc5c49' found 'd4922cb239c676d9d6f97ef6347fc02b'
    Creating package application 'manyanonlibs':
      /Users/sethladd/manyanonlibs/.gitignore
      /Users/sethladd/manyanonlibs/CHANGELOG.md
      /Users/sethladd/manyanonlibs/LICENSE
      /Users/sethladd/manyanonlibs/README.md
      /Users/sethladd/manyanonlibs/example/manyanonlibs.dart
      /Users/sethladd/manyanonlibs/lib/manyanonlibs.dart
      /Users/sethladd/manyanonlibs/lib/src/manyanonlibs_base.dart
      /Users/sethladd/manyanonlibs/pubspec.yaml
      /Users/sethladd/manyanonlibs/test/all_test.dart
    9 files written.

    --> to provision required packages, run 'pub get'

    Wondering what we can do to not print these two duplicate wrong script snapshot version messages?

    Here's what the script looks like (which is created when pub globally activates a package aka installs the package globally)

    #!/usr/bin/env sh

    This file was created by pub v1.9.1.

    Package: stagehand

    Version: 0.1.5+4

    Executable: stagehand

    Script: stagehand

    dart "/Users/sethladd/.pub-cache/global_packages/stagehand/bin/stagehand.dart.snapshot" "$@"

    The VM exits with code 253 if the snapshot version is out-of-date.

    If it is, we need to delete it and run "pub global" manually.

    exit_code=$?
    if [ $exit_code != 253 ]; then
      exit $exit_code
    fi

    pub global run stagehand:stagehand "$@"


    cc @a-siva.

  5. sethladd commented on May 8, 2015

    @sethladd
    Contributor

    Scenario A: stop creating snapshots. problem solved :)

    Scenario B: pass something to the VM that says "please don't print out a snapshot version mismatch message"

    Scenario C: consume all stderr with some wrapper script/shell-thing and filter out that message

    Personally, I'm a fan of A, as it's the most simple solution. Thoughts?


    cc @floitschG.

  6. nex3 commented on May 8, 2015

    @nex3
    MemberAuthor

    Snapshots are crucial for the performance of package executables, especially those that are the result of transformed code. Scenario A isn't an option, at least until the VM somehow gets to the point where it starts up equally fast on raw Dart code.

    Scenario C would pose all the same semantic problems with wrapping that we're seeing with "pub run". As far as I know, there's no way to both capture a subprocess's stdout and still convince the subprocess that it's talking to a terminal.

    Scenario B would work okay, but I'd prefer the solution outlined in issue #20802: passing a flag to the VM that causes it to just return an exit code for whether the snapshot is up to date without trying to run it at all. Not only would this be extremely simple, it would eliminate any possibility of the executable returning the same exit code that the VM uses to signal an invalid snapshot, which is a problem with the current setup and with Scenario B.

  7. added
    P3A lower priority bug or feature request
    area-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.
    on May 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3A lower priority bug or feature requestarea-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.customer-pubtype-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions