Skip to content

Bug: 2.1.0 crashes when LOG_CLEAR_KEYS or LOG_CACHE_KEYS is set to "true" #9

Description

@abeforgit

On 2.1.0, any request to the cache while either the LOG_CLEAR_KEYS or LOG_CACHE_KEYS environment vars are set to true, results in the cache hard-crashing and not returning the response.

When these vars are not set, the cache works normally.

This does not happen on 2.0.2.

here's the error in the logs:

Request: GET /accounts/?filter%5Bprovider%5D=https%3A%2F%2Fgithub.com%2Flblod%2Fmock-login-service&include=gebruiker.bestuurseenheden&page%5Bsize%5D=10&page%5Bnumber%5D=0&sort=gebruiker.achternaam
** (exit) exited in: GenServer.call(#PID<0.481.0>, {:proxy, %Plug.Conn{adapter: {Plug.Cowboy.Conn, :...}, assigns: %{extra_path: ["accounts"], base_path: "/"}, before_send: [#Function<1.806958/1 in Plug.Logger.call/2>], body_params: %Plug.Conn.Unfetched{aspect: :body_params}, cookies: %Plug.Conn.Unfetched{aspect: :cookies}, halted: false, host: "gn.localhost", method: "GET", owner: #PID<0.480.0>, params: %{"filter" => %{"provider" => "https://github.com/lblod/mock-login-service"}, "include" => "gebruiker.bestuurseenheden", "page" => %{"number" => "0", "size" => "10"}, "path" => ["accounts"], "sort" => "gebruiker.achternaam"}, path_info: ["accounts"], path_params: %{"path" => ["accounts"]}, port: 80, private: %{plug_route: {"/*path", #Function<5.65273514/2 in MuCachePlug.do_match/4>}}, query_params: %{"filter" => %{"provider" => "https://github.com/lblod/mock-login-service"}, "include" => "gebruiker.bestuurseenheden", "page" => %{"number" => "0", "size" => "10"}, "sort" => "gebruiker.achternaam"}, query_string: "filter%5Bprovider%5D=https%3A%2F%2Fgithub.com%2Flblod%2Fmock-login-service&include=gebruiker.bestuurseenheden&page%5Bsize%5D=10&page%5Bnumber%5D=0&sort=gebruiker.achternaam", remote_ip: {172, 19, 0, 8}, req_cookies: %Plug.Conn.Unfetched{aspect: :cookies}, req_headers: [{"accept", "application/vnd.api+json"}, {"accept-encoding", "gzip, deflate, br, zstd"}, {"accept-language", "en-US,en;q=0.9,nl;q=0.8"}, {"content-length", "0"}, {"cookie", "proxy_session=QTEyOEdDTQ.m8kCvgttLNicmV67A7qSPbgQ2Zt318gVHatb8xGIDIeQ_JdJqktM_bx-ISE.pIaOaLsLLNFkfBqg.sHwdSBYyWfkLNPZOfx3nMZWlZvEWYsUsvpBuq3vbIKAAZgM1kvD50tBcwh8UozSfJbLXp3WwSHv2mH2CWZ6nQGD9s6MnR2wNoJDJtZ_a7_B6_BxYtR7TUroZvDlVzgclYOqMfPlJJv0_lEmy4s5xVkzsQpHhw8RwjkzOAxvNOKPrdw.VKtp4J1YYXQPAqRPr7fzYQ"}, {"dnt", "1"}, {"host", "gn.localhost"}, {"mu-call-id", "313032159853"}, {"mu-session-id", "http://mu.semte.ch/sessions/744aaaa6-539a-11f1-90f3-ba7ec01a87aa"}, {"referer", "http://gn.localhost/mock-login"}, {"sec-ch-ua", "\"Chromium\";v=\"146\", \"Not-A.Brand\";v=\"24\", \"Google Chrome\";v=\"146\""}, {"sec-ch-ua-mobile", "?0"}, {"sec-ch-ua-platform", "\"Linux\""}, {"sec-fetch-dest", "empty"}, {"sec-fetch-mode", "cors"}, {"sec-fetch-site", "same-origin"}, {"user-agent", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36"}, {"x-forwarded-for", "172.18.0.1"}, {"x-forwarded-host", "gn.localhost"}, {"x-forwarded-proto", "http"}, {"x-rewrite-url", "/accounts"}], request_path: "/accounts/", resp_body: nil, resp_cookies: %{}, resp_headers: [{"cache-control", "max-age=0, private, must-revalidate"}], scheme: :http, script_name: [], secret_key_base: nil, state: :unset, status: nil}, "", %ProxyManipulatorSettings{request: [], response: [Manipulators.CacheKeyLogger, Manipulators.StoreResponse, Manipulators.RemoveCacheRelatedKeys]}}, 600000)
    ** (EXIT) an exception was raised:
        ** (BadFunctionError) expected a function, got: "cache-keys"
            (elixir 1.14.5) lib/enum.ex:4211: Enum.find_list/3
            (elixir 1.14.5) lib/enum.ex:4211: Enum.find_list/3
            (mu_cache 2.1.0) lib/manipulators/cache_key_logger.ex:41: Manipulators.CacheKeyLogger.header_value/2
            (mu_cache 2.1.0) lib/manipulators/cache_key_logger.ex:33: Manipulators.CacheKeyLogger.maybe_log_cache_keys/1
            (mu_cache 2.1.0) lib/manipulators/cache_key_logger.ex:10: Manipulators.CacheKeyLogger.headers/2
            (plug_mint_proxy 0.2.0) lib/proxy_manipulator_settings.ex:130: ProxyManipulatorSettings.run_manipulators/3
            (plug_mint_proxy 0.2.0) lib/proxy_manipulator_settings.ex:53: ProxyManipulatorSettings.process_response_headers/3
            (plug_mint_proxy 0.2.0) lib/connection_forwarder.ex:264: ConnectionForwarder.process_chunk/2

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions