Skip to content

sim-sled-agent mixes omicron's dropshot dependency with propolis's dropshot dependency #3361

@jgallagher

Description

@jgallagher

When the simulated sled agent starts a mock propolis server:

let mock_api = propolis_server::mock_server::api();
let srv = dropshot::HttpServerStarter::new(
&dropshot_config,
mock_api,
private,
&dropshot_log,
)

we could be mixing two different dropshot versions. The dropshot used on line 622 is omicron's dependency, but the mock_api returned on line 620 is a dropshot::ApiDescription from propolis's dropshot dependency.

This works on main because both omicron and propolis depend on dropshot as a git dependency, and because there have been no breaking changes between what omicron expects and what propolis expects. However, if we change one of them, for example by changing omicron to point to a path-based dropshot, we get this unfortunate error:

error[E0308]: mismatched types
   --> sled-agent/src/sim/sled_agent.rs:624:13
    |
622 |         let srv = dropshot::HttpServerStarter::new(
    |                   -------------------------------- arguments to this function are incorrect
623 |             &dropshot_config,
624 |             mock_api,
    |             ^^^^^^^^ expected `ApiDescription<_>`, found `ApiDescription<Arc<Context>>`
    |
    = note: `ApiDescription<Arc<Context>>` and `ApiDescription<_>` have similar names, but are actually distinct types
note: `ApiDescription<Arc<Context>>` is defined in crate `dropshot`
   --> /home/john/.cargo/git/checkouts/dropshot-a4a923d29dccc492/3a42491/dropshot/src/api_description.rs:257:1
    |
257 | pub struct ApiDescription<Context: ServerContext> {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: `ApiDescription<_>` is defined in crate `dropshot`
   --> /data/github/dropshot/dropshot/src/api_description.rs:257:1
    |
257 | pub struct ApiDescription<Context: ServerContext> {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: perhaps two different versions of crate `dropshot` are being used?
note: associated function defined here
   --> /data/github/dropshot/dropshot/src/server.rs:109:12
    |
109 |     pub fn new(
    |            ^^^

This doesn't need to be fixed urgently, but should probably be addressed at some point, because there are a few innocuous changes that could cause this to pop up (e.g., either omicron or propolis starts using a crates.io release of dropshot instead of git).

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