Skip to content

InABox reactor crashes if it can't find a snapshot #123

@Davis-A

Description

@Davis-A

This is running master with a small diff to the regex to force i failure to find a snapshot.

-        grep { $_->{name} =~ m/^fminabox-/ }
+        grep { $_->{name} =~ m/^zzfminabox-/ }                                                                                                                                                                                                                                          

User requests 'box create' and gets back

Creating box, this will take a minute or two.
My inabox reactor crashed while handling your message. Sorry!

Console output:

adavis@adavis-lenovo:~/src/box-version-Synergy$ carton exec perl bin/synergy -c /home/adavis/src/box-version-Synergy/config.json
LOG | listening on port 8118
LOG | registered /metrics
LOG | Connected to Slack!
LOG | Slack group conversations loaded
LOG | Slack dm channels loaded
LOG | Slack channels loaded
LOG | Users loaded
LOG | message event from slack/u:adavis: box create
LOG | Found SSH key: 24704070 (fminabox)
LOG | fminabox snapshot not found?!
LOG | error with box listener on inabox: Can't use an undefined value as a HASH reference at lib/Synergy/Reactor/InABox.pm line 131.

Code path enters the else branch then returns undef.

 if ($snapshot) {
        $Logger->log([ "Found snapshot: %s (%s)", $snapshot->{id}, $snapshot->{name} ]);
      }
      else {
        $Logger->log([ "fminabox snapshot not found?!" ]);
      }
      Future->done($snapshot);
    }

So then we try to get the id of undef. And never reach the check.

  my ($snapshot_id, $ssh_key_id) = Future->wait_all(
    $self->_get_snapshot,
    $self->_get_ssh_key,
  )->then(
    sub (@futures) {
      Future->done(map { $_->get->{id} } @futures)
    }
  )->get;

My thought is if we get a value back, it will have an id. We should put the check in the then that what we got back was defined and then get the id. I'm not sure what that looks like though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions