Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PREvant is not Working with Docker Engine 25.0.1 #160

Closed
schrieveslaach opened this issue Jan 25, 2024 · 1 comment · Fixed by #161
Closed

PREvant is not Working with Docker Engine 25.0.1 #160

schrieveslaach opened this issue Jan 25, 2024 · 1 comment · Fixed by #161
Labels
bug Something isn't working

Comments

@schrieveslaach
Copy link
Contributor

Since Docker Engine 25.0.1 PREvant stops working in some environments with following error when creating a application:

{
  "type": "https://httpstatuses.com/500",
  "status": 500,
  "title": "Internal Server Error",
  "detail": "Cannot interact with infrastructure: Docker Error: invalid type: null, expected a sequence at line 1 column 242"
}

Output of docker version:

Client: Docker Engine - Community
 Version:           25.0.1
 API version:       1.44
 Go version:        go1.21.6
 Git commit:        29cf629
 Built:             Tue Jan 23 23:09:52 2024
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          25.0.1
  API version:      1.44 (minimum version 1.24)
  Go version:       go1.21.6
  Git commit:       71fa3ab
  Built:            Tue Jan 23 23:09:52 2024
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.27
  GitCommit:        a1496014c916f9e62104b33d1bb5bd03b0858e59
 runc:
  Version:          1.1.11
  GitCommit:        v1.1.11-0-g4bccb38
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

With RUST_LOG=trace reveals that the logging of this line seems to be executed but the network creating afterwards fails because there is no network created on the host and no other PREvant specific logs are revealed:

[2024-01-25T11:45:35Z TRACE prevant::infrastructure::docker] Resolve network id for test
[2024-01-25T11:45:35Z TRACE hyper::client::conn] client handshake Http1
[2024-01-25T11:45:35Z TRACE hyper::client::client] handshake complete, spawning background dispatcher task
[2024-01-25T11:45:35Z TRACE hyper::proto::h1::conn] flushed({role=client}): State { reading: Init, writing: Init, keep_alive: Busy }
[2024-01-25T11:45:35Z TRACE tracing::span] encode_headers;
[2024-01-25T11:45:35Z TRACE tracing::span::active] -> encode_headers;
[2024-01-25T11:45:35Z TRACE hyper::proto::h1::role] Client::encode method=GET, body=None
[2024-01-25T11:45:35Z TRACE tracing::span::active] <- encode_headers;
[2024-01-25T11:45:35Z TRACE tracing::span] -- encode_headers;
[2024-01-25T11:45:35Z DEBUG hyper::proto::h1::io] flushed 34 bytes
[2024-01-25T11:45:35Z TRACE hyper::proto::h1::conn] flushed({role=client}): State { reading: Init, writing: KeepAlive, keep_alive: Busy }
[2024-01-25T11:45:35Z TRACE hyper::proto::h1::conn] Conn::read_head
[2024-01-25T11:45:35Z TRACE hyper::proto::h1::io] received 2248 bytes
[2024-01-25T11:45:35Z TRACE tracing::span] parse_headers;
[2024-01-25T11:45:35Z TRACE tracing::span::active] -> parse_headers;
[2024-01-25T11:45:35Z TRACE hyper::proto::h1::role] Response.parse bytes=2248
[2024-01-25T11:45:35Z TRACE hyper::proto::h1::role] Response.parse Complete(203)
[2024-01-25T11:45:35Z TRACE tracing::span::active] <- parse_headers;
[2024-01-25T11:45:35Z TRACE tracing::span] -- parse_headers;
[2024-01-25T11:45:35Z DEBUG hyper::proto::h1::io] parsed 7 headers
[2024-01-25T11:45:35Z DEBUG hyper::proto::h1::conn] incoming body is content-length (2045 bytes)
[2024-01-25T11:45:35Z TRACE hyper::proto::h1::decode] decode; state=Length(2045)
[2024-01-25T11:45:35Z DEBUG hyper::proto::h1::conn] incoming body completed
[2024-01-25T11:45:35Z TRACE hyper::proto::h1::conn] maybe_notify; read_from_io blocked
[2024-01-25T11:45:35Z TRACE hyper::proto::h1::conn] flushed({role=client}): State { reading: Init, writing: Init, keep_alive: Idle }
[2024-01-25T11:45:35Z TRACE hyper::proto::h1::conn] flushed({role=client}): State { reading: Init, writing: Init, keep_alive: Idle }
[2024-01-25T11:45:35Z TRACE hyper::client::pool] pool dropped, dropping pooled (("unix", 2f7661722f72756e2f646f636b65722e736f636b:0))
[2024-01-25T11:45:35Z TRACE hyper::proto::h1::dispatch] client tx closed
[2024-01-25T11:45:35Z TRACE hyper::proto::h1::conn] State::close_read()
[2024-01-25T11:45:35Z TRACE hyper::proto::h1::conn] State::close_write()
[2024-01-25T11:45:35Z TRACE hyper::proto::h1::conn] flushed({role=client}): State { reading: Closed, writing: Closed, keep_alive: Disabled }
[2024-01-25T11:45:35Z TRACE hyper::proto::h1::conn] shut down IO complete
[2024-01-25T11:45:35Z TRACE hyper::client::conn] client handshake Http1
[2024-01-25T11:45:35Z TRACE hyper::client::client] handshake complete, spawning background dispatcher task
[2024-01-25T11:45:35Z TRACE hyper::proto::h1::conn] flushed({role=client}): State { reading: Init, writing: Init, keep_alive: Busy }
[2024-01-25T11:45:35Z TRACE tracing::span] encode_headers;
[2024-01-25T11:45:35Z TRACE tracing::span::active] -> encode_headers;
[2024-01-25T11:45:35Z TRACE hyper::proto::h1::role] Client::encode method=DELETE, body=None
[2024-01-25T11:45:35Z TRACE tracing::span::active] <- encode_headers;
[2024-01-25T11:45:35Z TRACE tracing::span] -- encode_headers;
[2024-01-25T11:45:35Z DEBUG hyper::proto::h1::io] flushed 104 bytes
[2024-01-25T11:45:35Z TRACE hyper::proto::h1::conn] flushed({role=client}): State { reading: Init, writing: KeepAlive, keep_alive: Busy }
[2024-01-25T11:45:35Z TRACE hyper::proto::h1::conn] Conn::read_head
[2024-01-25T11:45:35Z TRACE hyper::proto::h1::io] received 157 bytes
[2024-01-25T11:45:35Z TRACE tracing::span] parse_headers;
[2024-01-25T11:45:35Z TRACE tracing::span::active] -> parse_headers;
[2024-01-25T11:45:35Z TRACE hyper::proto::h1::role] Response.parse bytes=157
[2024-01-25T11:45:35Z TRACE hyper::proto::h1::role] Response.parse Complete(157)
[2024-01-25T11:45:35Z TRACE tracing::span::active] <- parse_headers;
[2024-01-25T11:45:35Z TRACE tracing::span] -- parse_headers;
[2024-01-25T11:45:35Z DEBUG hyper::proto::h1::io] parsed 5 headers
[2024-01-25T11:45:35Z DEBUG hyper::proto::h1::conn] incoming body is empty
[2024-01-25T11:45:35Z TRACE hyper::proto::h1::conn] maybe_notify; read_from_io blocked
[2024-01-25T11:45:35Z TRACE hyper::proto::h1::conn] flushed({role=client}): State { reading: Init, writing: Init, keep_alive: Idle }
[2024-01-25T11:45:35Z TRACE hyper::proto::h1::conn] flushed({role=client}): State { reading: Init, writing: Init, keep_alive: Idle }
[2024-01-25T11:45:35Z TRACE hyper::client::pool] pool dropped, dropping pooled (("unix", 2f7661722f72756e2f646f636b65722e736f636b:0))
[2024-01-25T11:45:35Z TRACE prevant::apps] Dropped guard for Some("test")
[2024-01-25T11:45:35Z ERROR prevant::apps::routes] Internal server error: Cannot interact with infrastructure: Docker Error: invalid type: null, expected a sequence at line 1 column 242
[2024-01-25T11:45:35Z INFO  rocket::server::_] Outcome: Success(500 Internal Server Error)
[2024-01-25T11:45:35Z TRACE hyper::proto::h1::dispatch] client tx closed
[2024-01-25T11:45:35Z TRACE hyper::proto::h1::conn] State::close_read()
[2024-01-25T11:45:35Z TRACE hyper::proto::h1::conn] State::close_write()
[2024-01-25T11:45:35Z TRACE hyper::proto::h1::conn] flushed({role=client}): State { reading: Closed, writing: Closed, keep_alive: Disabled }
[2024-01-25T11:45:35Z TRACE hyper::proto::h1::conn] shut down IO complete
[2024-01-25T11:45:35Z DEBUG rocket::server] sending response: Response {
        status: 500,
        version: HTTP/1.1,
        headers: {
            "content-type": "application/problem+json",
            "server": "Rocket",
            "x-content-type-options": "nosniff",
            "x-frame-options": "SAMEORIGIN",
            "permissions-policy": "interest-cohort=()",
            "content-length": "207",
        },
        body: Body(
            Streaming,
        ),
    }
@schrieveslaach schrieveslaach added the bug Something isn't working label Jan 25, 2024
@samuchila
Copy link
Contributor

samuchila commented Jan 31, 2024

@schrieveslaach I did some digging around this and found the root cause.
The docker update has made a change to the structure of response of /networks where the config of IPAM is now represented as null if no value present. Previously this was [].

[{"Name":"none","Id":"07fe9b8f31c7883205eb8554d2f5ad9efd976fc4a0ca17740bc465e068835643","Created":"2024-01-31T10:08:44.272561842+01:00","Scope":"local","Driver":"null","EnableIPv6":false,"IPAM":{"Driver":"default","Options":null,

"Config":null

},"Internal":false,"Attachable":false,"Ingress":false,"ConfigFrom":{"Network":""},"ConfigOnly":false,"Containers":{},"Options":{},"Labels":{}}

Subsequently, to store the Network details from /network - Shiplift uses struct NetworkDetails which has an internal struct called IPAM which has config of type Vec<HashMap<String,String>> : Ref https://docs.rs/shiplift/0.7.0/src/shiplift/rep.rs.html#265-269
Serde fails to deserialize this and throws the below error

[src/infrastructure/docker.rs:154] docker.networks().list(&Default::default()).await = Err( SerdeJsonError( Error("invalid type: null, expected a sequence", line: 1, column: 242), ), )

As a hack we can just wrap an Option around the config and use the custom crate of shiplift as maintenance has been stopped for it. softprops/shiplift#321
A solution here would be to use https://crates.io/crates/bollard

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants